Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | /* |
michael@0 | 5 | * This file defines functions associated with the PKIX_CertStore type. |
michael@0 | 6 | * |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #ifndef _PKIX_CERTSTORE_H |
michael@0 | 10 | #define _PKIX_CERTSTORE_H |
michael@0 | 11 | |
michael@0 | 12 | #include "pkixt.h" |
michael@0 | 13 | |
michael@0 | 14 | #ifdef __cplusplus |
michael@0 | 15 | extern "C" { |
michael@0 | 16 | #endif |
michael@0 | 17 | |
michael@0 | 18 | /* General |
michael@0 | 19 | * |
michael@0 | 20 | * Please refer to the libpkix Programmer's Guide for detailed information |
michael@0 | 21 | * about how to use the libpkix library. Certain key warnings and notices from |
michael@0 | 22 | * that document are repeated here for emphasis. |
michael@0 | 23 | * |
michael@0 | 24 | * All identifiers in this file (and all public identifiers defined in |
michael@0 | 25 | * libpkix) begin with "PKIX_". Private identifiers only intended for use |
michael@0 | 26 | * within the library begin with "pkix_". |
michael@0 | 27 | * |
michael@0 | 28 | * A function returns NULL upon success, and a PKIX_Error pointer upon failure. |
michael@0 | 29 | * |
michael@0 | 30 | * Unless otherwise noted, for all accessor (gettor) functions that return a |
michael@0 | 31 | * PKIX_PL_Object pointer, callers should assume that this pointer refers to a |
michael@0 | 32 | * shared object. Therefore, the caller should treat this shared object as |
michael@0 | 33 | * read-only and should not modify this shared object. When done using the |
michael@0 | 34 | * shared object, the caller should release the reference to the object by |
michael@0 | 35 | * using the PKIX_PL_Object_DecRef function. |
michael@0 | 36 | * |
michael@0 | 37 | * While a function is executing, if its arguments (or anything referred to by |
michael@0 | 38 | * its arguments) are modified, free'd, or destroyed, the function's behavior |
michael@0 | 39 | * is undefined. |
michael@0 | 40 | * |
michael@0 | 41 | */ |
michael@0 | 42 | |
michael@0 | 43 | /* PKIX_CertStore |
michael@0 | 44 | * |
michael@0 | 45 | * A PKIX_CertStore provides a standard way for the caller to retrieve |
michael@0 | 46 | * certificates and CRLs from a particular repository (or "store") of |
michael@0 | 47 | * certificates and CRLs, including LDAP directories, flat files, local |
michael@0 | 48 | * databases, etc. The CertCallback allows custom certificate retrieval logic |
michael@0 | 49 | * to be used while the CRLCallback allows custom CRL retrieval logic to be |
michael@0 | 50 | * used. Additionally, a CertStore can be initialized with a certStoreContext, |
michael@0 | 51 | * which is where the caller can specify configuration data such as the host |
michael@0 | 52 | * name of an LDAP server. Note that this certStoreContext must be an |
michael@0 | 53 | * Object (although any object type), allowing it to be reference-counted and |
michael@0 | 54 | * allowing it to provide the standard Object functions (Equals, Hashcode, |
michael@0 | 55 | * ToString, Compare, Duplicate). Please note that each certStoreContext must |
michael@0 | 56 | * provide Equals and Hashcode functions in order for the caching (on Cert and |
michael@0 | 57 | * CertChain) to work correctly. When providing those two functions, it is not |
michael@0 | 58 | * required that all the components of the object be hashed or checked for |
michael@0 | 59 | * equality, but merely that the functions distinguish between unique |
michael@0 | 60 | * instances of the certStoreContext. |
michael@0 | 61 | * |
michael@0 | 62 | * Once the caller has created the CertStore object, the caller then specifies |
michael@0 | 63 | * these CertStore objects in a ProcessingParams object and passes that object |
michael@0 | 64 | * to PKIX_ValidateChain or PKIX_BuildChain, which uses the objects to call the |
michael@0 | 65 | * user's callback functions as needed during the validation or building |
michael@0 | 66 | * process. |
michael@0 | 67 | * |
michael@0 | 68 | * The order of CertStores stored (as a list) at ProcessingParams determines |
michael@0 | 69 | * the order in which certificates are retrieved. Trusted CertStores should |
michael@0 | 70 | * precede non-trusted ones on the list of CertStores so their certificates |
michael@0 | 71 | * are evaluated ahead of other certificates selected on the basis of the same |
michael@0 | 72 | * selector criteria. |
michael@0 | 73 | * |
michael@0 | 74 | * The CheckTrustCallback function is used when the CertStore object |
michael@0 | 75 | * supports trust status, which means a Cert's trust status can be altered |
michael@0 | 76 | * dynamically. When a CertStore object is created, if the |
michael@0 | 77 | * CheckTrustCallback is initialized to be non-NULL, this CertStore is |
michael@0 | 78 | * defaulted as supporting trust. Then whenever a Cert needs to (re)check its |
michael@0 | 79 | * trust status, this callback can be invoked. When a Cert is retrieved by |
michael@0 | 80 | * a CertStore supports trust, at its GetCertCallback, the CertStore |
michael@0 | 81 | * information should be updated in Cert's data structure so the link between |
michael@0 | 82 | * the Cert and CertStore exists. |
michael@0 | 83 | * |
michael@0 | 84 | */ |
michael@0 | 85 | |
michael@0 | 86 | /* |
michael@0 | 87 | * FUNCTION: PKIX_CertStore_CertCallback |
michael@0 | 88 | * DESCRIPTION: |
michael@0 | 89 | * |
michael@0 | 90 | * This callback function retrieves from the CertStore pointed to by "store" |
michael@0 | 91 | * all the certificates that match the CertSelector pointed to by "selector". |
michael@0 | 92 | * It places these certificates in a List and stores a pointer to the List at |
michael@0 | 93 | * "pCerts". If no certificates are found which match the CertSelector's |
michael@0 | 94 | * criteria, this function stores an empty List at "pCerts". In either case, if |
michael@0 | 95 | * the operation is completed, NULL is stored at "pNBIOContext". |
michael@0 | 96 | * |
michael@0 | 97 | * A CertStore which uses non-blocking I/O may store platform-dependent |
michael@0 | 98 | * information at "pNBIOContext" and NULL at "pCerts" to indicate that I/O is |
michael@0 | 99 | * pending. A subsequent call to PKIX_CertStore_CertContinue is required to |
michael@0 | 100 | * finish the operation and to obtain the List of Certs. |
michael@0 | 101 | * |
michael@0 | 102 | * Note that the List returned by this function is immutable. |
michael@0 | 103 | * |
michael@0 | 104 | * PARAMETERS: |
michael@0 | 105 | * "store" |
michael@0 | 106 | * Address of CertStore from which Certs are to be retrieved. |
michael@0 | 107 | * Must be non-NULL. |
michael@0 | 108 | * "selector" |
michael@0 | 109 | * Address of CertSelector whose criteria must be satisfied. |
michael@0 | 110 | * Must be non-NULL. |
michael@0 | 111 | * "verifyNode" |
michael@0 | 112 | * Parent log node for tracking of filtered out certs. |
michael@0 | 113 | * "pNBIOContext" |
michael@0 | 114 | * Address at which platform-dependent information is stored if the |
michael@0 | 115 | * operation is suspended for non-blocking I/O. Must be non-NULL. |
michael@0 | 116 | * "pCerts" |
michael@0 | 117 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 118 | * "plContext" |
michael@0 | 119 | * Platform-specific context pointer. |
michael@0 | 120 | * THREAD SAFETY: |
michael@0 | 121 | * Thread Safe |
michael@0 | 122 | * |
michael@0 | 123 | * Multiple threads must be able to safely call this function without |
michael@0 | 124 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 125 | * RETURNS: |
michael@0 | 126 | * Returns NULL if the function succeeds. |
michael@0 | 127 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 128 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 129 | */ |
michael@0 | 130 | typedef PKIX_Error * |
michael@0 | 131 | (*PKIX_CertStore_CertCallback)( |
michael@0 | 132 | PKIX_CertStore *store, |
michael@0 | 133 | PKIX_CertSelector *selector, |
michael@0 | 134 | PKIX_VerifyNode *verifyNode, |
michael@0 | 135 | void **pNBIOContext, |
michael@0 | 136 | PKIX_List **pCerts, /* list of PKIX_PL_Cert */ |
michael@0 | 137 | void *plContext); |
michael@0 | 138 | |
michael@0 | 139 | /* |
michael@0 | 140 | * FUNCTION: PKIX_CertStore_CertContinue |
michael@0 | 141 | * DESCRIPTION: |
michael@0 | 142 | * |
michael@0 | 143 | * This function continues the non-blocking operation initiated by an earlier |
michael@0 | 144 | * call to the CertCallback function, for the CertStore pointed to by "store". |
michael@0 | 145 | * If an earlier call did not terminate with the WOULDBLOCK indication (non-NULL |
michael@0 | 146 | * value returned in "pNBIOContext") calling this function will return a fatal |
michael@0 | 147 | * error. If the operation is completed the certificates found are placed in a |
michael@0 | 148 | * List, a pointer to which is stored at "pCerts". If no certificates are found |
michael@0 | 149 | * which match the CertSelector's criteria, this function stores an empty List |
michael@0 | 150 | * at "pCerts". In either case, if the operation is completed, NULL is stored |
michael@0 | 151 | * at "pNBIOContext". |
michael@0 | 152 | * |
michael@0 | 153 | * If non-blocking I/O is still pending this function stores platform-dependent |
michael@0 | 154 | * information at "pNBIOContext" and NULL at "pCerts". A subsequent call to |
michael@0 | 155 | * PKIX_CertStore_CertContinue is required to finish the operation and to |
michael@0 | 156 | * obtain the List of Certs. |
michael@0 | 157 | * |
michael@0 | 158 | * Note that the List returned by this function is immutable. |
michael@0 | 159 | * |
michael@0 | 160 | * PARAMETERS: |
michael@0 | 161 | * "store" |
michael@0 | 162 | * Address of CertStore from which Certs are to be retrieved. |
michael@0 | 163 | * Must be non-NULL. |
michael@0 | 164 | * "selector" |
michael@0 | 165 | * Address of CertSelector whose criteria must be satisfied. |
michael@0 | 166 | * Must be non-NULL. |
michael@0 | 167 | * "verifyNode" |
michael@0 | 168 | * Parent log node for tracking of filtered out certs. |
michael@0 | 169 | * "pNBIOContext" |
michael@0 | 170 | * Address at which platform-dependent information is stored if the |
michael@0 | 171 | * operation is suspended for non-blocking I/O. Must be non-NULL. |
michael@0 | 172 | * "pCerts" |
michael@0 | 173 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 174 | * "plContext" |
michael@0 | 175 | * Platform-specific context pointer. |
michael@0 | 176 | * THREAD SAFETY: |
michael@0 | 177 | * Thread Safe |
michael@0 | 178 | * |
michael@0 | 179 | * Multiple threads must be able to safely call this function without |
michael@0 | 180 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 181 | * RETURNS: |
michael@0 | 182 | * Returns NULL if the function succeeds. |
michael@0 | 183 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 184 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 185 | */ |
michael@0 | 186 | PKIX_Error * |
michael@0 | 187 | PKIX_CertStore_CertContinue( |
michael@0 | 188 | PKIX_CertStore *store, |
michael@0 | 189 | PKIX_CertSelector *selector, |
michael@0 | 190 | PKIX_VerifyNode *verifyNode, |
michael@0 | 191 | void **pNBIOContext, |
michael@0 | 192 | PKIX_List **pCerts, /* list of PKIX_PL_Cert */ |
michael@0 | 193 | void *plContext); |
michael@0 | 194 | |
michael@0 | 195 | typedef PKIX_Error * |
michael@0 | 196 | (*PKIX_CertStore_CertContinueFunction)( |
michael@0 | 197 | PKIX_CertStore *store, |
michael@0 | 198 | PKIX_CertSelector *selector, |
michael@0 | 199 | PKIX_VerifyNode *verifyNode, |
michael@0 | 200 | void **pNBIOContext, |
michael@0 | 201 | PKIX_List **pCerts, /* list of PKIX_PL_Cert */ |
michael@0 | 202 | void *plContext); |
michael@0 | 203 | |
michael@0 | 204 | /* |
michael@0 | 205 | * FUNCTION: PKIX_CertStore_CRLCallback |
michael@0 | 206 | * DESCRIPTION: |
michael@0 | 207 | * |
michael@0 | 208 | * This callback function retrieves from the CertStore pointed to by "store" |
michael@0 | 209 | * all the CRLs that match the CRLSelector pointed to by "selector". It |
michael@0 | 210 | * places these CRLs in a List and stores a pointer to the List at "pCRLs". |
michael@0 | 211 | * If no CRLs are found which match the CRLSelector's criteria, this function |
michael@0 | 212 | * stores an empty List at "pCRLs". In either case, if the operation is |
michael@0 | 213 | * completed, NULL is stored at "pNBIOContext". |
michael@0 | 214 | * |
michael@0 | 215 | * A CertStore which uses non-blocking I/O may store platform-dependent |
michael@0 | 216 | * information at "pNBIOContext" and NULL at "pCrls" to indicate that I/O is |
michael@0 | 217 | * pending. A subsequent call to PKIX_CertStore_CRLContinue is required to |
michael@0 | 218 | * finish the operation and to obtain the List of Crls. |
michael@0 | 219 | * |
michael@0 | 220 | * Note that the List returned by this function is immutable. |
michael@0 | 221 | * |
michael@0 | 222 | * PARAMETERS: |
michael@0 | 223 | * "store" |
michael@0 | 224 | * Address of CertStore from which CRLs are to be retrieved. |
michael@0 | 225 | * Must be non-NULL. |
michael@0 | 226 | * "selector" |
michael@0 | 227 | * Address of CRLSelector whose criteria must be satisfied. |
michael@0 | 228 | * Must be non-NULL. |
michael@0 | 229 | * "pCrls" |
michael@0 | 230 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 231 | * "plContext" |
michael@0 | 232 | * Platform-specific context pointer. |
michael@0 | 233 | * THREAD SAFETY: |
michael@0 | 234 | * Thread Safe |
michael@0 | 235 | * |
michael@0 | 236 | * Multiple threads must be able to safely call this function without |
michael@0 | 237 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 238 | * RETURNS: |
michael@0 | 239 | * Returns NULL if the function succeeds. |
michael@0 | 240 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 241 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 242 | */ |
michael@0 | 243 | typedef PKIX_Error * |
michael@0 | 244 | (*PKIX_CertStore_CRLCallback)( |
michael@0 | 245 | PKIX_CertStore *store, |
michael@0 | 246 | PKIX_CRLSelector *selector, |
michael@0 | 247 | void **pNBIOContext, |
michael@0 | 248 | PKIX_List **pCrls, /* list of PKIX_PL_CRL */ |
michael@0 | 249 | void *plContext); |
michael@0 | 250 | |
michael@0 | 251 | /* |
michael@0 | 252 | * FUNCTION: PKIX_CertStore_ImportCrlCallback |
michael@0 | 253 | * DESCRIPTION: |
michael@0 | 254 | * |
michael@0 | 255 | * The function imports crl list into a cert store. Stores that |
michael@0 | 256 | * have local cache may only have that function defined. |
michael@0 | 257 | * |
michael@0 | 258 | * PARAMETERS: |
michael@0 | 259 | * "store" |
michael@0 | 260 | * Address of CertStore from which CRLs are to be retrieved. |
michael@0 | 261 | * Must be non-NULL. |
michael@0 | 262 | * "issuerName" |
michael@0 | 263 | * Name of the issuer that will be used to track bad der crls. |
michael@0 | 264 | * "crlList" |
michael@0 | 265 | * Address on the importing crl list. |
michael@0 | 266 | * "plContext" |
michael@0 | 267 | * Platform-specific context pointer. |
michael@0 | 268 | * THREAD SAFETY: |
michael@0 | 269 | * Thread Safe |
michael@0 | 270 | * |
michael@0 | 271 | * Multiple threads must be able to safely call this function without |
michael@0 | 272 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 273 | * RETURNS: |
michael@0 | 274 | * Returns NULL if the function succeeds. |
michael@0 | 275 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 276 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 277 | */ |
michael@0 | 278 | typedef PKIX_Error * |
michael@0 | 279 | (*PKIX_CertStore_ImportCrlCallback)( |
michael@0 | 280 | PKIX_CertStore *store, |
michael@0 | 281 | PKIX_PL_X500Name *issuerName, |
michael@0 | 282 | PKIX_List *crlList, |
michael@0 | 283 | void *plContext); |
michael@0 | 284 | |
michael@0 | 285 | /* |
michael@0 | 286 | * FUNCTION: PKIX_CertStore_CheckRevokationByCrlCallback |
michael@0 | 287 | * DESCRIPTION: |
michael@0 | 288 | * |
michael@0 | 289 | * The function checks revocation status of a cert with specified |
michael@0 | 290 | * issuer, date. It returns revocation status of a cert and |
michael@0 | 291 | * a reason code(if any) if a cert was revoked. |
michael@0 | 292 | * |
michael@0 | 293 | * PARAMETERS: |
michael@0 | 294 | * "store" |
michael@0 | 295 | * Address of CertStore from which CRLs are to be retrieved. |
michael@0 | 296 | * Must be non-NULL. |
michael@0 | 297 | * "cert" |
michael@0 | 298 | * Certificate which revocation status will be checked. |
michael@0 | 299 | * "issuer" |
michael@0 | 300 | * Issuer certificate of the "crl". |
michael@0 | 301 | * "date" |
michael@0 | 302 | * Date of the revocation check. |
michael@0 | 303 | * "crlDownloadDone" |
michael@0 | 304 | * Indicates, that all needed crl downloads are done by the time of |
michael@0 | 305 | * the revocation check. |
michael@0 | 306 | * "reasonCode" |
michael@0 | 307 | * If cert is revoked, returned reason code for which a cert was revoked. |
michael@0 | 308 | * "revStatus" |
michael@0 | 309 | * Returned revocation status of the cert. See PKIX_RevocationStatus |
michael@0 | 310 | * for more details |
michael@0 | 311 | * "plContext" |
michael@0 | 312 | * Platform-specific context pointer. |
michael@0 | 313 | * THREAD SAFETY: |
michael@0 | 314 | * Thread Safe |
michael@0 | 315 | * |
michael@0 | 316 | * Multiple threads must be able to safely call this function without |
michael@0 | 317 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 318 | * RETURNS: |
michael@0 | 319 | * Returns NULL if the function succeeds. |
michael@0 | 320 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 321 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 322 | */ |
michael@0 | 323 | typedef PKIX_Error * |
michael@0 | 324 | (*PKIX_CertStore_CheckRevokationByCrlCallback)( |
michael@0 | 325 | PKIX_CertStore *store, |
michael@0 | 326 | PKIX_PL_Cert *cert, |
michael@0 | 327 | PKIX_PL_Cert *issuer, |
michael@0 | 328 | PKIX_PL_Date *date, |
michael@0 | 329 | PKIX_Boolean crlDownloadDone, |
michael@0 | 330 | PKIX_UInt32 *reasonCode, |
michael@0 | 331 | PKIX_RevocationStatus *revStatus, |
michael@0 | 332 | void *plContext); |
michael@0 | 333 | |
michael@0 | 334 | /* |
michael@0 | 335 | * FUNCTION: PKIX_CertStore_CrlContinue |
michael@0 | 336 | * DESCRIPTION: |
michael@0 | 337 | * |
michael@0 | 338 | * This function continues the non-blocking operation initiated by an earlier |
michael@0 | 339 | * call to the CRLCallback function, for the CertStore pointed to by "store". |
michael@0 | 340 | * If an earlier call did not terminate with the WOULDBLOCK indication (non-NULL |
michael@0 | 341 | * value returned in "pNBIOContext") calling this function will return a fatal |
michael@0 | 342 | * error. If the operation is completed the crls found are placed in a List, a |
michael@0 | 343 | * pointer to which is stored at "pCrls". If no crls are found which match the |
michael@0 | 344 | * CRLSelector's criteria, this function stores an empty List at "pCrls". In |
michael@0 | 345 | * either case, if the operation is completed, NULL is stored at "pNBIOContext". |
michael@0 | 346 | * |
michael@0 | 347 | * If non-blocking I/O is still pending this function stores platform-dependent |
michael@0 | 348 | * information at "pNBIOContext" and NULL at "pCrls". A subsequent call to |
michael@0 | 349 | * PKIX_CertStore_CrlContinue is required to finish the operation and to |
michael@0 | 350 | * obtain the List of Crls. |
michael@0 | 351 | * |
michael@0 | 352 | * Note that the List returned by this function is immutable. |
michael@0 | 353 | * |
michael@0 | 354 | * PARAMETERS: |
michael@0 | 355 | * "store" |
michael@0 | 356 | * Address of CertStore from which Crls are to be retrieved. |
michael@0 | 357 | * Must be non-NULL. |
michael@0 | 358 | * "selector" |
michael@0 | 359 | * Address of CRLSelector whose criteria must be satisfied. |
michael@0 | 360 | * Must be non-NULL. |
michael@0 | 361 | * "pNBIOContext" |
michael@0 | 362 | * Address at which platform-dependent information is stored if the |
michael@0 | 363 | * operation is suspended for non-blocking I/O. Must be non-NULL. |
michael@0 | 364 | * "pCrls" |
michael@0 | 365 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 366 | * "plContext" |
michael@0 | 367 | * Platform-specific context pointer. |
michael@0 | 368 | * THREAD SAFETY: |
michael@0 | 369 | * Thread Safe |
michael@0 | 370 | * |
michael@0 | 371 | * Multiple threads must be able to safely call this function without |
michael@0 | 372 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 373 | * RETURNS: |
michael@0 | 374 | * Returns NULL if the function succeeds. |
michael@0 | 375 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 376 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 377 | */ |
michael@0 | 378 | PKIX_Error * |
michael@0 | 379 | PKIX_CertStore_CrlContinue( |
michael@0 | 380 | PKIX_CertStore *store, |
michael@0 | 381 | PKIX_CRLSelector *selector, |
michael@0 | 382 | void **pNBIOContext, |
michael@0 | 383 | PKIX_List **pCrls, /* list of PKIX_PL_CRL */ |
michael@0 | 384 | void *plContext); |
michael@0 | 385 | |
michael@0 | 386 | typedef PKIX_Error * |
michael@0 | 387 | (*PKIX_CertStore_CrlContinueFunction)( |
michael@0 | 388 | PKIX_CertStore *store, |
michael@0 | 389 | PKIX_CRLSelector *selector, |
michael@0 | 390 | void **pNBIOContext, |
michael@0 | 391 | PKIX_List **pCrls, /* list of PKIX_PL_CRL */ |
michael@0 | 392 | void *plContext); |
michael@0 | 393 | |
michael@0 | 394 | /* |
michael@0 | 395 | * FUNCTION: PKIX_CertStore_CheckTrustCallback |
michael@0 | 396 | * DESCRIPTION: |
michael@0 | 397 | * |
michael@0 | 398 | * This callback function rechecks "cert's" trust status from the CertStore |
michael@0 | 399 | * pointed to by "store". |
michael@0 | 400 | * |
michael@0 | 401 | * PARAMETERS: |
michael@0 | 402 | * "store" |
michael@0 | 403 | * Address of CertStore from which Certs are to be checked. |
michael@0 | 404 | * Must be non-NULL. |
michael@0 | 405 | * "cert" |
michael@0 | 406 | * Address of Cert whose trust status needs to be rechecked. |
michael@0 | 407 | * Must be non-NULL. |
michael@0 | 408 | * "pTrusted" |
michael@0 | 409 | * Address of PKIX_Boolean where the trust status is returned. |
michael@0 | 410 | * Must be non-NULL. |
michael@0 | 411 | * "plContext" |
michael@0 | 412 | * Platform-specific context pointer. |
michael@0 | 413 | * THREAD SAFETY: |
michael@0 | 414 | * Thread Safe |
michael@0 | 415 | * |
michael@0 | 416 | * Multiple threads must be able to safely call this function without |
michael@0 | 417 | * worrying about conflicts, even if they're operating on the same object. |
michael@0 | 418 | * RETURNS: |
michael@0 | 419 | * Returns NULL if the function succeeds. |
michael@0 | 420 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 421 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 422 | */ |
michael@0 | 423 | typedef PKIX_Error * |
michael@0 | 424 | (*PKIX_CertStore_CheckTrustCallback)( |
michael@0 | 425 | PKIX_CertStore *store, |
michael@0 | 426 | PKIX_PL_Cert *cert, |
michael@0 | 427 | PKIX_Boolean *pTrusted, |
michael@0 | 428 | void *plContext); |
michael@0 | 429 | |
michael@0 | 430 | /* |
michael@0 | 431 | * FUNCTION: PKIX_CertStore_Create |
michael@0 | 432 | * DESCRIPTION: |
michael@0 | 433 | * |
michael@0 | 434 | * Creates a new CertStore and stores it at "pStore". The new CertStore uses |
michael@0 | 435 | * the CertCallback pointed to by "certCallback" and the CRLCallback pointed |
michael@0 | 436 | * to by "crlCallback" as its callback functions and uses the Object pointed |
michael@0 | 437 | * to by "certStoreContext" as its context . Note that this certStoreContext |
michael@0 | 438 | * must be an Object (although any object type), allowing it to be |
michael@0 | 439 | * reference-counted and allowing it to provide the standard Object functions |
michael@0 | 440 | * (Equals, Hashcode, ToString, Compare, Duplicate). Once created, a |
michael@0 | 441 | * CertStore object is immutable, although the underlying repository can |
michael@0 | 442 | * change. For example, a CertStore will often be a front-end for a database |
michael@0 | 443 | * or directory. The contents of that directory can change after the |
michael@0 | 444 | * CertStore object is created, but the CertStore object remains immutable. |
michael@0 | 445 | * |
michael@0 | 446 | * PARAMETERS: |
michael@0 | 447 | * "certCallback" |
michael@0 | 448 | * The CertCallback function to be used. Must be non-NULL. |
michael@0 | 449 | * "crlCallback" |
michael@0 | 450 | * The CRLCallback function to be used. Must be non-NULL. |
michael@0 | 451 | * "certContinue" |
michael@0 | 452 | * The function to be used to resume a certCallback that returned with a |
michael@0 | 453 | * WOULDBLOCK condition. Must be non-NULL if certStore supports non-blocking |
michael@0 | 454 | * I/O. |
michael@0 | 455 | * "crlContinue" |
michael@0 | 456 | * The function to be used to resume a crlCallback that returned with a |
michael@0 | 457 | * WOULDBLOCK condition. Must be non-NULL if certStore supports non-blocking |
michael@0 | 458 | * I/O. |
michael@0 | 459 | * "trustCallback" |
michael@0 | 460 | * Address of PKIX_CertStore_CheckTrustCallback which is called to |
michael@0 | 461 | * verify the trust status of Certs in this CertStore. |
michael@0 | 462 | * "certStoreContext" |
michael@0 | 463 | * Address of Object representing the CertStore's context (if any). |
michael@0 | 464 | * "cachedFlag" |
michael@0 | 465 | * If TRUE indicates data retrieved from CertStore should be cached. |
michael@0 | 466 | * "localFlag" |
michael@0 | 467 | * Boolean value indicating whether this CertStore is local. |
michael@0 | 468 | * "pStore" |
michael@0 | 469 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 470 | * "plContext" |
michael@0 | 471 | * Platform-specific context pointer. |
michael@0 | 472 | * THREAD SAFETY: |
michael@0 | 473 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 474 | * RETURNS: |
michael@0 | 475 | * Returns NULL if the function succeeds. |
michael@0 | 476 | * Returns a CertStore Error if the function fails in a non-fatal way. |
michael@0 | 477 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 478 | */ |
michael@0 | 479 | PKIX_Error * |
michael@0 | 480 | PKIX_CertStore_Create( |
michael@0 | 481 | PKIX_CertStore_CertCallback certCallback, |
michael@0 | 482 | PKIX_CertStore_CRLCallback crlCallback, |
michael@0 | 483 | PKIX_CertStore_CertContinueFunction certContinue, |
michael@0 | 484 | PKIX_CertStore_CrlContinueFunction crlContinue, |
michael@0 | 485 | PKIX_CertStore_CheckTrustCallback trustCallback, |
michael@0 | 486 | PKIX_CertStore_ImportCrlCallback importCrlCallback, |
michael@0 | 487 | PKIX_CertStore_CheckRevokationByCrlCallback checkRevByCrlCallback, |
michael@0 | 488 | PKIX_PL_Object *certStoreContext, |
michael@0 | 489 | PKIX_Boolean cachedFlag, |
michael@0 | 490 | PKIX_Boolean localFlag, |
michael@0 | 491 | PKIX_CertStore **pStore, |
michael@0 | 492 | void *plContext); |
michael@0 | 493 | |
michael@0 | 494 | /* |
michael@0 | 495 | * FUNCTION: PKIX_CertStore_GetCertCallback |
michael@0 | 496 | * DESCRIPTION: |
michael@0 | 497 | * |
michael@0 | 498 | * Retrieves a pointer to "store's" Cert callback function and put it in |
michael@0 | 499 | * "pCallback". |
michael@0 | 500 | * |
michael@0 | 501 | * PARAMETERS: |
michael@0 | 502 | * "store" |
michael@0 | 503 | * The CertStore whose Cert callback is desired. Must be non-NULL. |
michael@0 | 504 | * "pCallback" |
michael@0 | 505 | * Address where Cert callback function pointer will be stored. |
michael@0 | 506 | * Must be non-NULL. |
michael@0 | 507 | * "plContext" |
michael@0 | 508 | * Platform-specific context pointer. |
michael@0 | 509 | * THREAD SAFETY: |
michael@0 | 510 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 511 | * RETURNS: |
michael@0 | 512 | * Returns NULL if the function succeeds. |
michael@0 | 513 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 514 | */ |
michael@0 | 515 | PKIX_Error * |
michael@0 | 516 | PKIX_CertStore_GetCertCallback( |
michael@0 | 517 | PKIX_CertStore *store, |
michael@0 | 518 | PKIX_CertStore_CertCallback *pCallback, |
michael@0 | 519 | void *plContext); |
michael@0 | 520 | |
michael@0 | 521 | /* |
michael@0 | 522 | * FUNCTION: PKIX_CertStore_GetCRLCallback |
michael@0 | 523 | * DESCRIPTION: |
michael@0 | 524 | * |
michael@0 | 525 | * Retrieves a pointer to "store's" CRL callback function and put it in |
michael@0 | 526 | * "pCallback". |
michael@0 | 527 | * |
michael@0 | 528 | * PARAMETERS: |
michael@0 | 529 | * "store" |
michael@0 | 530 | * The CertStore whose CRL callback is desired. Must be non-NULL. |
michael@0 | 531 | * "pCallback" |
michael@0 | 532 | * Address where CRL callback function pointer will be stored. |
michael@0 | 533 | * Must be non-NULL. |
michael@0 | 534 | * "plContext" |
michael@0 | 535 | * Platform-specific context pointer. |
michael@0 | 536 | * THREAD SAFETY: |
michael@0 | 537 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 538 | * RETURNS: |
michael@0 | 539 | * Returns NULL if the function succeeds. |
michael@0 | 540 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 541 | */ |
michael@0 | 542 | PKIX_Error * |
michael@0 | 543 | PKIX_CertStore_GetCRLCallback( |
michael@0 | 544 | PKIX_CertStore *store, |
michael@0 | 545 | PKIX_CertStore_CRLCallback *pCallback, |
michael@0 | 546 | void *plContext); |
michael@0 | 547 | |
michael@0 | 548 | /* |
michael@0 | 549 | * FUNCTION: PKIX_CertStore_GetImportCrlCallback |
michael@0 | 550 | * DESCRIPTION: |
michael@0 | 551 | * |
michael@0 | 552 | * Retrieves a pointer to "store's" Import CRL callback function and put it in |
michael@0 | 553 | * "pCallback". |
michael@0 | 554 | * |
michael@0 | 555 | * PARAMETERS: |
michael@0 | 556 | * "store" |
michael@0 | 557 | * The CertStore whose CRL callback is desired. Must be non-NULL. |
michael@0 | 558 | * "pCallback" |
michael@0 | 559 | * Address where CRL callback function pointer will be stored. |
michael@0 | 560 | * Must be non-NULL. |
michael@0 | 561 | * "plContext" |
michael@0 | 562 | * Platform-specific context pointer. |
michael@0 | 563 | * THREAD SAFETY: |
michael@0 | 564 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 565 | * RETURNS: |
michael@0 | 566 | * Returns NULL if the function succeeds. |
michael@0 | 567 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 568 | */ |
michael@0 | 569 | PKIX_Error * |
michael@0 | 570 | PKIX_CertStore_GetImportCrlCallback( |
michael@0 | 571 | PKIX_CertStore *store, |
michael@0 | 572 | PKIX_CertStore_ImportCrlCallback *pCallback, |
michael@0 | 573 | void *plContext); |
michael@0 | 574 | |
michael@0 | 575 | /* |
michael@0 | 576 | * FUNCTION: PKIX_CertStore_GetCheckRevByCrl |
michael@0 | 577 | * DESCRIPTION: |
michael@0 | 578 | * |
michael@0 | 579 | * Retrieves a pointer to "store's" CRL revocation checker callback function |
michael@0 | 580 | * and put it in "pCallback". |
michael@0 | 581 | * |
michael@0 | 582 | * PARAMETERS: |
michael@0 | 583 | * "store" |
michael@0 | 584 | * The CertStore whose CRL callback is desired. Must be non-NULL. |
michael@0 | 585 | * "pCallback" |
michael@0 | 586 | * Address where CRL callback function pointer will be stored. |
michael@0 | 587 | * Must be non-NULL. |
michael@0 | 588 | * "plContext" |
michael@0 | 589 | * Platform-specific context pointer. |
michael@0 | 590 | * THREAD SAFETY: |
michael@0 | 591 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 592 | * RETURNS: |
michael@0 | 593 | * Returns NULL if the function succeeds. |
michael@0 | 594 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 595 | */ |
michael@0 | 596 | PKIX_Error * |
michael@0 | 597 | PKIX_CertStore_GetCrlCheckerFn( |
michael@0 | 598 | PKIX_CertStore *store, |
michael@0 | 599 | PKIX_CertStore_CheckRevokationByCrlCallback *pCallback, |
michael@0 | 600 | void *plContext); |
michael@0 | 601 | |
michael@0 | 602 | /* |
michael@0 | 603 | * FUNCTION: PKIX_CertStore_GetTrustCallback |
michael@0 | 604 | * DESCRIPTION: |
michael@0 | 605 | * |
michael@0 | 606 | * Retrieves the function pointer to the CheckTrust callback function of the |
michael@0 | 607 | * CertStore pointed to by "store" and stores it at "pCallback". |
michael@0 | 608 | * |
michael@0 | 609 | * PARAMETERS: |
michael@0 | 610 | * "store" |
michael@0 | 611 | * The CertStore whose CheckTrust callback is desired. Must be non-NULL. |
michael@0 | 612 | * "pCallback" |
michael@0 | 613 | * Address where CheckTrust callback function pointer will be stored. |
michael@0 | 614 | * Must be non-NULL. |
michael@0 | 615 | * "plContext" |
michael@0 | 616 | * Platform-specific context pointer. |
michael@0 | 617 | * THREAD SAFETY: |
michael@0 | 618 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 619 | * RETURNS: |
michael@0 | 620 | * Returns NULL if the function succeeds. |
michael@0 | 621 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 622 | */ |
michael@0 | 623 | PKIX_Error * |
michael@0 | 624 | PKIX_CertStore_GetTrustCallback( |
michael@0 | 625 | PKIX_CertStore *store, |
michael@0 | 626 | PKIX_CertStore_CheckTrustCallback *pCallback, |
michael@0 | 627 | void *plContext); |
michael@0 | 628 | |
michael@0 | 629 | /* |
michael@0 | 630 | * FUNCTION: PKIX_CertStore_GetCertStoreContext |
michael@0 | 631 | * DESCRIPTION: |
michael@0 | 632 | * |
michael@0 | 633 | * Retrieves a pointer to the Object representing the context (if any) |
michael@0 | 634 | * of the CertStore pointed to by "store" and stores it at |
michael@0 | 635 | * "pCertStoreContext". |
michael@0 | 636 | * |
michael@0 | 637 | * PARAMETERS: |
michael@0 | 638 | * "store" |
michael@0 | 639 | * Address of CertStore whose context is to be stored. Must be non-NULL. |
michael@0 | 640 | * "pCertStoreContext" |
michael@0 | 641 | * Address where object pointer will be stored. Must be non-NULL. |
michael@0 | 642 | * "plContext" |
michael@0 | 643 | * Platform-specific context pointer. |
michael@0 | 644 | * THREAD SAFETY: |
michael@0 | 645 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 646 | * RETURNS: |
michael@0 | 647 | * Returns NULL if the function succeeds. |
michael@0 | 648 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 649 | */ |
michael@0 | 650 | PKIX_Error * |
michael@0 | 651 | PKIX_CertStore_GetCertStoreContext( |
michael@0 | 652 | PKIX_CertStore *store, |
michael@0 | 653 | PKIX_PL_Object **pCertStoreContext, |
michael@0 | 654 | void *plContext); |
michael@0 | 655 | |
michael@0 | 656 | /* |
michael@0 | 657 | * FUNCTION: PKIX_CertStore_GetCertStoreCacheFlag |
michael@0 | 658 | * DESCRIPTION: |
michael@0 | 659 | * |
michael@0 | 660 | * Retrieves the Boolean cache flag of the CertStore pointed to by "store" and |
michael@0 | 661 | * stores it at "pCachedFlag". |
michael@0 | 662 | * |
michael@0 | 663 | * PARAMETERS: |
michael@0 | 664 | * "store" |
michael@0 | 665 | * Address of CertStore whose cache flag is to be stored. Must be non-NULL. |
michael@0 | 666 | * "pCacheFlag" |
michael@0 | 667 | * Address where the result will be stored. Must be non-NULL. |
michael@0 | 668 | * "plContext" |
michael@0 | 669 | * Platform-specific context pointer. |
michael@0 | 670 | * THREAD SAFETY: |
michael@0 | 671 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 672 | * RETURNS: |
michael@0 | 673 | * Returns NULL if the function succeeds. |
michael@0 | 674 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 675 | */ |
michael@0 | 676 | PKIX_Error * |
michael@0 | 677 | PKIX_CertStore_GetCertStoreCacheFlag( |
michael@0 | 678 | PKIX_CertStore *store, |
michael@0 | 679 | PKIX_Boolean *pCacheFlag, |
michael@0 | 680 | void *plContext); |
michael@0 | 681 | |
michael@0 | 682 | /* |
michael@0 | 683 | * FUNCTION: PKIX_CertStore_GetLocalFlag |
michael@0 | 684 | * DESCRIPTION: |
michael@0 | 685 | * |
michael@0 | 686 | * Retrieves the Boolean localFlag for the CertStore pointed to by "store" and |
michael@0 | 687 | * stores it at "pLocalFlag". The localFlag is TRUE if the CertStore can |
michael@0 | 688 | * fulfill a request without performing network I/O. |
michael@0 | 689 | * |
michael@0 | 690 | * PARAMETERS: |
michael@0 | 691 | * "store" |
michael@0 | 692 | * The CertStore whose Local flag is desired. Must be non-NULL. |
michael@0 | 693 | * "pCallback" |
michael@0 | 694 | * Address where the Boolean LocalFlag will be stored. Must be non-NULL. |
michael@0 | 695 | * "plContext" |
michael@0 | 696 | * Platform-specific context pointer. |
michael@0 | 697 | * THREAD SAFETY: |
michael@0 | 698 | * Thread Safe (see Thread Safety Definitions in Programmer's Guide) |
michael@0 | 699 | * RETURNS: |
michael@0 | 700 | * Returns NULL if the function succeeds. |
michael@0 | 701 | * Returns a Fatal Error if the function fails in an unrecoverable way. |
michael@0 | 702 | */ |
michael@0 | 703 | PKIX_Error * |
michael@0 | 704 | PKIX_CertStore_GetLocalFlag( |
michael@0 | 705 | PKIX_CertStore *store, |
michael@0 | 706 | PKIX_Boolean *pLocalFlag, |
michael@0 | 707 | void *plContext); |
michael@0 | 708 | |
michael@0 | 709 | #ifdef __cplusplus |
michael@0 | 710 | } |
michael@0 | 711 | #endif |
michael@0 | 712 | |
michael@0 | 713 | #endif /* _PKIX_CERTSTORE_H */ |