ocsp.h

来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 453 行 · 第 1/2 页

H
453
字号
/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ *  * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. *  * The Original Code is the Netscape security libraries. *  * The Initial Developer of the Original Code is Netscape * Communications Corporation.  Portions created by Netscape are  * Copyright (C) 1994-2000 Netscape Communications Corporation.  All * Rights Reserved. *  * Contributor(s): *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable  * instead of those above.  If you wish to allow use of your  * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL.  If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. *//* * Interface to the OCSP implementation. * * $Id: ocsp.h,v 1.1 2000/03/31 19:43:02 relyea%netscape.com Exp $ */#ifndef _OCSP_H_#define _OCSP_H_#include "plarena.h"#include "seccomon.h"#include "secoidt.h"#include "keyt.h"#include "certt.h"#include "ocspt.h"/************************************************************************/SEC_BEGIN_PROTOS/* * FUNCTION: CERT_EnableOCSPChecking *   Turns on OCSP checking for the given certificate database. * INPUTS: *   CERTCertDBHandle *handle *     Certificate database for which OCSP checking will be enabled. * RETURN: *   Returns SECFailure if an error occurred (likely only problem *   allocating memory); SECSuccess otherwise. */extern SECStatusCERT_EnableOCSPChecking(CERTCertDBHandle *handle);/* * FUNCTION: CERT_DisableOCSPChecking *   Turns off OCSP checking for the given certificate database. *   This routine disables OCSP checking.  Though it will return *   SECFailure if OCSP checking is not enabled, it is "safe" to *   call it that way and just ignore the return value, if it is *   easier to just call it than to "remember" whether it is enabled. * INPUTS: *   CERTCertDBHandle *handle *     Certificate database for which OCSP checking will be disabled. * RETURN: *   Returns SECFailure if an error occurred (usually means that OCSP *   checking was not enabled or status contexts were not initialized -- *   error set will be SEC_ERROR_OCSP_NOT_ENABLED); SECSuccess otherwise. */extern SECStatusCERT_DisableOCSPChecking(CERTCertDBHandle *handle);/* * FUNCTION: CERT_SetOCSPDefaultResponder *   Specify the location and cert of the default responder. *   If OCSP checking is already enabled *and* use of a default responder *   is also already enabled, all OCSP checking from now on will go directly *   to the specified responder.  If OCSP checking is not enabled, or if *   it is but use of a default responder is not enabled, the information *   will be recorded and take effect whenever both are enabled. * INPUTS: *   CERTCertDBHandle *handle *     Cert database on which OCSP checking should use the default responder. *   char *url *     The location of the default responder (e.g. "http://foo.com:80/ocsp") *     Note that the location will not be tested until the first attempt *     to send a request there. *   char *name *     The nickname of the cert to trust (expected) to sign the OCSP responses. *     If the corresponding cert cannot be found, SECFailure is returned. * RETURN: *   Returns SECFailure if an error occurred; SECSuccess otherwise. *   The most likely error is that the cert for "name" could not be found *   (probably SEC_ERROR_UNKNOWN_CERT).  Other errors are low-level (no memory, *   bad database, etc.). */extern SECStatusCERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle,			     const char *url, const char *name);/* * FUNCTION: CERT_EnableOCSPDefaultResponder *   Turns on use of a default responder when OCSP checking. *   If OCSP checking is already enabled, this will make subsequent checks *   go directly to the default responder.  (The location of the responder *   and the nickname of the responder cert must already be specified.) *   If OCSP checking is not enabled, this will be recorded and take effect *   whenever it is enabled. * INPUTS: *   CERTCertDBHandle *handle *     Cert database on which OCSP checking should use the default responder. * RETURN: *   Returns SECFailure if an error occurred; SECSuccess otherwise. *   No errors are especially likely unless the caller did not previously *   perform a successful call to SetOCSPDefaultResponder (in which case *   the error set will be SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER). */extern SECStatusCERT_EnableOCSPDefaultResponder(CERTCertDBHandle *handle);/* * FUNCTION: CERT_DisableOCSPDefaultResponder *   Turns off use of a default responder when OCSP checking. *   (Does nothing if use of a default responder is not enabled.) * INPUTS: *   CERTCertDBHandle *handle *     Cert database on which OCSP checking should stop using a default *     responder. * RETURN: *   Returns SECFailure if an error occurred; SECSuccess otherwise. *   Errors very unlikely (like random memory corruption...). */extern SECStatusCERT_DisableOCSPDefaultResponder(CERTCertDBHandle *handle);/* * ------------------------------------------------------- * The Functions above are those expected to be used by a client * providing OCSP status checking along with every cert verification. * The functions below are for OCSP testing, debugging, or clients * or servers performing more specialized OCSP tasks. * ------------------------------------------------------- *//* * FUNCTION: CERT_CreateOCSPRequest *   Creates a CERTOCSPRequest, requesting the status of the certs in  *   the given list. * INPUTS: *   CERTCertList *certList *     A list of certs for which status will be requested. *     Note that all of these certificates should have the same issuer, *     or it's expected the response will be signed by a trusted responder. *     If the certs need to be broken up into multiple requests, that *     must be handled by the caller (and thus by having multiple calls *     to this routine), who knows about where the request(s) are being *     sent and whether there are any trusted responders in place. *   int64 time *     Indicates the time for which the certificate status is to be  *     determined -- this may be used in the search for the cert's issuer *     but has no effect on the request itself. *   PRBool addServiceLocator *     If true, the Service Locator extension should be added to the *     single request(s) for each cert. *   CERTCertificate *signerCert *     If non-NULL, means sign the request using this cert.  Otherwise, *     do not sign. *     XXX note that request signing is not yet supported; see comment in code * RETURN: *   A pointer to a CERTOCSPRequest structure containing an OCSP request *   for the cert list.  On error, null is returned, with an error set *   indicating the reason.  This is likely SEC_ERROR_UNKNOWN_ISSUER. *   (The issuer is needed to create a request for the certificate.) *   Other errors are low-level problems (no memory, bad database, etc.). */extern CERTOCSPRequest *CERT_CreateOCSPRequest(CERTCertList *certList, int64 time, 		       PRBool addServiceLocator,		       CERTCertificate *signerCert);/* * FUNCTION: CERT_AddOCSPAcceptableResponses *   Add the AcceptableResponses extension to an OCSP Request. * INPUTS: *   CERTOCSPRequest *request *     The request to which the extension should be added. *   ... *     A list (of one or more) of SECOidTag -- each of the response types *     to be added.  The last OID *must* be SEC_OID_PKIX_OCSP_BASIC_RESPONSE. *     (This marks the end of the list, and it must be specified because a *     client conforming to the OCSP standard is required to handle the basic *     response type.)  The OIDs are not checked in any way. * RETURN: *   SECSuccess if the extension is added; SECFailure if anything goes wrong. *   All errors are internal or low-level problems (e.g. no memory). */extern SECStatusCERT_AddOCSPAcceptableResponses(CERTOCSPRequest *request, ...);/*  * FUNCTION: CERT_EncodeOCSPRequest *   DER encodes an OCSP Request, possibly adding a signature as well. *   XXX Signing is not yet supported, however; see comments in code. * INPUTS:  *   PRArenaPool *arena *     The return value is allocated from here. *     If a NULL is passed in, allocation is done from the heap instead. *   CERTOCSPRequest *request *     The request to be encoded. *   void *pwArg *     Pointer to argument for password prompting, if needed.  (Definitely *     not needed if not signing.) * RETURN: *   Returns a NULL on error and a pointer to the SECItem with the

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?