ocsp.h
来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 453 行 · 第 1/2 页
H
453 行
* encoded value otherwise. Any error is likely to be low-level * (e.g. no memory). */extern SECItem *CERT_EncodeOCSPRequest(PRArenaPool *arena, CERTOCSPRequest *request, void *pwArg);/* * FUNCTION: CERT_DecodeOCSPRequest * Decode a DER encoded OCSP Request. * INPUTS: * SECItem *src * Pointer to a SECItem holding DER encoded OCSP Request. * RETURN: * Returns a pointer to a CERTOCSPRequest containing the decoded request. * On error, returns NULL. Most likely error is trouble decoding * (SEC_ERROR_OCSP_MALFORMED_REQUEST), or low-level problem (no memory). */extern CERTOCSPRequest *CERT_DecodeOCSPRequest(SECItem *src);/* * FUNCTION: CERT_DestroyOCSPRequest * Frees an OCSP Request structure. * INPUTS: * CERTOCSPRequest *request * Pointer to CERTOCSPRequest to be freed. * RETURN: * No return value; no errors. */extern voidCERT_DestroyOCSPRequest(CERTOCSPRequest *request);/* * FUNCTION: CERT_DecodeOCSPResponse * Decode a DER encoded OCSP Response. * INPUTS: * SECItem *src * Pointer to a SECItem holding DER encoded OCSP Response. * RETURN: * Returns a pointer to a CERTOCSPResponse (the decoded OCSP Response); * the caller is responsible for destroying it. Or NULL if error (either * response could not be decoded (SEC_ERROR_OCSP_MALFORMED_RESPONSE), * it was of an unexpected type (SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE), * or a low-level or internal error occurred). */extern CERTOCSPResponse *CERT_DecodeOCSPResponse(SECItem *src);/* * FUNCTION: CERT_DestroyOCSPResponse * Frees an OCSP Response structure. * INPUTS: * CERTOCSPResponse *request * Pointer to CERTOCSPResponse to be freed. * RETURN: * No return value; no errors. */extern voidCERT_DestroyOCSPResponse(CERTOCSPResponse *response);/* * FUNCTION: CERT_GetEncodedOCSPResponse * Creates and sends a request to an OCSP responder, then reads and * returns the (encoded) response. * INPUTS: * PRArenaPool *arena * Pointer to arena from which return value will be allocated. * If NULL, result will be allocated from the heap (and thus should * be freed via SECITEM_FreeItem). * 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. * char *location * The location of the OCSP responder (a URL). * 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 other bearing on the operation. * 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. * void *pwArg * Pointer to argument for password prompting, if needed. (Definitely * not needed if not signing.) * OUTPUTS: * CERTOCSPRequest **pRequest * Pointer in which to store the OCSP request created for the given * list of certificates. It is only filled in if the entire operation * is successful and the pointer is not null -- and in that case the * caller is then reponsible for destroying it. * RETURN: * Returns a pointer to the SECItem holding the response. * On error, returns null with error set describing the reason: * SEC_ERROR_UNKNOWN_ISSUER * SEC_ERROR_CERT_BAD_ACCESS_LOCATION * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE * Other errors are low-level problems (no memory, bad database, etc.). */extern SECItem *CERT_GetEncodedOCSPResponse(PRArenaPool *arena, CERTCertList *certList, char *location, int64 time, PRBool addServiceLocator, CERTCertificate *signerCert, void *pwArg, CERTOCSPRequest **pRequest);/* * FUNCTION: CERT_VerifyOCSPResponseSignature * Check the signature on an OCSP Response. Will also perform a * verification of the signer's certificate. Note, however, that a * successful verification does not make any statement about the * signer's *authority* to provide status for the certificate(s), * that must be checked individually for each certificate. * INPUTS: * CERTOCSPResponse *response * Pointer to response structure with signature to be checked. * CERTCertDBHandle *handle * Pointer to CERTCertDBHandle for certificate DB to use for verification. * void *pwArg * Pointer to argument for password prompting, if needed. * OUTPUTS: * CERTCertificate **pSignerCert * Pointer in which to store signer's certificate; only filled-in if * non-null. * RETURN: * Returns SECSuccess when signature is valid, anything else means invalid. * Possible errors set: * SEC_ERROR_OCSP_MALFORMED_RESPONSE - unknown type of ResponderID * SEC_ERROR_INVALID_TIME - bad format of "ProducedAt" time * SEC_ERROR_UNKNOWN_SIGNER - signer's cert could not be found * SEC_ERROR_BAD_SIGNATURE - the signature did not verify * Other errors are any of the many possible failures in cert verification * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when * verifying the signer's cert, or low-level problems (no memory, etc.) */extern SECStatusCERT_VerifyOCSPResponseSignature(CERTOCSPResponse *response, CERTCertDBHandle *handle, void *pwArg, CERTCertificate **pSignerCert);/* * FUNCTION: CERT_GetOCSPAuthorityInfoAccessLocation * Get the value of the URI of the OCSP responder for the given cert. * This is found in the (optional) Authority Information Access extension * in the cert. * INPUTS: * CERTCertificate *cert * The certificate being examined. * RETURN: * char * * A copy of the URI for the OCSP method, if found. If either the * extension is not present or it does not contain an entry for OCSP, * SEC_ERROR_EXTENSION_NOT_FOUND will be set and a NULL returned. * Any other error will also result in a NULL being returned. * * This result should be freed (via PORT_Free) when no longer in use. */extern char *CERT_GetOCSPAuthorityInfoAccessLocation(CERTCertificate *cert);/* * FUNCTION: CERT_CheckOCSPStatus * Checks the status of a certificate via OCSP. Will only check status for * a certificate that has an AIA (Authority Information Access) extension * for OCSP *or* when a "default responder" is specified and enabled. * (If no AIA extension for OCSP and no default responder in place, the * cert is considered to have a good status and SECSuccess is returned.) * INPUTS: * CERTCertDBHandle *handle * certificate DB of the cert that is being checked * CERTCertificate *cert * the certificate being checked * XXX in the long term also need a boolean parameter that specifies * whether to check the cert chain, as well; for now we check only * the leaf (the specified certificate) * int64 time * time for which status is to be determined * void *pwArg * argument for password prompting, if needed * RETURN: * Returns SECSuccess if an approved OCSP responder "knows" the cert * *and* returns a non-revoked status for it; SECFailure otherwise, * with an error set describing the reason: * * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE * SEC_ERROR_OCSP_FUTURE_RESPONSE * SEC_ERROR_OCSP_MALFORMED_REQUEST * SEC_ERROR_OCSP_MALFORMED_RESPONSE * SEC_ERROR_OCSP_OLD_RESPONSE * SEC_ERROR_OCSP_REQUEST_NEEDS_SIG * SEC_ERROR_OCSP_SERVER_ERROR * SEC_ERROR_OCSP_TRY_SERVER_LATER * SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST * SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE * SEC_ERROR_OCSP_UNKNOWN_CERT * SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS * SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE * * SEC_ERROR_BAD_SIGNATURE * SEC_ERROR_CERT_BAD_ACCESS_LOCATION * SEC_ERROR_INVALID_TIME * SEC_ERROR_REVOKED_CERTIFICATE * SEC_ERROR_UNKNOWN_ISSUER * SEC_ERROR_UNKNOWN_SIGNER * * Other errors are any of the many possible failures in cert verification * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when * verifying the signer's cert, or low-level problems (error allocating * memory, error performing ASN.1 decoding, etc.). */ extern SECStatus CERT_CheckOCSPStatus(CERTCertDBHandle *handle, CERTCertificate *cert, int64 time, void *pwArg);/************************************************************************/SEC_END_PROTOS#endif /* _OCSP_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?