| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Interface to the OCSP implementation. | 6 * Interface to the OCSP implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef _OCSP_H_ | 9 #ifndef _OCSP_H_ |
| 10 #define _OCSP_H_ | 10 #define _OCSP_H_ |
| 11 | 11 |
| 12 | |
| 13 #include "plarena.h" | 12 #include "plarena.h" |
| 14 #include "seccomon.h" | 13 #include "seccomon.h" |
| 15 #include "secoidt.h" | 14 #include "secoidt.h" |
| 16 #include "keyt.h" | 15 #include "keyt.h" |
| 17 #include "certt.h" | 16 #include "certt.h" |
| 18 #include "ocspt.h" | 17 #include "ocspt.h" |
| 19 | 18 |
| 20 | |
| 21 /************************************************************************/ | 19 /************************************************************************/ |
| 22 SEC_BEGIN_PROTOS | 20 SEC_BEGIN_PROTOS |
| 23 | 21 |
| 24 /* | 22 /* |
| 25 * This function registers the HttpClient with whose functions the | 23 * This function registers the HttpClient with whose functions the |
| 26 * HttpClientFcn structure has been populated as the default Http | 24 * HttpClientFcn structure has been populated as the default Http |
| 27 * client. | 25 * client. |
| 28 * | 26 * |
| 29 * The function table must be a global object. | 27 * The function table must be a global object. |
| 30 * The caller must ensure that NSS will be able to call | 28 * The caller must ensure that NSS will be able to call |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 * The nickname of the cert to trust (expected) to sign the OCSP responses. | 125 * The nickname of the cert to trust (expected) to sign the OCSP responses. |
| 128 * If the corresponding cert cannot be found, SECFailure is returned. | 126 * If the corresponding cert cannot be found, SECFailure is returned. |
| 129 * RETURN: | 127 * RETURN: |
| 130 * Returns SECFailure if an error occurred; SECSuccess otherwise. | 128 * Returns SECFailure if an error occurred; SECSuccess otherwise. |
| 131 * The most likely error is that the cert for "name" could not be found | 129 * The most likely error is that the cert for "name" could not be found |
| 132 * (probably SEC_ERROR_UNKNOWN_CERT). Other errors are low-level (no memory, | 130 * (probably SEC_ERROR_UNKNOWN_CERT). Other errors are low-level (no memory, |
| 133 * bad database, etc.). | 131 * bad database, etc.). |
| 134 */ | 132 */ |
| 135 extern SECStatus | 133 extern SECStatus |
| 136 CERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle, | 134 CERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle, |
| 137 » » » const char *url, const char *name); | 135 const char *url, const char *name); |
| 138 | 136 |
| 139 /* | 137 /* |
| 140 * FUNCTION: CERT_EnableOCSPDefaultResponder | 138 * FUNCTION: CERT_EnableOCSPDefaultResponder |
| 141 * Turns on use of a default responder when OCSP checking. | 139 * Turns on use of a default responder when OCSP checking. |
| 142 * If OCSP checking is already enabled, this will make subsequent checks | 140 * If OCSP checking is already enabled, this will make subsequent checks |
| 143 * go directly to the default responder. (The location of the responder | 141 * go directly to the default responder. (The location of the responder |
| 144 * and the nickname of the responder cert must already be specified.) | 142 * and the nickname of the responder cert must already be specified.) |
| 145 * If OCSP checking is not enabled, this will be recorded and take effect | 143 * If OCSP checking is not enabled, this will be recorded and take effect |
| 146 * whenever it is enabled. | 144 * whenever it is enabled. |
| 147 * INPUTS: | 145 * INPUTS: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 167 * RETURN: | 165 * RETURN: |
| 168 * Returns SECFailure if an error occurred; SECSuccess otherwise. | 166 * Returns SECFailure if an error occurred; SECSuccess otherwise. |
| 169 * Errors very unlikely (like random memory corruption...). | 167 * Errors very unlikely (like random memory corruption...). |
| 170 */ | 168 */ |
| 171 extern SECStatus | 169 extern SECStatus |
| 172 CERT_DisableOCSPDefaultResponder(CERTCertDBHandle *handle); | 170 CERT_DisableOCSPDefaultResponder(CERTCertDBHandle *handle); |
| 173 | 171 |
| 174 /* If forcePost is set, OCSP requests will only be sent using the HTTP POST | 172 /* If forcePost is set, OCSP requests will only be sent using the HTTP POST |
| 175 * method. When forcePost is not set, OCSP requests will be sent using the | 173 * method. When forcePost is not set, OCSP requests will be sent using the |
| 176 * HTTP GET method, with a fallback to POST when we fail to receive a response | 174 * HTTP GET method, with a fallback to POST when we fail to receive a response |
| 177 * and/or when we receive an uncacheable response like "Unknown." | 175 * and/or when we receive an uncacheable response like "Unknown." |
| 178 * | 176 * |
| 179 * The default is to use GET and fallback to POST. | 177 * The default is to use GET and fallback to POST. |
| 180 */ | 178 */ |
| 181 extern SECStatus CERT_ForcePostMethodForOCSP(PRBool forcePost); | 179 extern SECStatus CERT_ForcePostMethodForOCSP(PRBool forcePost); |
| 182 | 180 |
| 183 /* | 181 /* |
| 184 * ------------------------------------------------------- | 182 * ------------------------------------------------------- |
| 185 * The Functions above are those expected to be used by a client | 183 * The Functions above are those expected to be used by a client |
| 186 * providing OCSP status checking along with every cert verification. | 184 * providing OCSP status checking along with every cert verification. |
| 187 * The functions below are for OCSP testing, debugging, or clients | 185 * The functions below are for OCSP testing, debugging, or clients |
| 188 * or servers performing more specialized OCSP tasks. | 186 * or servers performing more specialized OCSP tasks. |
| 189 * ------------------------------------------------------- | 187 * ------------------------------------------------------- |
| 190 */ | 188 */ |
| 191 | 189 |
| 192 /* | 190 /* |
| 193 * FUNCTION: CERT_CreateOCSPRequest | 191 * FUNCTION: CERT_CreateOCSPRequest |
| 194 * Creates a CERTOCSPRequest, requesting the status of the certs in | 192 * Creates a CERTOCSPRequest, requesting the status of the certs in |
| 195 * the given list. | 193 * the given list. |
| 196 * INPUTS: | 194 * INPUTS: |
| 197 * CERTCertList *certList | 195 * CERTCertList *certList |
| 198 * A list of certs for which status will be requested. | 196 * A list of certs for which status will be requested. |
| 199 * Note that all of these certificates should have the same issuer, | 197 * Note that all of these certificates should have the same issuer, |
| 200 * or it's expected the response will be signed by a trusted responder. | 198 * or it's expected the response will be signed by a trusted responder. |
| 201 * If the certs need to be broken up into multiple requests, that | 199 * If the certs need to be broken up into multiple requests, that |
| 202 * must be handled by the caller (and thus by having multiple calls | 200 * must be handled by the caller (and thus by having multiple calls |
| 203 * to this routine), who knows about where the request(s) are being | 201 * to this routine), who knows about where the request(s) are being |
| 204 * sent and whether there are any trusted responders in place. | 202 * sent and whether there are any trusted responders in place. |
| 205 * PRTime time | 203 * PRTime time |
| 206 * Indicates the time for which the certificate status is to be | 204 * Indicates the time for which the certificate status is to be |
| 207 * determined -- this may be used in the search for the cert's issuer | 205 * determined -- this may be used in the search for the cert's issuer |
| 208 * but has no effect on the request itself. | 206 * but has no effect on the request itself. |
| 209 * PRBool addServiceLocator | 207 * PRBool addServiceLocator |
| 210 * If true, the Service Locator extension should be added to the | 208 * If true, the Service Locator extension should be added to the |
| 211 * single request(s) for each cert. | 209 * single request(s) for each cert. |
| 212 * CERTCertificate *signerCert | 210 * CERTCertificate *signerCert |
| 213 * If non-NULL, means sign the request using this cert. Otherwise, | 211 * If non-NULL, means sign the request using this cert. Otherwise, |
| 214 * do not sign. | 212 * do not sign. |
| 215 * XXX note that request signing is not yet supported; see comment in code | 213 * XXX note that request signing is not yet supported; see comment in code |
| 216 * RETURN: | 214 * RETURN: |
| 217 * A pointer to a CERTOCSPRequest structure containing an OCSP request | 215 * A pointer to a CERTOCSPRequest structure containing an OCSP request |
| 218 * for the cert list. On error, null is returned, with an error set | 216 * for the cert list. On error, null is returned, with an error set |
| 219 * indicating the reason. This is likely SEC_ERROR_UNKNOWN_ISSUER. | 217 * indicating the reason. This is likely SEC_ERROR_UNKNOWN_ISSUER. |
| 220 * (The issuer is needed to create a request for the certificate.) | 218 * (The issuer is needed to create a request for the certificate.) |
| 221 * Other errors are low-level problems (no memory, bad database, etc.). | 219 * Other errors are low-level problems (no memory, bad database, etc.). |
| 222 */ | 220 */ |
| 223 extern CERTOCSPRequest * | 221 extern CERTOCSPRequest * |
| 224 CERT_CreateOCSPRequest(CERTCertList *certList, PRTime time, | 222 CERT_CreateOCSPRequest(CERTCertList *certList, PRTime time, |
| 225 » » PRBool addServiceLocator, | 223 PRBool addServiceLocator, |
| 226 » » CERTCertificate *signerCert); | 224 CERTCertificate *signerCert); |
| 227 | 225 |
| 228 /* | 226 /* |
| 229 * FUNCTION: CERT_AddOCSPAcceptableResponses | 227 * FUNCTION: CERT_AddOCSPAcceptableResponses |
| 230 * Add the AcceptableResponses extension to an OCSP Request. | 228 * Add the AcceptableResponses extension to an OCSP Request. |
| 231 * INPUTS: | 229 * INPUTS: |
| 232 * CERTOCSPRequest *request | 230 * CERTOCSPRequest *request |
| 233 * The request to which the extension should be added. | 231 * The request to which the extension should be added. |
| 234 * SECOidTag responseType0, ... | 232 * SECOidTag responseType0, ... |
| 235 * A list (of one or more) of SECOidTag -- each of the response types | 233 * A list (of one or more) of SECOidTag -- each of the response types |
| 236 * to be added. The last OID *must* be SEC_OID_PKIX_OCSP_BASIC_RESPONSE. | 234 * to be added. The last OID *must* be SEC_OID_PKIX_OCSP_BASIC_RESPONSE. |
| 237 * (This marks the end of the list, and it must be specified because a | 235 * (This marks the end of the list, and it must be specified because a |
| 238 * client conforming to the OCSP standard is required to handle the basic | 236 * client conforming to the OCSP standard is required to handle the basic |
| 239 * response type.) The OIDs are not checked in any way. | 237 * response type.) The OIDs are not checked in any way. |
| 240 * RETURN: | 238 * RETURN: |
| 241 * SECSuccess if the extension is added; SECFailure if anything goes wrong. | 239 * SECSuccess if the extension is added; SECFailure if anything goes wrong. |
| 242 * All errors are internal or low-level problems (e.g. no memory). | 240 * All errors are internal or low-level problems (e.g. no memory). |
| 243 */ | 241 */ |
| 244 extern SECStatus | 242 extern SECStatus |
| 245 CERT_AddOCSPAcceptableResponses(CERTOCSPRequest *request, | 243 CERT_AddOCSPAcceptableResponses(CERTOCSPRequest *request, |
| 246 » » » » SECOidTag responseType0, ...); | 244 SECOidTag responseType0, ...); |
| 247 | 245 |
| 248 /* | 246 /* |
| 249 * FUNCTION: CERT_EncodeOCSPRequest | 247 * FUNCTION: CERT_EncodeOCSPRequest |
| 250 * DER encodes an OCSP Request, possibly adding a signature as well. | 248 * DER encodes an OCSP Request, possibly adding a signature as well. |
| 251 * XXX Signing is not yet supported, however; see comments in code. | 249 * XXX Signing is not yet supported, however; see comments in code. |
| 252 * INPUTS: | 250 * INPUTS: |
| 253 * PLArenaPool *arena | 251 * PLArenaPool *arena |
| 254 * The return value is allocated from here. | 252 * The return value is allocated from here. |
| 255 * If a NULL is passed in, allocation is done from the heap instead. | 253 * If a NULL is passed in, allocation is done from the heap instead. |
| 256 * CERTOCSPRequest *request | 254 * CERTOCSPRequest *request |
| 257 * The request to be encoded. | 255 * The request to be encoded. |
| 258 * void *pwArg | 256 * void *pwArg |
| 259 * Pointer to argument for password prompting, if needed. (Definitely | 257 * Pointer to argument for password prompting, if needed. (Definitely |
| 260 * not needed if not signing.) | 258 * not needed if not signing.) |
| 261 * RETURN: | 259 * RETURN: |
| 262 * Returns a NULL on error and a pointer to the SECItem with the | 260 * Returns a NULL on error and a pointer to the SECItem with the |
| 263 * encoded value otherwise. Any error is likely to be low-level | 261 * encoded value otherwise. Any error is likely to be low-level |
| 264 * (e.g. no memory). | 262 * (e.g. no memory). |
| 265 */ | 263 */ |
| 266 extern SECItem * | 264 extern SECItem * |
| 267 CERT_EncodeOCSPRequest(PLArenaPool *arena, CERTOCSPRequest *request, | 265 CERT_EncodeOCSPRequest(PLArenaPool *arena, CERTOCSPRequest *request, |
| 268 » » void *pwArg); | 266 void *pwArg); |
| 269 | 267 |
| 270 /* | 268 /* |
| 271 * FUNCTION: CERT_DecodeOCSPRequest | 269 * FUNCTION: CERT_DecodeOCSPRequest |
| 272 * Decode a DER encoded OCSP Request. | 270 * Decode a DER encoded OCSP Request. |
| 273 * INPUTS: | 271 * INPUTS: |
| 274 * SECItem *src | 272 * SECItem *src |
| 275 * Pointer to a SECItem holding DER encoded OCSP Request. | 273 * Pointer to a SECItem holding DER encoded OCSP Request. |
| 276 * RETURN: | 274 * RETURN: |
| 277 * Returns a pointer to a CERTOCSPRequest containing the decoded request. | 275 * Returns a pointer to a CERTOCSPRequest containing the decoded request. |
| 278 * On error, returns NULL. Most likely error is trouble decoding | 276 * On error, returns NULL. Most likely error is trouble decoding |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 * A list of certs for which status will be requested. | 332 * A list of certs for which status will be requested. |
| 335 * Note that all of these certificates should have the same issuer, | 333 * Note that all of these certificates should have the same issuer, |
| 336 * or it's expected the response will be signed by a trusted responder. | 334 * or it's expected the response will be signed by a trusted responder. |
| 337 * If the certs need to be broken up into multiple requests, that | 335 * If the certs need to be broken up into multiple requests, that |
| 338 * must be handled by the caller (and thus by having multiple calls | 336 * must be handled by the caller (and thus by having multiple calls |
| 339 * to this routine), who knows about where the request(s) are being | 337 * to this routine), who knows about where the request(s) are being |
| 340 * sent and whether there are any trusted responders in place. | 338 * sent and whether there are any trusted responders in place. |
| 341 * const char *location | 339 * const char *location |
| 342 * The location of the OCSP responder (a URL). | 340 * The location of the OCSP responder (a URL). |
| 343 * PRTime time | 341 * PRTime time |
| 344 * Indicates the time for which the certificate status is to be | 342 * Indicates the time for which the certificate status is to be |
| 345 * determined -- this may be used in the search for the cert's issuer | 343 * determined -- this may be used in the search for the cert's issuer |
| 346 * but has no other bearing on the operation. | 344 * but has no other bearing on the operation. |
| 347 * PRBool addServiceLocator | 345 * PRBool addServiceLocator |
| 348 * If true, the Service Locator extension should be added to the | 346 * If true, the Service Locator extension should be added to the |
| 349 * single request(s) for each cert. | 347 * single request(s) for each cert. |
| 350 * CERTCertificate *signerCert | 348 * CERTCertificate *signerCert |
| 351 * If non-NULL, means sign the request using this cert. Otherwise, | 349 * If non-NULL, means sign the request using this cert. Otherwise, |
| 352 * do not sign. | 350 * do not sign. |
| 353 * void *pwArg | 351 * void *pwArg |
| 354 * Pointer to argument for password prompting, if needed. (Definitely | 352 * Pointer to argument for password prompting, if needed. (Definitely |
| 355 * not needed if not signing.) | 353 * not needed if not signing.) |
| 356 * OUTPUTS: | 354 * OUTPUTS: |
| 357 * CERTOCSPRequest **pRequest | 355 * CERTOCSPRequest **pRequest |
| 358 * Pointer in which to store the OCSP request created for the given | 356 * Pointer in which to store the OCSP request created for the given |
| 359 * list of certificates. It is only filled in if the entire operation | 357 * list of certificates. It is only filled in if the entire operation |
| 360 * is successful and the pointer is not null -- and in that case the | 358 * is successful and the pointer is not null -- and in that case the |
| 361 * caller is then reponsible for destroying it. | 359 * caller is then reponsible for destroying it. |
| 362 * RETURN: | 360 * RETURN: |
| 363 * Returns a pointer to the SECItem holding the response. | 361 * Returns a pointer to the SECItem holding the response. |
| 364 * On error, returns null with error set describing the reason: | 362 * On error, returns null with error set describing the reason: |
| 365 * SEC_ERROR_UNKNOWN_ISSUER | 363 * SEC_ERROR_UNKNOWN_ISSUER |
| 366 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION | 364 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION |
| 367 * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE | 365 * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE |
| 368 * Other errors are low-level problems (no memory, bad database, etc.). | 366 * Other errors are low-level problems (no memory, bad database, etc.). |
| 369 */ | 367 */ |
| 370 extern SECItem * | 368 extern SECItem * |
| 371 CERT_GetEncodedOCSPResponse(PLArenaPool *arena, CERTCertList *certList, | 369 CERT_GetEncodedOCSPResponse(PLArenaPool *arena, CERTCertList *certList, |
| 372 » » » const char *location, PRTime time, | 370 const char *location, PRTime time, |
| 373 » » » PRBool addServiceLocator, | 371 PRBool addServiceLocator, |
| 374 » » » CERTCertificate *signerCert, void *pwArg, | 372 CERTCertificate *signerCert, void *pwArg, |
| 375 » » » CERTOCSPRequest **pRequest); | 373 CERTOCSPRequest **pRequest); |
| 376 | 374 |
| 377 /* | 375 /* |
| 378 * FUNCTION: CERT_VerifyOCSPResponseSignature | 376 * FUNCTION: CERT_VerifyOCSPResponseSignature |
| 379 * Check the signature on an OCSP Response. Will also perform a | 377 * Check the signature on an OCSP Response. Will also perform a |
| 380 * verification of the signer's certificate. Note, however, that a | 378 * verification of the signer's certificate. Note, however, that a |
| 381 * successful verification does not make any statement about the | 379 * successful verification does not make any statement about the |
| 382 * signer's *authority* to provide status for the certificate(s), | 380 * signer's *authority* to provide status for the certificate(s), |
| 383 * that must be checked individually for each certificate. | 381 * that must be checked individually for each certificate. |
| 384 * INPUTS: | 382 * INPUTS: |
| 385 * CERTOCSPResponse *response | 383 * CERTOCSPResponse *response |
| (...skipping 13 matching lines...) Expand all Loading... |
| 399 * Possible errors set: | 397 * Possible errors set: |
| 400 * SEC_ERROR_OCSP_MALFORMED_RESPONSE - unknown type of ResponderID | 398 * SEC_ERROR_OCSP_MALFORMED_RESPONSE - unknown type of ResponderID |
| 401 * SEC_ERROR_INVALID_TIME - bad format of "ProducedAt" time | 399 * SEC_ERROR_INVALID_TIME - bad format of "ProducedAt" time |
| 402 * SEC_ERROR_UNKNOWN_SIGNER - signer's cert could not be found | 400 * SEC_ERROR_UNKNOWN_SIGNER - signer's cert could not be found |
| 403 * SEC_ERROR_BAD_SIGNATURE - the signature did not verify | 401 * SEC_ERROR_BAD_SIGNATURE - the signature did not verify |
| 404 * Other errors are any of the many possible failures in cert verification | 402 * Other errors are any of the many possible failures in cert verification |
| 405 * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when | 403 * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when |
| 406 * verifying the signer's cert, or low-level problems (no memory, etc.) | 404 * verifying the signer's cert, or low-level problems (no memory, etc.) |
| 407 */ | 405 */ |
| 408 extern SECStatus | 406 extern SECStatus |
| 409 CERT_VerifyOCSPResponseSignature(CERTOCSPResponse *response,» | 407 CERT_VerifyOCSPResponseSignature(CERTOCSPResponse *response, |
| 410 » » » » CERTCertDBHandle *handle, void *pwArg, | 408 CERTCertDBHandle *handle, void *pwArg, |
| 411 » » » » CERTCertificate **pSignerCert, | 409 CERTCertificate **pSignerCert, |
| 412 » » » » CERTCertificate *issuerCert); | 410 CERTCertificate *issuerCert); |
| 413 | 411 |
| 414 /* | 412 /* |
| 415 * FUNCTION: CERT_GetOCSPAuthorityInfoAccessLocation | 413 * FUNCTION: CERT_GetOCSPAuthorityInfoAccessLocation |
| 416 * Get the value of the URI of the OCSP responder for the given cert. | 414 * Get the value of the URI of the OCSP responder for the given cert. |
| 417 * This is found in the (optional) Authority Information Access extension | 415 * This is found in the (optional) Authority Information Access extension |
| 418 * in the cert. | 416 * in the cert. |
| 419 * INPUTS: | 417 * INPUTS: |
| 420 * CERTCertificate *cert | 418 * CERTCertificate *cert |
| 421 * The certificate being examined. | 419 * The certificate being examined. |
| 422 * RETURN: | 420 * RETURN: |
| 423 * char * | 421 * char * |
| 424 * A copy of the URI for the OCSP method, if found. If either the | 422 * A copy of the URI for the OCSP method, if found. If either the |
| 425 * extension is not present or it does not contain an entry for OCSP, | 423 * extension is not present or it does not contain an entry for OCSP, |
| 426 * SEC_ERROR_EXTENSION_NOT_FOUND will be set and a NULL returned. | 424 * SEC_ERROR_EXTENSION_NOT_FOUND will be set and a NULL returned. |
| 427 * Any other error will also result in a NULL being returned. | 425 * Any other error will also result in a NULL being returned. |
| 428 * | 426 * |
| 429 * This result should be freed (via PORT_Free) when no longer in use. | 427 * This result should be freed (via PORT_Free) when no longer in use. |
| 430 */ | 428 */ |
| 431 extern char * | 429 extern char * |
| 432 CERT_GetOCSPAuthorityInfoAccessLocation(const CERTCertificate *cert); | 430 CERT_GetOCSPAuthorityInfoAccessLocation(const CERTCertificate *cert); |
| 433 | 431 |
| 434 /* | 432 /* |
| 435 * FUNCTION: CERT_RegisterAlternateOCSPAIAInfoCallBack | 433 * FUNCTION: CERT_RegisterAlternateOCSPAIAInfoCallBack |
| 436 * This function serves two purposes. | 434 * This function serves two purposes. |
| 437 * 1) It registers the address of a callback function that will be | 435 * 1) It registers the address of a callback function that will be |
| 438 * called for certs that have no OCSP AIA extension, to see if the | 436 * called for certs that have no OCSP AIA extension, to see if the |
| 439 * callback wishes to supply an alternative URL for such an OCSP inquiry. | 437 * callback wishes to supply an alternative URL for such an OCSP inquiry. |
| 440 * 2) It outputs the previously registered function's address to the | 438 * 2) It outputs the previously registered function's address to the |
| 441 * address supplied by the caller, unless that is NULL. | 439 * address supplied by the caller, unless that is NULL. |
| 442 * The registered callback function returns NULL, or an allocated string | 440 * The registered callback function returns NULL, or an allocated string |
| 443 * that may be subsequently freed by calling PORT_Free(). | 441 * that may be subsequently freed by calling PORT_Free(). |
| 444 * RETURN: | 442 * RETURN: |
| 445 * SECSuccess or SECFailure (if the library is not yet intialized) | 443 * SECSuccess or SECFailure (if the library is not yet intialized) |
| 446 */ | 444 */ |
| 447 extern SECStatus | 445 extern SECStatus |
| 448 CERT_RegisterAlternateOCSPAIAInfoCallBack( | 446 CERT_RegisterAlternateOCSPAIAInfoCallBack( |
| 449 » » » CERT_StringFromCertFcn newCallback, | 447 CERT_StringFromCertFcn newCallback, |
| 450 » » » CERT_StringFromCertFcn * oldCallback); | 448 CERT_StringFromCertFcn *oldCallback); |
| 451 | 449 |
| 452 /* | 450 /* |
| 453 * FUNCTION: CERT_ParseURL | 451 * FUNCTION: CERT_ParseURL |
| 454 * Parse a URI into hostname, port, and path. The scheme in the URI must | 452 * Parse a URI into hostname, port, and path. The scheme in the URI must |
| 455 * be "http". | 453 * be "http". |
| 456 * INPUTS: | 454 * INPUTS: |
| 457 * const char *url | 455 * const char *url |
| 458 * The URI to be parsed | 456 * The URI to be parsed |
| 459 * OUTPUTS: | 457 * OUTPUTS: |
| 460 * char **pHostname | 458 * char **pHostname |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION | 512 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION |
| 515 * SEC_ERROR_INVALID_TIME | 513 * SEC_ERROR_INVALID_TIME |
| 516 * SEC_ERROR_REVOKED_CERTIFICATE | 514 * SEC_ERROR_REVOKED_CERTIFICATE |
| 517 * SEC_ERROR_UNKNOWN_ISSUER | 515 * SEC_ERROR_UNKNOWN_ISSUER |
| 518 * SEC_ERROR_UNKNOWN_SIGNER | 516 * SEC_ERROR_UNKNOWN_SIGNER |
| 519 * | 517 * |
| 520 * Other errors are any of the many possible failures in cert verification | 518 * Other errors are any of the many possible failures in cert verification |
| 521 * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when | 519 * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when |
| 522 * verifying the signer's cert, or low-level problems (error allocating | 520 * verifying the signer's cert, or low-level problems (error allocating |
| 523 * memory, error performing ASN.1 decoding, etc.). | 521 * memory, error performing ASN.1 decoding, etc.). |
| 524 */ | 522 */ |
| 525 extern SECStatus | 523 extern SECStatus |
| 526 CERT_CheckOCSPStatus(CERTCertDBHandle *handle, CERTCertificate *cert, | 524 CERT_CheckOCSPStatus(CERTCertDBHandle *handle, CERTCertificate *cert, |
| 527 » » PRTime time, void *pwArg); | 525 PRTime time, void *pwArg); |
| 528 | 526 |
| 529 /* | 527 /* |
| 530 * FUNCTION: CERT_CacheOCSPResponseFromSideChannel | 528 * FUNCTION: CERT_CacheOCSPResponseFromSideChannel |
| 531 * First, this function checks the OCSP cache to see if a good response | 529 * First, this function checks the OCSP cache to see if a good response |
| 532 * for the given certificate already exists. If it does, then the function | 530 * for the given certificate already exists. If it does, then the function |
| 533 * returns successfully. | 531 * returns successfully. |
| 534 * | 532 * |
| 535 * If not, then it validates that the given OCSP response is a valid, | 533 * If not, then it validates that the given OCSP response is a valid, |
| 536 * good response for the given certificate and inserts it into the | 534 * good response for the given certificate and inserts it into the |
| 537 * cache. | 535 * cache. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 549 * SECItem *encodedResponse | 547 * SECItem *encodedResponse |
| 550 * the DER encoded bytes of the OCSP response | 548 * the DER encoded bytes of the OCSP response |
| 551 * void *pwArg | 549 * void *pwArg |
| 552 * argument for password prompting, if needed | 550 * argument for password prompting, if needed |
| 553 * RETURN: | 551 * RETURN: |
| 554 * SECSuccess if the cert was found in the cache, or if the OCSP response was | 552 * SECSuccess if the cert was found in the cache, or if the OCSP response was |
| 555 * found to be valid and inserted into the cache. SECFailure otherwise. | 553 * found to be valid and inserted into the cache. SECFailure otherwise. |
| 556 */ | 554 */ |
| 557 extern SECStatus | 555 extern SECStatus |
| 558 CERT_CacheOCSPResponseFromSideChannel(CERTCertDBHandle *handle, | 556 CERT_CacheOCSPResponseFromSideChannel(CERTCertDBHandle *handle, |
| 559 » » » » CERTCertificate *cert, | 557 CERTCertificate *cert, |
| 560 » » » » PRTime time, | 558 PRTime time, |
| 561 » » » » const SECItem *encodedResponse, | 559 const SECItem *encodedResponse, |
| 562 » » » » void *pwArg); | 560 void *pwArg); |
| 563 | 561 |
| 564 /* | 562 /* |
| 565 * FUNCTION: CERT_GetOCSPStatusForCertID | 563 * FUNCTION: CERT_GetOCSPStatusForCertID |
| 566 * Returns the OCSP status contained in the passed in parameter response | 564 * Returns the OCSP status contained in the passed in parameter response |
| 567 * that corresponds to the certID passed in. | 565 * that corresponds to the certID passed in. |
| 568 * INPUTS: | 566 * INPUTS: |
| 569 * CERTCertDBHandle *handle | 567 * CERTCertDBHandle *handle |
| 570 * certificate DB of the cert that is being checked | 568 * certificate DB of the cert that is being checked |
| 571 * CERTOCSPResponse *response | 569 * CERTOCSPResponse *response |
| 572 * the OCSP response we want to retrieve status from. | 570 * the OCSP response we want to retrieve status from. |
| 573 * CERTOCSPCertID *certID | 571 * CERTOCSPCertID *certID |
| 574 * the ID we want to look for from the response. | 572 * the ID we want to look for from the response. |
| 575 * CERTCertificate *signerCert | 573 * CERTCertificate *signerCert |
| 576 * the certificate that was used to sign the OCSP response. | 574 * the certificate that was used to sign the OCSP response. |
| 577 * must be obtained via a call to CERT_VerifyOCSPResponseSignature. | 575 * must be obtained via a call to CERT_VerifyOCSPResponseSignature. |
| 578 * PRTime time | 576 * PRTime time |
| 579 * The time at which we're checking the status for. | 577 * The time at which we're checking the status for. |
| 580 * RETURN: | 578 * RETURN: |
| 581 * Return values are the same as those for CERT_CheckOCSPStatus | 579 * Return values are the same as those for CERT_CheckOCSPStatus |
| 582 */ | 580 */ |
| 583 extern SECStatus | 581 extern SECStatus |
| 584 CERT_GetOCSPStatusForCertID(CERTCertDBHandle *handle, | 582 CERT_GetOCSPStatusForCertID(CERTCertDBHandle *handle, |
| 585 » » » CERTOCSPResponse *response, | 583 CERTOCSPResponse *response, |
| 586 » » » CERTOCSPCertID *certID, | 584 CERTOCSPCertID *certID, |
| 587 » » » CERTCertificate *signerCert, | 585 CERTCertificate *signerCert, |
| 588 PRTime time); | 586 PRTime time); |
| 589 | 587 |
| 590 /* | 588 /* |
| 591 * FUNCTION CERT_GetOCSPResponseStatus | 589 * FUNCTION CERT_GetOCSPResponseStatus |
| 592 * Returns the response status for the response passed. | 590 * Returns the response status for the response passed. |
| 593 * INPUTS: | 591 * INPUTS: |
| 594 * CERTOCSPResponse *response | 592 * CERTOCSPResponse *response |
| 595 * The response to query for status | 593 * The response to query for status |
| 596 * RETURN: | 594 * RETURN: |
| 597 * Returns SECSuccess if the response has a successful status value. | 595 * Returns SECSuccess if the response has a successful status value. |
| 598 * Otherwise it returns SECFailure and sets one of the following error | 596 * Otherwise it returns SECFailure and sets one of the following error |
| (...skipping 13 matching lines...) Expand all Loading... |
| 612 * Returns the OCSP certID for the certificate passed in. | 610 * Returns the OCSP certID for the certificate passed in. |
| 613 * INPUTS: | 611 * INPUTS: |
| 614 * CERTCertificate *cert | 612 * CERTCertificate *cert |
| 615 * The certificate for which to create the certID for. | 613 * The certificate for which to create the certID for. |
| 616 * PRTime time | 614 * PRTime time |
| 617 * The time at which the id is requested for. This is used | 615 * The time at which the id is requested for. This is used |
| 618 * to determine the appropriate issuer for the cert since | 616 * to determine the appropriate issuer for the cert since |
| 619 * the issuing CA may be an older expired certificate. | 617 * the issuing CA may be an older expired certificate. |
| 620 * RETURN: | 618 * RETURN: |
| 621 * A new copy of a CERTOCSPCertID*. The memory for this certID | 619 * A new copy of a CERTOCSPCertID*. The memory for this certID |
| 622 * should be freed by calling CERT_DestroyOCSPCertID when the | 620 * should be freed by calling CERT_DestroyOCSPCertID when the |
| 623 * certID is no longer necessary. | 621 * certID is no longer necessary. |
| 624 */ | 622 */ |
| 625 extern CERTOCSPCertID* | 623 extern CERTOCSPCertID * |
| 626 CERT_CreateOCSPCertID(CERTCertificate *cert, PRTime time); | 624 CERT_CreateOCSPCertID(CERTCertificate *cert, PRTime time); |
| 627 | 625 |
| 628 /* | 626 /* |
| 629 * FUNCTION: CERT_DestroyOCSPCertID | 627 * FUNCTION: CERT_DestroyOCSPCertID |
| 630 * Frees the memory associated with the certID passed in. | 628 * Frees the memory associated with the certID passed in. |
| 631 * INPUTS: | 629 * INPUTS: |
| 632 * CERTOCSPCertID* certID | 630 * CERTOCSPCertID* certID |
| 633 * The certID that the caller no longer needs and wants to | 631 * The certID that the caller no longer needs and wants to |
| 634 * free the associated memory. | 632 * free the associated memory. |
| 635 * RETURN: | 633 * RETURN: |
| 636 * SECSuccess if freeing the memory was successful. Returns | 634 * SECSuccess if freeing the memory was successful. Returns |
| 637 * SECFailure if the memory passed in was not allocated with | 635 * SECFailure if the memory passed in was not allocated with |
| 638 * a call to CERT_CreateOCSPCertID. | 636 * a call to CERT_CreateOCSPCertID. |
| 639 */ | 637 */ |
| 640 extern SECStatus | 638 extern SECStatus |
| 641 CERT_DestroyOCSPCertID(CERTOCSPCertID* certID); | 639 CERT_DestroyOCSPCertID(CERTOCSPCertID *certID); |
| 642 | 640 |
| 643 | 641 extern CERTOCSPSingleResponse * |
| 644 extern CERTOCSPSingleResponse* | |
| 645 CERT_CreateOCSPSingleResponseGood(PLArenaPool *arena, | 642 CERT_CreateOCSPSingleResponseGood(PLArenaPool *arena, |
| 646 CERTOCSPCertID *id, | 643 CERTOCSPCertID *id, |
| 647 PRTime thisUpdate, | 644 PRTime thisUpdate, |
| 648 const PRTime *nextUpdate); | 645 const PRTime *nextUpdate); |
| 649 | 646 |
| 650 extern CERTOCSPSingleResponse* | 647 extern CERTOCSPSingleResponse * |
| 651 CERT_CreateOCSPSingleResponseUnknown(PLArenaPool *arena, | 648 CERT_CreateOCSPSingleResponseUnknown(PLArenaPool *arena, |
| 652 CERTOCSPCertID *id, | 649 CERTOCSPCertID *id, |
| 653 PRTime thisUpdate, | 650 PRTime thisUpdate, |
| 654 const PRTime *nextUpdate); | 651 const PRTime *nextUpdate); |
| 655 | 652 |
| 656 extern CERTOCSPSingleResponse* | 653 extern CERTOCSPSingleResponse * |
| 657 CERT_CreateOCSPSingleResponseRevoked( | 654 CERT_CreateOCSPSingleResponseRevoked( |
| 658 PLArenaPool *arena, | 655 PLArenaPool *arena, |
| 659 CERTOCSPCertID *id, | 656 CERTOCSPCertID *id, |
| 660 PRTime thisUpdate, | 657 PRTime thisUpdate, |
| 661 const PRTime *nextUpdate, | 658 const PRTime *nextUpdate, |
| 662 PRTime revocationTime, | 659 PRTime revocationTime, |
| 663 const CERTCRLEntryReasonCode* revocationReason); | 660 const CERTCRLEntryReasonCode *revocationReason); |
| 664 | 661 |
| 665 extern SECItem* | 662 extern SECItem * |
| 666 CERT_CreateEncodedOCSPSuccessResponse( | 663 CERT_CreateEncodedOCSPSuccessResponse( |
| 667 PLArenaPool *arena, | 664 PLArenaPool *arena, |
| 668 CERTCertificate *responderCert, | 665 CERTCertificate *responderCert, |
| 669 CERTOCSPResponderIDType responderIDType, | 666 CERTOCSPResponderIDType responderIDType, |
| 670 PRTime producedAt, | 667 PRTime producedAt, |
| 671 CERTOCSPSingleResponse **responses, | 668 CERTOCSPSingleResponse **responses, |
| 672 void *wincx); | 669 void *wincx); |
| 673 | 670 |
| 674 /* | 671 /* |
| 675 * FUNCTION: CERT_CreateEncodedOCSPErrorResponse | 672 * FUNCTION: CERT_CreateEncodedOCSPErrorResponse |
| (...skipping 20 matching lines...) Expand all Loading... |
| 696 * --(4) is not used | 693 * --(4) is not used |
| 697 * sigRequired (5), --Must sign the request | 694 * sigRequired (5), --Must sign the request |
| 698 * unauthorized (6) --Request unauthorized | 695 * unauthorized (6) --Request unauthorized |
| 699 * } | 696 * } |
| 700 * RETURN: | 697 * RETURN: |
| 701 * Returns a pointer to the SECItem holding the response. | 698 * Returns a pointer to the SECItem holding the response. |
| 702 * On error, returns null with error set describing the reason: | 699 * On error, returns null with error set describing the reason: |
| 703 * SEC_ERROR_INVALID_ARGS | 700 * SEC_ERROR_INVALID_ARGS |
| 704 * Other errors are low-level problems (no memory, bad database, etc.). | 701 * Other errors are low-level problems (no memory, bad database, etc.). |
| 705 */ | 702 */ |
| 706 extern SECItem* | 703 extern SECItem * |
| 707 CERT_CreateEncodedOCSPErrorResponse(PLArenaPool *arena, int error); | 704 CERT_CreateEncodedOCSPErrorResponse(PLArenaPool *arena, int error); |
| 708 | 705 |
| 709 /* Sends an OCSP request using the HTTP POST method to the location addressed | 706 /* Sends an OCSP request using the HTTP POST method to the location addressed |
| 710 * by the URL in |location| parameter. The request body will be | 707 * by the URL in |location| parameter. The request body will be |
| 711 * |encodedRequest|, which must be a valid encoded OCSP request. On success, | 708 * |encodedRequest|, which must be a valid encoded OCSP request. On success, |
| 712 * the server's response is returned and the caller must free it using | 709 * the server's response is returned and the caller must free it using |
| 713 * SECITEM_FreeItem. On failure, NULL is returned. No parsing or validation of | 710 * SECITEM_FreeItem. On failure, NULL is returned. No parsing or validation of |
| 714 * the HTTP response is done. | 711 * the HTTP response is done. |
| 715 * | 712 * |
| 716 * If a default HTTP client has been registered with | 713 * If a default HTTP client has been registered with |
| 717 * SEC_RegisterDefaultHttpClient then that client is used. Otherwise, an | 714 * SEC_RegisterDefaultHttpClient then that client is used. Otherwise, an |
| 718 * internal HTTP client is used. | 715 * internal HTTP client is used. |
| 719 */ | 716 */ |
| 720 SECItem* CERT_PostOCSPRequest(PLArenaPool *arena, const char *location, | 717 SECItem *CERT_PostOCSPRequest(PLArenaPool *arena, const char *location, |
| 721 const SECItem *encodedRequest); | 718 const SECItem *encodedRequest); |
| 722 | 719 |
| 723 /************************************************************************/ | 720 /************************************************************************/ |
| 724 SEC_END_PROTOS | 721 SEC_END_PROTOS |
| 725 | 722 |
| 726 #endif /* _OCSP_H_ */ | 723 #endif /* _OCSP_H_ */ |
| OLD | NEW |