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 * $Id: ocsp.h,v 1.21 2012/05/31 22:03:36 emaldona%redhat.com Exp $ | 8 * $Id: ocsp.h,v 1.22 2012/09/22 13:41:58 wtc%google.com Exp $ |
9 */ | 9 */ |
10 | 10 |
11 #ifndef _OCSP_H_ | 11 #ifndef _OCSP_H_ |
12 #define _OCSP_H_ | 12 #define _OCSP_H_ |
13 | 13 |
14 | 14 |
15 #include "plarena.h" | 15 #include "plarena.h" |
16 #include "seccomon.h" | 16 #include "seccomon.h" |
17 #include "secoidt.h" | 17 #include "secoidt.h" |
18 #include "keyt.h" | 18 #include "keyt.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 * FUNCTION: CERT_SetOCSPDefaultResponder | 114 * FUNCTION: CERT_SetOCSPDefaultResponder |
115 * Specify the location and cert of the default responder. | 115 * Specify the location and cert of the default responder. |
116 * If OCSP checking is already enabled *and* use of a default responder | 116 * If OCSP checking is already enabled *and* use of a default responder |
117 * is also already enabled, all OCSP checking from now on will go directly | 117 * is also already enabled, all OCSP checking from now on will go directly |
118 * to the specified responder. If OCSP checking is not enabled, or if | 118 * to the specified responder. If OCSP checking is not enabled, or if |
119 * it is but use of a default responder is not enabled, the information | 119 * it is but use of a default responder is not enabled, the information |
120 * will be recorded and take effect whenever both are enabled. | 120 * will be recorded and take effect whenever both are enabled. |
121 * INPUTS: | 121 * INPUTS: |
122 * CERTCertDBHandle *handle | 122 * CERTCertDBHandle *handle |
123 * Cert database on which OCSP checking should use the default responder. | 123 * Cert database on which OCSP checking should use the default responder. |
124 * char *url | 124 * const char *url |
125 * The location of the default responder (e.g. "http://foo.com:80/ocsp") | 125 * The location of the default responder (e.g. "http://foo.com:80/ocsp") |
126 * Note that the location will not be tested until the first attempt | 126 * Note that the location will not be tested until the first attempt |
127 * to send a request there. | 127 * to send a request there. |
128 * char *name | 128 * const char *name |
129 * The nickname of the cert to trust (expected) to sign the OCSP responses. | 129 * The nickname of the cert to trust (expected) to sign the OCSP responses. |
130 * If the corresponding cert cannot be found, SECFailure is returned. | 130 * If the corresponding cert cannot be found, SECFailure is returned. |
131 * RETURN: | 131 * RETURN: |
132 * Returns SECFailure if an error occurred; SECSuccess otherwise. | 132 * Returns SECFailure if an error occurred; SECSuccess otherwise. |
133 * The most likely error is that the cert for "name" could not be found | 133 * The most likely error is that the cert for "name" could not be found |
134 * (probably SEC_ERROR_UNKNOWN_CERT). Other errors are low-level (no memory, | 134 * (probably SEC_ERROR_UNKNOWN_CERT). Other errors are low-level (no memory, |
135 * bad database, etc.). | 135 * bad database, etc.). |
136 */ | 136 */ |
137 extern SECStatus | 137 extern SECStatus |
138 CERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle, | 138 CERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 * Decode a DER encoded OCSP Request. | 265 * Decode a DER encoded OCSP Request. |
266 * INPUTS: | 266 * INPUTS: |
267 * SECItem *src | 267 * SECItem *src |
268 * Pointer to a SECItem holding DER encoded OCSP Request. | 268 * Pointer to a SECItem holding DER encoded OCSP Request. |
269 * RETURN: | 269 * RETURN: |
270 * Returns a pointer to a CERTOCSPRequest containing the decoded request. | 270 * Returns a pointer to a CERTOCSPRequest containing the decoded request. |
271 * On error, returns NULL. Most likely error is trouble decoding | 271 * On error, returns NULL. Most likely error is trouble decoding |
272 * (SEC_ERROR_OCSP_MALFORMED_REQUEST), or low-level problem (no memory). | 272 * (SEC_ERROR_OCSP_MALFORMED_REQUEST), or low-level problem (no memory). |
273 */ | 273 */ |
274 extern CERTOCSPRequest * | 274 extern CERTOCSPRequest * |
275 CERT_DecodeOCSPRequest(SECItem *src); | 275 CERT_DecodeOCSPRequest(const SECItem *src); |
276 | 276 |
277 /* | 277 /* |
278 * FUNCTION: CERT_DestroyOCSPRequest | 278 * FUNCTION: CERT_DestroyOCSPRequest |
279 * Frees an OCSP Request structure. | 279 * Frees an OCSP Request structure. |
280 * INPUTS: | 280 * INPUTS: |
281 * CERTOCSPRequest *request | 281 * CERTOCSPRequest *request |
282 * Pointer to CERTOCSPRequest to be freed. | 282 * Pointer to CERTOCSPRequest to be freed. |
283 * RETURN: | 283 * RETURN: |
284 * No return value; no errors. | 284 * No return value; no errors. |
285 */ | 285 */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 * If NULL, result will be allocated from the heap (and thus should | 324 * If NULL, result will be allocated from the heap (and thus should |
325 * be freed via SECITEM_FreeItem). | 325 * be freed via SECITEM_FreeItem). |
326 * CERTCertList *certList | 326 * CERTCertList *certList |
327 * A list of certs for which status will be requested. | 327 * A list of certs for which status will be requested. |
328 * Note that all of these certificates should have the same issuer, | 328 * Note that all of these certificates should have the same issuer, |
329 * or it's expected the response will be signed by a trusted responder. | 329 * or it's expected the response will be signed by a trusted responder. |
330 * If the certs need to be broken up into multiple requests, that | 330 * If the certs need to be broken up into multiple requests, that |
331 * must be handled by the caller (and thus by having multiple calls | 331 * must be handled by the caller (and thus by having multiple calls |
332 * to this routine), who knows about where the request(s) are being | 332 * to this routine), who knows about where the request(s) are being |
333 * sent and whether there are any trusted responders in place. | 333 * sent and whether there are any trusted responders in place. |
334 * char *location | 334 * const char *location |
335 * The location of the OCSP responder (a URL). | 335 * The location of the OCSP responder (a URL). |
336 * PRTime time | 336 * PRTime time |
337 * Indicates the time for which the certificate status is to be | 337 * Indicates the time for which the certificate status is to be |
338 * determined -- this may be used in the search for the cert's issuer | 338 * determined -- this may be used in the search for the cert's issuer |
339 * but has no other bearing on the operation. | 339 * but has no other bearing on the operation. |
340 * PRBool addServiceLocator | 340 * PRBool addServiceLocator |
341 * If true, the Service Locator extension should be added to the | 341 * If true, the Service Locator extension should be added to the |
342 * single request(s) for each cert. | 342 * single request(s) for each cert. |
343 * CERTCertificate *signerCert | 343 * CERTCertificate *signerCert |
344 * If non-NULL, means sign the request using this cert. Otherwise, | 344 * If non-NULL, means sign the request using this cert. Otherwise, |
(...skipping 10 matching lines...) Expand all Loading... |
355 * RETURN: | 355 * RETURN: |
356 * Returns a pointer to the SECItem holding the response. | 356 * Returns a pointer to the SECItem holding the response. |
357 * On error, returns null with error set describing the reason: | 357 * On error, returns null with error set describing the reason: |
358 * SEC_ERROR_UNKNOWN_ISSUER | 358 * SEC_ERROR_UNKNOWN_ISSUER |
359 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION | 359 * SEC_ERROR_CERT_BAD_ACCESS_LOCATION |
360 * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE | 360 * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE |
361 * Other errors are low-level problems (no memory, bad database, etc.). | 361 * Other errors are low-level problems (no memory, bad database, etc.). |
362 */ | 362 */ |
363 extern SECItem * | 363 extern SECItem * |
364 CERT_GetEncodedOCSPResponse(PLArenaPool *arena, CERTCertList *certList, | 364 CERT_GetEncodedOCSPResponse(PLArenaPool *arena, CERTCertList *certList, |
365 » » » char *location, PRTime time, | 365 » » » const char *location, PRTime time, |
366 PRBool addServiceLocator, | 366 PRBool addServiceLocator, |
367 CERTCertificate *signerCert, void *pwArg, | 367 CERTCertificate *signerCert, void *pwArg, |
368 CERTOCSPRequest **pRequest); | 368 CERTOCSPRequest **pRequest); |
369 | 369 |
370 /* | 370 /* |
371 * FUNCTION: CERT_VerifyOCSPResponseSignature | 371 * FUNCTION: CERT_VerifyOCSPResponseSignature |
372 * Check the signature on an OCSP Response. Will also perform a | 372 * Check the signature on an OCSP Response. Will also perform a |
373 * verification of the signer's certificate. Note, however, that a | 373 * verification of the signer's certificate. Note, however, that a |
374 * successful verification does not make any statement about the | 374 * successful verification does not make any statement about the |
375 * signer's *authority* to provide status for the certificate(s), | 375 * signer's *authority* to provide status for the certificate(s), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 CERT_StringFromCertFcn * oldCallback); | 443 CERT_StringFromCertFcn * oldCallback); |
444 | 444 |
445 /* | 445 /* |
446 * FUNCTION: CERT_ParseURL | 446 * FUNCTION: CERT_ParseURL |
447 * Parse a URI into hostname, port, and path. The scheme in the URI must | 447 * Parse a URI into hostname, port, and path. The scheme in the URI must |
448 * be "http". | 448 * be "http". |
449 * INPUTS: | 449 * INPUTS: |
450 * const char *url | 450 * const char *url |
451 * The URI to be parsed | 451 * The URI to be parsed |
452 * OUTPUTS: | 452 * OUTPUTS: |
453 * char *pHostname | 453 * char **pHostname |
454 * Pointer to store the hostname obtained from the URI. | 454 * Pointer to store the hostname obtained from the URI. |
455 * This result should be freed (via PORT_Free) when no longer in use. | 455 * This result should be freed (via PORT_Free) when no longer in use. |
456 * PRUint16 *pPort | 456 * PRUint16 *pPort |
457 * Pointer to store the port number obtained from the URI. | 457 * Pointer to store the port number obtained from the URI. |
458 * char *pPath | 458 * char **pPath |
459 * Pointer to store the path obtained from the URI. | 459 * Pointer to store the path obtained from the URI. |
460 * This result should be freed (via PORT_Free) when no longer in use. | 460 * This result should be freed (via PORT_Free) when no longer in use. |
461 * RETURN: | 461 * RETURN: |
462 * Returns SECSuccess when parsing was successful. Returns SECFailure when | 462 * Returns SECSuccess when parsing was successful. Returns SECFailure when |
463 * problems were encountered. | 463 * problems were encountered. |
464 */ | 464 */ |
465 extern SECStatus | 465 extern SECStatus |
466 CERT_ParseURL(const char *url, char **pHostname, PRUint16 *pPort, char **pPath); | 466 CERT_ParseURL(const char *url, char **pHostname, PRUint16 *pPort, char **pPath); |
467 | 467 |
468 /* | 468 /* |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 * SECSuccess if freeing the memory was successful. Returns | 629 * SECSuccess if freeing the memory was successful. Returns |
630 * SECFailure if the memory passed in was not allocated with | 630 * SECFailure if the memory passed in was not allocated with |
631 * a call to CERT_CreateOCSPCertID. | 631 * a call to CERT_CreateOCSPCertID. |
632 */ | 632 */ |
633 extern SECStatus | 633 extern SECStatus |
634 CERT_DestroyOCSPCertID(CERTOCSPCertID* certID); | 634 CERT_DestroyOCSPCertID(CERTOCSPCertID* certID); |
635 /************************************************************************/ | 635 /************************************************************************/ |
636 SEC_END_PROTOS | 636 SEC_END_PROTOS |
637 | 637 |
638 #endif /* _OCSP_H_ */ | 638 #endif /* _OCSP_H_ */ |
OLD | NEW |