PageRenderTime 58ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/ocsp.h

http://firefox-mac-pdf.googlecode.com/
C Header | 610 lines | 82 code | 33 blank | 495 comment | 0 complexity | a38f5b626afd0430c2fe405718744d31 MD5 | raw file
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is the Netscape security libraries.
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Netscape Communications Corporation.
  18. * Portions created by the Initial Developer are Copyright (C) 1994-2000
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. *
  23. * Alternatively, the contents of this file may be used under the terms of
  24. * either the GNU General Public License Version 2 or later (the "GPL"), or
  25. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26. * in which case the provisions of the GPL or the LGPL are applicable instead
  27. * of those above. If you wish to allow use of your version of this file only
  28. * under the terms of either the GPL or the LGPL, and not to allow others to
  29. * use your version of this file under the terms of the MPL, indicate your
  30. * decision by deleting the provisions above and replace them with the notice
  31. * and other provisions required by the GPL or the LGPL. If you do not delete
  32. * the provisions above, a recipient may use your version of this file under
  33. * the terms of any one of the MPL, the GPL or the LGPL.
  34. *
  35. * ***** END LICENSE BLOCK ***** */
  36. /*
  37. * Interface to the OCSP implementation.
  38. *
  39. * $Id: ocsp.h,v 1.11 2007/05/25 07:28:32 alexei.volkov.bugs%sun.com Exp $
  40. */
  41. #ifndef _OCSP_H_
  42. #define _OCSP_H_
  43. #include "plarena.h"
  44. #include "seccomon.h"
  45. #include "secoidt.h"
  46. #include "keyt.h"
  47. #include "certt.h"
  48. #include "ocspt.h"
  49. /************************************************************************/
  50. SEC_BEGIN_PROTOS
  51. /*
  52. * This function registers the HttpClient with whose functions the
  53. * HttpClientFcn structure has been populated as the default Http
  54. * client.
  55. *
  56. * The function table must be a global object.
  57. * The caller must ensure that NSS will be able to call
  58. * the registered functions for the lifetime of the process.
  59. */
  60. extern SECStatus
  61. SEC_RegisterDefaultHttpClient(const SEC_HttpClientFcn *fcnTable);
  62. /*
  63. * This function obtains the HttpClient which has been registered
  64. * by an earlier call to SEC_RegisterDefaultHttpClient.
  65. */
  66. extern const SEC_HttpClientFcn *
  67. SEC_GetRegisteredHttpClient(void);
  68. /*
  69. * Sets parameters that control NSS' internal OCSP cache.
  70. * maxCacheEntries, special varlues are:
  71. * -1 disable cache
  72. * 0 unlimited cache entries
  73. * minimumSecondsToNextFetchAttempt:
  74. * whenever an OCSP request was attempted or completed over the network,
  75. * wait at least this number of seconds before trying to fetch again.
  76. * maximumSecondsToNextFetchAttempt:
  77. * this is the maximum age of a cached response we allow, until we try
  78. * to fetch an updated response, even if the OCSP responder expects
  79. * that newer information update will not be available yet.
  80. */
  81. extern SECStatus
  82. CERT_OCSPCacheSettings(PRInt32 maxCacheEntries,
  83. PRUint32 minimumSecondsToNextFetchAttempt,
  84. PRUint32 maximumSecondsToNextFetchAttempt);
  85. /*
  86. * Set the desired behaviour on OCSP failures.
  87. * See definition of ocspFailureMode for allowed choices.
  88. */
  89. extern SECStatus
  90. CERT_SetOCSPFailureMode(SEC_OcspFailureMode ocspFailureMode);
  91. /*
  92. * Removes all items currently stored in the OCSP cache.
  93. */
  94. extern SECStatus
  95. CERT_ClearOCSPCache(void);
  96. /*
  97. * FUNCTION: CERT_EnableOCSPChecking
  98. * Turns on OCSP checking for the given certificate database.
  99. * INPUTS:
  100. * CERTCertDBHandle *handle
  101. * Certificate database for which OCSP checking will be enabled.
  102. * RETURN:
  103. * Returns SECFailure if an error occurred (likely only problem
  104. * allocating memory); SECSuccess otherwise.
  105. */
  106. extern SECStatus
  107. CERT_EnableOCSPChecking(CERTCertDBHandle *handle);
  108. /*
  109. * FUNCTION: CERT_DisableOCSPChecking
  110. * Turns off OCSP checking for the given certificate database.
  111. * This routine disables OCSP checking. Though it will return
  112. * SECFailure if OCSP checking is not enabled, it is "safe" to
  113. * call it that way and just ignore the return value, if it is
  114. * easier to just call it than to "remember" whether it is enabled.
  115. * INPUTS:
  116. * CERTCertDBHandle *handle
  117. * Certificate database for which OCSP checking will be disabled.
  118. * RETURN:
  119. * Returns SECFailure if an error occurred (usually means that OCSP
  120. * checking was not enabled or status contexts were not initialized --
  121. * error set will be SEC_ERROR_OCSP_NOT_ENABLED); SECSuccess otherwise.
  122. */
  123. extern SECStatus
  124. CERT_DisableOCSPChecking(CERTCertDBHandle *handle);
  125. /*
  126. * FUNCTION: CERT_SetOCSPDefaultResponder
  127. * Specify the location and cert of the default responder.
  128. * If OCSP checking is already enabled *and* use of a default responder
  129. * is also already enabled, all OCSP checking from now on will go directly
  130. * to the specified responder. If OCSP checking is not enabled, or if
  131. * it is but use of a default responder is not enabled, the information
  132. * will be recorded and take effect whenever both are enabled.
  133. * INPUTS:
  134. * CERTCertDBHandle *handle
  135. * Cert database on which OCSP checking should use the default responder.
  136. * char *url
  137. * The location of the default responder (e.g. "http://foo.com:80/ocsp")
  138. * Note that the location will not be tested until the first attempt
  139. * to send a request there.
  140. * char *name
  141. * The nickname of the cert to trust (expected) to sign the OCSP responses.
  142. * If the corresponding cert cannot be found, SECFailure is returned.
  143. * RETURN:
  144. * Returns SECFailure if an error occurred; SECSuccess otherwise.
  145. * The most likely error is that the cert for "name" could not be found
  146. * (probably SEC_ERROR_UNKNOWN_CERT). Other errors are low-level (no memory,
  147. * bad database, etc.).
  148. */
  149. extern SECStatus
  150. CERT_SetOCSPDefaultResponder(CERTCertDBHandle *handle,
  151. const char *url, const char *name);
  152. /*
  153. * FUNCTION: CERT_EnableOCSPDefaultResponder
  154. * Turns on use of a default responder when OCSP checking.
  155. * If OCSP checking is already enabled, this will make subsequent checks
  156. * go directly to the default responder. (The location of the responder
  157. * and the nickname of the responder cert must already be specified.)
  158. * If OCSP checking is not enabled, this will be recorded and take effect
  159. * whenever it is enabled.
  160. * INPUTS:
  161. * CERTCertDBHandle *handle
  162. * Cert database on which OCSP checking should use the default responder.
  163. * RETURN:
  164. * Returns SECFailure if an error occurred; SECSuccess otherwise.
  165. * No errors are especially likely unless the caller did not previously
  166. * perform a successful call to SetOCSPDefaultResponder (in which case
  167. * the error set will be SEC_ERROR_OCSP_NO_DEFAULT_RESPONDER).
  168. */
  169. extern SECStatus
  170. CERT_EnableOCSPDefaultResponder(CERTCertDBHandle *handle);
  171. /*
  172. * FUNCTION: CERT_DisableOCSPDefaultResponder
  173. * Turns off use of a default responder when OCSP checking.
  174. * (Does nothing if use of a default responder is not enabled.)
  175. * INPUTS:
  176. * CERTCertDBHandle *handle
  177. * Cert database on which OCSP checking should stop using a default
  178. * responder.
  179. * RETURN:
  180. * Returns SECFailure if an error occurred; SECSuccess otherwise.
  181. * Errors very unlikely (like random memory corruption...).
  182. */
  183. extern SECStatus
  184. CERT_DisableOCSPDefaultResponder(CERTCertDBHandle *handle);
  185. /*
  186. * -------------------------------------------------------
  187. * The Functions above are those expected to be used by a client
  188. * providing OCSP status checking along with every cert verification.
  189. * The functions below are for OCSP testing, debugging, or clients
  190. * or servers performing more specialized OCSP tasks.
  191. * -------------------------------------------------------
  192. */
  193. /*
  194. * FUNCTION: CERT_CreateOCSPRequest
  195. * Creates a CERTOCSPRequest, requesting the status of the certs in
  196. * the given list.
  197. * INPUTS:
  198. * CERTCertList *certList
  199. * A list of certs for which status will be requested.
  200. * Note that all of these certificates should have the same issuer,
  201. * or it's expected the response will be signed by a trusted responder.
  202. * If the certs need to be broken up into multiple requests, that
  203. * must be handled by the caller (and thus by having multiple calls
  204. * to this routine), who knows about where the request(s) are being
  205. * sent and whether there are any trusted responders in place.
  206. * int64 time
  207. * Indicates the time for which the certificate status is to be
  208. * determined -- this may be used in the search for the cert's issuer
  209. * but has no effect on the request itself.
  210. * PRBool addServiceLocator
  211. * If true, the Service Locator extension should be added to the
  212. * single request(s) for each cert.
  213. * CERTCertificate *signerCert
  214. * If non-NULL, means sign the request using this cert. Otherwise,
  215. * do not sign.
  216. * XXX note that request signing is not yet supported; see comment in code
  217. * RETURN:
  218. * A pointer to a CERTOCSPRequest structure containing an OCSP request
  219. * for the cert list. On error, null is returned, with an error set
  220. * indicating the reason. This is likely SEC_ERROR_UNKNOWN_ISSUER.
  221. * (The issuer is needed to create a request for the certificate.)
  222. * Other errors are low-level problems (no memory, bad database, etc.).
  223. */
  224. extern CERTOCSPRequest *
  225. CERT_CreateOCSPRequest(CERTCertList *certList, int64 time,
  226. PRBool addServiceLocator,
  227. CERTCertificate *signerCert);
  228. /*
  229. * FUNCTION: CERT_AddOCSPAcceptableResponses
  230. * Add the AcceptableResponses extension to an OCSP Request.
  231. * INPUTS:
  232. * CERTOCSPRequest *request
  233. * The request to which the extension should be added.
  234. * SECOidTag responseType0, ...
  235. * 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.
  237. * (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
  239. * response type.) The OIDs are not checked in any way.
  240. * RETURN:
  241. * SECSuccess if the extension is added; SECFailure if anything goes wrong.
  242. * All errors are internal or low-level problems (e.g. no memory).
  243. */
  244. extern SECStatus
  245. CERT_AddOCSPAcceptableResponses(CERTOCSPRequest *request,
  246. SECOidTag responseType0, ...);
  247. /*
  248. * FUNCTION: CERT_EncodeOCSPRequest
  249. * DER encodes an OCSP Request, possibly adding a signature as well.
  250. * XXX Signing is not yet supported, however; see comments in code.
  251. * INPUTS:
  252. * PRArenaPool *arena
  253. * The return value is allocated from here.
  254. * If a NULL is passed in, allocation is done from the heap instead.
  255. * CERTOCSPRequest *request
  256. * The request to be encoded.
  257. * void *pwArg
  258. * Pointer to argument for password prompting, if needed. (Definitely
  259. * not needed if not signing.)
  260. * RETURN:
  261. * Returns a NULL on error and a pointer to the SECItem with the
  262. * encoded value otherwise. Any error is likely to be low-level
  263. * (e.g. no memory).
  264. */
  265. extern SECItem *
  266. CERT_EncodeOCSPRequest(PRArenaPool *arena, CERTOCSPRequest *request,
  267. void *pwArg);
  268. /*
  269. * FUNCTION: CERT_DecodeOCSPRequest
  270. * Decode a DER encoded OCSP Request.
  271. * INPUTS:
  272. * SECItem *src
  273. * Pointer to a SECItem holding DER encoded OCSP Request.
  274. * RETURN:
  275. * Returns a pointer to a CERTOCSPRequest containing the decoded request.
  276. * On error, returns NULL. Most likely error is trouble decoding
  277. * (SEC_ERROR_OCSP_MALFORMED_REQUEST), or low-level problem (no memory).
  278. */
  279. extern CERTOCSPRequest *
  280. CERT_DecodeOCSPRequest(SECItem *src);
  281. /*
  282. * FUNCTION: CERT_DestroyOCSPRequest
  283. * Frees an OCSP Request structure.
  284. * INPUTS:
  285. * CERTOCSPRequest *request
  286. * Pointer to CERTOCSPRequest to be freed.
  287. * RETURN:
  288. * No return value; no errors.
  289. */
  290. extern void
  291. CERT_DestroyOCSPRequest(CERTOCSPRequest *request);
  292. /*
  293. * FUNCTION: CERT_DecodeOCSPResponse
  294. * Decode a DER encoded OCSP Response.
  295. * INPUTS:
  296. * SECItem *src
  297. * Pointer to a SECItem holding DER encoded OCSP Response.
  298. * RETURN:
  299. * Returns a pointer to a CERTOCSPResponse (the decoded OCSP Response);
  300. * the caller is responsible for destroying it. Or NULL if error (either
  301. * response could not be decoded (SEC_ERROR_OCSP_MALFORMED_RESPONSE),
  302. * it was of an unexpected type (SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE),
  303. * or a low-level or internal error occurred).
  304. */
  305. extern CERTOCSPResponse *
  306. CERT_DecodeOCSPResponse(SECItem *src);
  307. /*
  308. * FUNCTION: CERT_DestroyOCSPResponse
  309. * Frees an OCSP Response structure.
  310. * INPUTS:
  311. * CERTOCSPResponse *request
  312. * Pointer to CERTOCSPResponse to be freed.
  313. * RETURN:
  314. * No return value; no errors.
  315. */
  316. extern void
  317. CERT_DestroyOCSPResponse(CERTOCSPResponse *response);
  318. /*
  319. * FUNCTION: CERT_GetEncodedOCSPResponse
  320. * Creates and sends a request to an OCSP responder, then reads and
  321. * returns the (encoded) response.
  322. * INPUTS:
  323. * PRArenaPool *arena
  324. * Pointer to arena from which return value will be allocated.
  325. * If NULL, result will be allocated from the heap (and thus should
  326. * be freed via SECITEM_FreeItem).
  327. * CERTCertList *certList
  328. * A list of certs for which status will be requested.
  329. * Note that all of these certificates should have the same issuer,
  330. * or it's expected the response will be signed by a trusted responder.
  331. * If the certs need to be broken up into multiple requests, that
  332. * must be handled by the caller (and thus by having multiple calls
  333. * to this routine), who knows about where the request(s) are being
  334. * sent and whether there are any trusted responders in place.
  335. * char *location
  336. * The location of the OCSP responder (a URL).
  337. * int64 time
  338. * Indicates the time for which the certificate status is to be
  339. * determined -- this may be used in the search for the cert's issuer
  340. * but has no other bearing on the operation.
  341. * PRBool addServiceLocator
  342. * If true, the Service Locator extension should be added to the
  343. * single request(s) for each cert.
  344. * CERTCertificate *signerCert
  345. * If non-NULL, means sign the request using this cert. Otherwise,
  346. * do not sign.
  347. * void *pwArg
  348. * Pointer to argument for password prompting, if needed. (Definitely
  349. * not needed if not signing.)
  350. * OUTPUTS:
  351. * CERTOCSPRequest **pRequest
  352. * Pointer in which to store the OCSP request created for the given
  353. * list of certificates. It is only filled in if the entire operation
  354. * is successful and the pointer is not null -- and in that case the
  355. * caller is then reponsible for destroying it.
  356. * RETURN:
  357. * Returns a pointer to the SECItem holding the response.
  358. * On error, returns null with error set describing the reason:
  359. * SEC_ERROR_UNKNOWN_ISSUER
  360. * SEC_ERROR_CERT_BAD_ACCESS_LOCATION
  361. * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE
  362. * Other errors are low-level problems (no memory, bad database, etc.).
  363. */
  364. extern SECItem *
  365. CERT_GetEncodedOCSPResponse(PRArenaPool *arena, CERTCertList *certList,
  366. char *location, int64 time,
  367. PRBool addServiceLocator,
  368. CERTCertificate *signerCert, void *pwArg,
  369. CERTOCSPRequest **pRequest);
  370. /*
  371. * FUNCTION: CERT_VerifyOCSPResponseSignature
  372. * Check the signature on an OCSP Response. Will also perform a
  373. * verification of the signer's certificate. Note, however, that a
  374. * successful verification does not make any statement about the
  375. * signer's *authority* to provide status for the certificate(s),
  376. * that must be checked individually for each certificate.
  377. * INPUTS:
  378. * CERTOCSPResponse *response
  379. * Pointer to response structure with signature to be checked.
  380. * CERTCertDBHandle *handle
  381. * Pointer to CERTCertDBHandle for certificate DB to use for verification.
  382. * void *pwArg
  383. * Pointer to argument for password prompting, if needed.
  384. * CERTCertificate *issuerCert
  385. * Issuer of the certificate that generated the OCSP request.
  386. * OUTPUTS:
  387. * CERTCertificate **pSignerCert
  388. * Pointer in which to store signer's certificate; only filled-in if
  389. * non-null.
  390. * RETURN:
  391. * Returns SECSuccess when signature is valid, anything else means invalid.
  392. * Possible errors set:
  393. * SEC_ERROR_OCSP_MALFORMED_RESPONSE - unknown type of ResponderID
  394. * SEC_ERROR_INVALID_TIME - bad format of "ProducedAt" time
  395. * SEC_ERROR_UNKNOWN_SIGNER - signer's cert could not be found
  396. * SEC_ERROR_BAD_SIGNATURE - the signature did not verify
  397. * Other errors are any of the many possible failures in cert verification
  398. * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when
  399. * verifying the signer's cert, or low-level problems (no memory, etc.)
  400. */
  401. extern SECStatus
  402. CERT_VerifyOCSPResponseSignature(CERTOCSPResponse *response,
  403. CERTCertDBHandle *handle, void *pwArg,
  404. CERTCertificate **pSignerCert,
  405. CERTCertificate *issuerCert);
  406. /*
  407. * FUNCTION: CERT_GetOCSPAuthorityInfoAccessLocation
  408. * Get the value of the URI of the OCSP responder for the given cert.
  409. * This is found in the (optional) Authority Information Access extension
  410. * in the cert.
  411. * INPUTS:
  412. * CERTCertificate *cert
  413. * The certificate being examined.
  414. * RETURN:
  415. * char *
  416. * A copy of the URI for the OCSP method, if found. If either the
  417. * extension is not present or it does not contain an entry for OCSP,
  418. * SEC_ERROR_EXTENSION_NOT_FOUND will be set and a NULL returned.
  419. * Any other error will also result in a NULL being returned.
  420. *
  421. * This result should be freed (via PORT_Free) when no longer in use.
  422. */
  423. extern char *
  424. CERT_GetOCSPAuthorityInfoAccessLocation(CERTCertificate *cert);
  425. /*
  426. * FUNCTION: CERT_ParseURL
  427. * Parse the URI of a OCSP responder into hostname, port, and path.
  428. * INPUTS:
  429. * const char *location
  430. * The URI to be parsed
  431. * OUTPUTS:
  432. * char *pHostname
  433. * Pointer to store the hostname obtained from the URI.
  434. * This result should be freed (via PORT_Free) when no longer in use.
  435. * PRUint16 *pPort
  436. * Pointer to store the port number obtained from the URI.
  437. * char *pPath
  438. * Pointer to store the path obtained from the URI.
  439. * This result should be freed (via PORT_Free) when no longer in use.
  440. * RETURN:
  441. * Returns SECSuccess when parsing was successful. Anything else means
  442. * problems were encountered.
  443. *
  444. */
  445. extern SECStatus
  446. CERT_ParseURL(const char *url, char **pHostname, PRUint16 *pPort, char **pPath);
  447. /*
  448. * FUNCTION: CERT_CheckOCSPStatus
  449. * Checks the status of a certificate via OCSP. Will only check status for
  450. * a certificate that has an AIA (Authority Information Access) extension
  451. * for OCSP *or* when a "default responder" is specified and enabled.
  452. * (If no AIA extension for OCSP and no default responder in place, the
  453. * cert is considered to have a good status and SECSuccess is returned.)
  454. * INPUTS:
  455. * CERTCertDBHandle *handle
  456. * certificate DB of the cert that is being checked
  457. * CERTCertificate *cert
  458. * the certificate being checked
  459. * XXX in the long term also need a boolean parameter that specifies
  460. * whether to check the cert chain, as well; for now we check only
  461. * the leaf (the specified certificate)
  462. * int64 time
  463. * time for which status is to be determined
  464. * void *pwArg
  465. * argument for password prompting, if needed
  466. * RETURN:
  467. * Returns SECSuccess if an approved OCSP responder "knows" the cert
  468. * *and* returns a non-revoked status for it; SECFailure otherwise,
  469. * with an error set describing the reason:
  470. *
  471. * SEC_ERROR_OCSP_BAD_HTTP_RESPONSE
  472. * SEC_ERROR_OCSP_FUTURE_RESPONSE
  473. * SEC_ERROR_OCSP_MALFORMED_REQUEST
  474. * SEC_ERROR_OCSP_MALFORMED_RESPONSE
  475. * SEC_ERROR_OCSP_OLD_RESPONSE
  476. * SEC_ERROR_OCSP_REQUEST_NEEDS_SIG
  477. * SEC_ERROR_OCSP_SERVER_ERROR
  478. * SEC_ERROR_OCSP_TRY_SERVER_LATER
  479. * SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST
  480. * SEC_ERROR_OCSP_UNAUTHORIZED_RESPONSE
  481. * SEC_ERROR_OCSP_UNKNOWN_CERT
  482. * SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS
  483. * SEC_ERROR_OCSP_UNKNOWN_RESPONSE_TYPE
  484. *
  485. * SEC_ERROR_BAD_SIGNATURE
  486. * SEC_ERROR_CERT_BAD_ACCESS_LOCATION
  487. * SEC_ERROR_INVALID_TIME
  488. * SEC_ERROR_REVOKED_CERTIFICATE
  489. * SEC_ERROR_UNKNOWN_ISSUER
  490. * SEC_ERROR_UNKNOWN_SIGNER
  491. *
  492. * Other errors are any of the many possible failures in cert verification
  493. * (e.g. SEC_ERROR_REVOKED_CERTIFICATE, SEC_ERROR_UNTRUSTED_ISSUER) when
  494. * verifying the signer's cert, or low-level problems (error allocating
  495. * memory, error performing ASN.1 decoding, etc.).
  496. */
  497. extern SECStatus
  498. CERT_CheckOCSPStatus(CERTCertDBHandle *handle, CERTCertificate *cert,
  499. int64 time, void *pwArg);
  500. /*
  501. * FUNCTION: CERT_GetOCSPStatusForCertID
  502. * Returns the OCSP status contained in the passed in paramter response
  503. * that corresponds to the certID passed in.
  504. * INPUTS:
  505. * CERTCertDBHandle *handle
  506. * certificate DB of the cert that is being checked
  507. * CERTOCSPResponse *response
  508. * the OCSP response we want to retrieve status from.
  509. * CERTOCSPCertID *certID
  510. * the ID we want to look for from the response.
  511. * CERTCertificate *signerCert
  512. * the certificate that was used to sign the OCSP response.
  513. * must be obtained via a call to CERT_VerifyOCSPResponseSignature.
  514. * int64 time
  515. * The time at which we're checking the status for.
  516. * RETURN:
  517. * Return values are the same as those for CERT_CheckOCSPStatus
  518. */
  519. extern SECStatus
  520. CERT_GetOCSPStatusForCertID(CERTCertDBHandle *handle,
  521. CERTOCSPResponse *response,
  522. CERTOCSPCertID *certID,
  523. CERTCertificate *signerCert,
  524. int64 time);
  525. /*
  526. * FUNCTION CERT_GetOCSPResponseStatus
  527. * Returns the response status for the response passed.
  528. * INPUTS:
  529. * CERTOCSPResponse *response
  530. * The response to query for status
  531. * RETURN:
  532. * Returns SECSuccess if the response has a successful status value.
  533. * Otherwise it returns SECFailure and sets one of the following error
  534. * codes via PORT_SetError
  535. * SEC_ERROR_OCSP_MALFORMED_REQUEST
  536. * SEC_ERROR_OCSP_SERVER_ERROR
  537. * SEC_ERROR_OCSP_TRY_SERVER_LATER
  538. * SEC_ERROR_OCSP_REQUEST_NEEDS_SIG
  539. * SEC_ERROR_OCSP_UNAUTHORIZED_REQUEST
  540. * SEC_ERROR_OCSP_UNKNOWN_RESPONSE_STATUS
  541. */
  542. extern SECStatus
  543. CERT_GetOCSPResponseStatus(CERTOCSPResponse *response);
  544. /*
  545. * FUNCTION CERT_CreateOCSPCertID
  546. * Returns the OCSP certID for the certificate passed in.
  547. * INPUTS:
  548. * CERTCertificate *cert
  549. * The certificate for which to create the certID for.
  550. * int64 time
  551. * The time at which the id is requested for. This is used
  552. * to determine the appropriate issuer for the cert since
  553. * the issuing CA may be an older expired certificate.
  554. * RETURN:
  555. * A new copy of a CERTOCSPCertID*. The memory for this certID
  556. * should be freed by calling CERT_DestroyOCSPCertID when the
  557. * certID is no longer necessary.
  558. */
  559. extern CERTOCSPCertID*
  560. CERT_CreateOCSPCertID(CERTCertificate *cert, int64 time);
  561. /*
  562. * FUNCTION: CERT_DestroyOCSPCertID
  563. * Frees the memory associated with the certID passed in.
  564. * INPUTS:
  565. * CERTOCSPCertID* certID
  566. * The certID that the caller no longer needs and wants to
  567. * free the associated memory.
  568. * RETURN:
  569. * SECSuccess if freeing the memory was successful. Returns
  570. * SECFailure if the memory passed in was not allocated with
  571. * a call to CERT_CreateOCSPCertID.
  572. */
  573. extern SECStatus
  574. CERT_DestroyOCSPCertID(CERTOCSPCertID* certID);
  575. /************************************************************************/
  576. SEC_END_PROTOS
  577. #endif /* _OCSP_H_ */