Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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 | #ifndef PKIM_H |
michael@0 | 6 | #define PKIM_H |
michael@0 | 7 | |
michael@0 | 8 | #ifndef BASE_H |
michael@0 | 9 | #include "base.h" |
michael@0 | 10 | #endif /* BASE_H */ |
michael@0 | 11 | |
michael@0 | 12 | #ifndef PKI_H |
michael@0 | 13 | #include "pki.h" |
michael@0 | 14 | #endif /* PKI_H */ |
michael@0 | 15 | |
michael@0 | 16 | #ifndef PKITM_H |
michael@0 | 17 | #include "pkitm.h" |
michael@0 | 18 | #endif /* PKITM_H */ |
michael@0 | 19 | |
michael@0 | 20 | PR_BEGIN_EXTERN_C |
michael@0 | 21 | |
michael@0 | 22 | /* nssPKIObject |
michael@0 | 23 | * |
michael@0 | 24 | * This is the base object class, common to all PKI objects defined in |
michael@0 | 25 | * in this module. Each object can be safely 'casted' to an nssPKIObject, |
michael@0 | 26 | * then passed to these methods. |
michael@0 | 27 | * |
michael@0 | 28 | * nssPKIObject_Create |
michael@0 | 29 | * nssPKIObject_Destroy |
michael@0 | 30 | * nssPKIObject_AddRef |
michael@0 | 31 | * nssPKIObject_AddInstance |
michael@0 | 32 | * nssPKIObject_HasInstance |
michael@0 | 33 | * nssPKIObject_GetTokens |
michael@0 | 34 | * nssPKIObject_GetNicknameForToken |
michael@0 | 35 | * nssPKIObject_RemoveInstanceForToken |
michael@0 | 36 | * nssPKIObject_DeleteStoredObject |
michael@0 | 37 | */ |
michael@0 | 38 | |
michael@0 | 39 | NSS_EXTERN void nssPKIObject_Lock (nssPKIObject * object); |
michael@0 | 40 | NSS_EXTERN void nssPKIObject_Unlock (nssPKIObject * object); |
michael@0 | 41 | NSS_EXTERN PRStatus nssPKIObject_NewLock (nssPKIObject * object, |
michael@0 | 42 | nssPKILockType lockType); |
michael@0 | 43 | NSS_EXTERN void nssPKIObject_DestroyLock(nssPKIObject * object); |
michael@0 | 44 | |
michael@0 | 45 | /* nssPKIObject_Create |
michael@0 | 46 | * |
michael@0 | 47 | * A generic PKI object. It must live in a trust domain. It may be |
michael@0 | 48 | * initialized with a token instance, or alternatively in a crypto context. |
michael@0 | 49 | */ |
michael@0 | 50 | NSS_EXTERN nssPKIObject * |
michael@0 | 51 | nssPKIObject_Create |
michael@0 | 52 | ( |
michael@0 | 53 | NSSArena *arenaOpt, |
michael@0 | 54 | nssCryptokiObject *instanceOpt, |
michael@0 | 55 | NSSTrustDomain *td, |
michael@0 | 56 | NSSCryptoContext *ccOpt, |
michael@0 | 57 | nssPKILockType lockType |
michael@0 | 58 | ); |
michael@0 | 59 | |
michael@0 | 60 | /* nssPKIObject_AddRef |
michael@0 | 61 | */ |
michael@0 | 62 | NSS_EXTERN nssPKIObject * |
michael@0 | 63 | nssPKIObject_AddRef |
michael@0 | 64 | ( |
michael@0 | 65 | nssPKIObject *object |
michael@0 | 66 | ); |
michael@0 | 67 | |
michael@0 | 68 | /* nssPKIObject_Destroy |
michael@0 | 69 | * |
michael@0 | 70 | * Returns true if object was destroyed. This notifies the subclass that |
michael@0 | 71 | * all references are gone and it should delete any members it owns. |
michael@0 | 72 | */ |
michael@0 | 73 | NSS_EXTERN PRBool |
michael@0 | 74 | nssPKIObject_Destroy |
michael@0 | 75 | ( |
michael@0 | 76 | nssPKIObject *object |
michael@0 | 77 | ); |
michael@0 | 78 | |
michael@0 | 79 | /* nssPKIObject_AddInstance |
michael@0 | 80 | * |
michael@0 | 81 | * Add a token instance to the object, if it does not have it already. |
michael@0 | 82 | */ |
michael@0 | 83 | NSS_EXTERN PRStatus |
michael@0 | 84 | nssPKIObject_AddInstance |
michael@0 | 85 | ( |
michael@0 | 86 | nssPKIObject *object, |
michael@0 | 87 | nssCryptokiObject *instance |
michael@0 | 88 | ); |
michael@0 | 89 | |
michael@0 | 90 | /* nssPKIObject_HasInstance |
michael@0 | 91 | * |
michael@0 | 92 | * Query the object for a token instance. |
michael@0 | 93 | */ |
michael@0 | 94 | NSS_EXTERN PRBool |
michael@0 | 95 | nssPKIObject_HasInstance |
michael@0 | 96 | ( |
michael@0 | 97 | nssPKIObject *object, |
michael@0 | 98 | nssCryptokiObject *instance |
michael@0 | 99 | ); |
michael@0 | 100 | |
michael@0 | 101 | /* nssPKIObject_GetTokens |
michael@0 | 102 | * |
michael@0 | 103 | * Get all tokens which have an instance of the object. |
michael@0 | 104 | */ |
michael@0 | 105 | NSS_EXTERN NSSToken ** |
michael@0 | 106 | nssPKIObject_GetTokens |
michael@0 | 107 | ( |
michael@0 | 108 | nssPKIObject *object, |
michael@0 | 109 | PRStatus *statusOpt |
michael@0 | 110 | ); |
michael@0 | 111 | |
michael@0 | 112 | /* nssPKIObject_GetNicknameForToken |
michael@0 | 113 | * |
michael@0 | 114 | * tokenOpt == NULL means take the first available, otherwise return the |
michael@0 | 115 | * nickname for the specified token. |
michael@0 | 116 | */ |
michael@0 | 117 | NSS_EXTERN NSSUTF8 * |
michael@0 | 118 | nssPKIObject_GetNicknameForToken |
michael@0 | 119 | ( |
michael@0 | 120 | nssPKIObject *object, |
michael@0 | 121 | NSSToken *tokenOpt |
michael@0 | 122 | ); |
michael@0 | 123 | |
michael@0 | 124 | /* nssPKIObject_RemoveInstanceForToken |
michael@0 | 125 | * |
michael@0 | 126 | * Remove the instance of the object on the specified token. |
michael@0 | 127 | */ |
michael@0 | 128 | NSS_EXTERN PRStatus |
michael@0 | 129 | nssPKIObject_RemoveInstanceForToken |
michael@0 | 130 | ( |
michael@0 | 131 | nssPKIObject *object, |
michael@0 | 132 | NSSToken *token |
michael@0 | 133 | ); |
michael@0 | 134 | |
michael@0 | 135 | /* nssPKIObject_DeleteStoredObject |
michael@0 | 136 | * |
michael@0 | 137 | * Delete all token instances of the object, as well as any crypto context |
michael@0 | 138 | * instances (TODO). If any of the instances are read-only, or if the |
michael@0 | 139 | * removal fails, the object will keep those instances. 'isFriendly' refers |
michael@0 | 140 | * to the object -- can this object be removed from a friendly token without |
michael@0 | 141 | * login? For example, certificates are friendly, private keys are not. |
michael@0 | 142 | * Note that if the token is not friendly, authentication will be required |
michael@0 | 143 | * regardless of the value of 'isFriendly'. |
michael@0 | 144 | */ |
michael@0 | 145 | NSS_EXTERN PRStatus |
michael@0 | 146 | nssPKIObject_DeleteStoredObject |
michael@0 | 147 | ( |
michael@0 | 148 | nssPKIObject *object, |
michael@0 | 149 | NSSCallback *uhh, |
michael@0 | 150 | PRBool isFriendly |
michael@0 | 151 | ); |
michael@0 | 152 | |
michael@0 | 153 | NSS_EXTERN nssCryptokiObject ** |
michael@0 | 154 | nssPKIObject_GetInstances |
michael@0 | 155 | ( |
michael@0 | 156 | nssPKIObject *object |
michael@0 | 157 | ); |
michael@0 | 158 | |
michael@0 | 159 | NSS_EXTERN NSSCertificate ** |
michael@0 | 160 | nssTrustDomain_FindCertificatesByID |
michael@0 | 161 | ( |
michael@0 | 162 | NSSTrustDomain *td, |
michael@0 | 163 | NSSItem *id, |
michael@0 | 164 | NSSCertificate **rvOpt, |
michael@0 | 165 | PRUint32 maximumOpt, |
michael@0 | 166 | NSSArena *arenaOpt |
michael@0 | 167 | ); |
michael@0 | 168 | |
michael@0 | 169 | NSS_EXTERN NSSCRL ** |
michael@0 | 170 | nssTrustDomain_FindCRLsBySubject |
michael@0 | 171 | ( |
michael@0 | 172 | NSSTrustDomain *td, |
michael@0 | 173 | NSSDER *subject |
michael@0 | 174 | ); |
michael@0 | 175 | |
michael@0 | 176 | /* module-private nsspki methods */ |
michael@0 | 177 | |
michael@0 | 178 | NSS_EXTERN NSSCryptoContext * |
michael@0 | 179 | nssCryptoContext_Create |
michael@0 | 180 | ( |
michael@0 | 181 | NSSTrustDomain *td, |
michael@0 | 182 | NSSCallback *uhhOpt |
michael@0 | 183 | ); |
michael@0 | 184 | |
michael@0 | 185 | /* XXX for the collection */ |
michael@0 | 186 | NSS_EXTERN NSSCertificate * |
michael@0 | 187 | nssCertificate_Create |
michael@0 | 188 | ( |
michael@0 | 189 | nssPKIObject *object |
michael@0 | 190 | ); |
michael@0 | 191 | |
michael@0 | 192 | NSS_EXTERN PRStatus |
michael@0 | 193 | nssCertificate_SetCertTrust |
michael@0 | 194 | ( |
michael@0 | 195 | NSSCertificate *c, |
michael@0 | 196 | NSSTrust *trust |
michael@0 | 197 | ); |
michael@0 | 198 | |
michael@0 | 199 | NSS_EXTERN nssDecodedCert * |
michael@0 | 200 | nssCertificate_GetDecoding |
michael@0 | 201 | ( |
michael@0 | 202 | NSSCertificate *c |
michael@0 | 203 | ); |
michael@0 | 204 | |
michael@0 | 205 | extern PRIntn |
michael@0 | 206 | nssCertificate_SubjectListSort |
michael@0 | 207 | ( |
michael@0 | 208 | void *v1, |
michael@0 | 209 | void *v2 |
michael@0 | 210 | ); |
michael@0 | 211 | |
michael@0 | 212 | NSS_EXTERN nssDecodedCert * |
michael@0 | 213 | nssDecodedCert_Create |
michael@0 | 214 | ( |
michael@0 | 215 | NSSArena *arenaOpt, |
michael@0 | 216 | NSSDER *encoding, |
michael@0 | 217 | NSSCertificateType type |
michael@0 | 218 | ); |
michael@0 | 219 | |
michael@0 | 220 | NSS_EXTERN PRStatus |
michael@0 | 221 | nssDecodedCert_Destroy |
michael@0 | 222 | ( |
michael@0 | 223 | nssDecodedCert *dc |
michael@0 | 224 | ); |
michael@0 | 225 | |
michael@0 | 226 | NSS_EXTERN NSSTrust * |
michael@0 | 227 | nssTrust_Create |
michael@0 | 228 | ( |
michael@0 | 229 | nssPKIObject *object, |
michael@0 | 230 | NSSItem *certData |
michael@0 | 231 | ); |
michael@0 | 232 | |
michael@0 | 233 | NSS_EXTERN NSSCRL * |
michael@0 | 234 | nssCRL_Create |
michael@0 | 235 | ( |
michael@0 | 236 | nssPKIObject *object |
michael@0 | 237 | ); |
michael@0 | 238 | |
michael@0 | 239 | NSS_EXTERN NSSCRL * |
michael@0 | 240 | nssCRL_AddRef |
michael@0 | 241 | ( |
michael@0 | 242 | NSSCRL *crl |
michael@0 | 243 | ); |
michael@0 | 244 | |
michael@0 | 245 | NSS_EXTERN PRStatus |
michael@0 | 246 | nssCRL_Destroy |
michael@0 | 247 | ( |
michael@0 | 248 | NSSCRL *crl |
michael@0 | 249 | ); |
michael@0 | 250 | |
michael@0 | 251 | NSS_EXTERN PRStatus |
michael@0 | 252 | nssCRL_DeleteStoredObject |
michael@0 | 253 | ( |
michael@0 | 254 | NSSCRL *crl, |
michael@0 | 255 | NSSCallback *uhh |
michael@0 | 256 | ); |
michael@0 | 257 | |
michael@0 | 258 | NSS_EXTERN NSSPrivateKey * |
michael@0 | 259 | nssPrivateKey_Create |
michael@0 | 260 | ( |
michael@0 | 261 | nssPKIObject *o |
michael@0 | 262 | ); |
michael@0 | 263 | |
michael@0 | 264 | NSS_EXTERN NSSDER * |
michael@0 | 265 | nssCRL_GetEncoding |
michael@0 | 266 | ( |
michael@0 | 267 | NSSCRL *crl |
michael@0 | 268 | ); |
michael@0 | 269 | |
michael@0 | 270 | NSS_EXTERN NSSPublicKey * |
michael@0 | 271 | nssPublicKey_Create |
michael@0 | 272 | ( |
michael@0 | 273 | nssPKIObject *object |
michael@0 | 274 | ); |
michael@0 | 275 | |
michael@0 | 276 | /* nssCertificateArray |
michael@0 | 277 | * |
michael@0 | 278 | * These are being thrown around a lot, might as well group together some |
michael@0 | 279 | * functionality. |
michael@0 | 280 | * |
michael@0 | 281 | * nssCertificateArray_Destroy |
michael@0 | 282 | * nssCertificateArray_Join |
michael@0 | 283 | * nssCertificateArray_FindBestCertificate |
michael@0 | 284 | * nssCertificateArray_Traverse |
michael@0 | 285 | */ |
michael@0 | 286 | |
michael@0 | 287 | /* nssCertificateArray_Destroy |
michael@0 | 288 | * |
michael@0 | 289 | * Will destroy the array and the certs within it. If the array was created |
michael@0 | 290 | * in an arena, will *not* (of course) destroy the arena. However, is safe |
michael@0 | 291 | * to call this method on an arena-allocated array. |
michael@0 | 292 | */ |
michael@0 | 293 | NSS_EXTERN void |
michael@0 | 294 | nssCertificateArray_Destroy |
michael@0 | 295 | ( |
michael@0 | 296 | NSSCertificate **certs |
michael@0 | 297 | ); |
michael@0 | 298 | |
michael@0 | 299 | /* nssCertificateArray_Join |
michael@0 | 300 | * |
michael@0 | 301 | * Join two arrays into one. The two arrays, certs1 and certs2, should |
michael@0 | 302 | * be considered invalid after a call to this function (they may be destroyed |
michael@0 | 303 | * as part of the join). certs1 and/or certs2 may be NULL. Safe to |
michael@0 | 304 | * call with arrays allocated in an arena, the result will also be in the |
michael@0 | 305 | * arena. |
michael@0 | 306 | */ |
michael@0 | 307 | NSS_EXTERN NSSCertificate ** |
michael@0 | 308 | nssCertificateArray_Join |
michael@0 | 309 | ( |
michael@0 | 310 | NSSCertificate **certs1, |
michael@0 | 311 | NSSCertificate **certs2 |
michael@0 | 312 | ); |
michael@0 | 313 | |
michael@0 | 314 | /* nssCertificateArray_FindBestCertificate |
michael@0 | 315 | * |
michael@0 | 316 | * Use the usual { time, usage, policies } to find the best cert in the |
michael@0 | 317 | * array. |
michael@0 | 318 | */ |
michael@0 | 319 | NSS_EXTERN NSSCertificate * |
michael@0 | 320 | nssCertificateArray_FindBestCertificate |
michael@0 | 321 | ( |
michael@0 | 322 | NSSCertificate **certs, |
michael@0 | 323 | NSSTime *timeOpt, |
michael@0 | 324 | const NSSUsage *usage, |
michael@0 | 325 | NSSPolicies *policiesOpt |
michael@0 | 326 | ); |
michael@0 | 327 | |
michael@0 | 328 | /* nssCertificateArray_Traverse |
michael@0 | 329 | * |
michael@0 | 330 | * Do the callback for each cert, terminate the traversal if the callback |
michael@0 | 331 | * fails. |
michael@0 | 332 | */ |
michael@0 | 333 | NSS_EXTERN PRStatus |
michael@0 | 334 | nssCertificateArray_Traverse |
michael@0 | 335 | ( |
michael@0 | 336 | NSSCertificate **certs, |
michael@0 | 337 | PRStatus (* callback)(NSSCertificate *c, void *arg), |
michael@0 | 338 | void *arg |
michael@0 | 339 | ); |
michael@0 | 340 | |
michael@0 | 341 | NSS_EXTERN void |
michael@0 | 342 | nssCRLArray_Destroy |
michael@0 | 343 | ( |
michael@0 | 344 | NSSCRL **crls |
michael@0 | 345 | ); |
michael@0 | 346 | |
michael@0 | 347 | /* nssPKIObjectCollection |
michael@0 | 348 | * |
michael@0 | 349 | * This is a handy way to group objects together and perform operations |
michael@0 | 350 | * on them. It can also handle "proto-objects"-- references to |
michael@0 | 351 | * objects instances on tokens, where the actual object hasn't |
michael@0 | 352 | * been formed yet. |
michael@0 | 353 | * |
michael@0 | 354 | * nssCertificateCollection_Create |
michael@0 | 355 | * nssPrivateKeyCollection_Create |
michael@0 | 356 | * nssPublicKeyCollection_Create |
michael@0 | 357 | * |
michael@0 | 358 | * If this was a language that provided for inheritance, each type would |
michael@0 | 359 | * inherit all of the following methods. Instead, there is only one |
michael@0 | 360 | * type (nssPKIObjectCollection), shared among all. This may cause |
michael@0 | 361 | * confusion; an alternative would be to define all of the methods |
michael@0 | 362 | * for each subtype (nssCertificateCollection_Destroy, ...), but that doesn't |
michael@0 | 363 | * seem worth the code bloat.. It is left up to the caller to remember |
michael@0 | 364 | * what type of collection he/she is dealing with. |
michael@0 | 365 | * |
michael@0 | 366 | * nssPKIObjectCollection_Destroy |
michael@0 | 367 | * nssPKIObjectCollection_Count |
michael@0 | 368 | * nssPKIObjectCollection_AddObject |
michael@0 | 369 | * nssPKIObjectCollection_AddInstances |
michael@0 | 370 | * nssPKIObjectCollection_Traverse |
michael@0 | 371 | * |
michael@0 | 372 | * Back to type-specific methods. |
michael@0 | 373 | * |
michael@0 | 374 | * nssPKIObjectCollection_GetCertificates |
michael@0 | 375 | * nssPKIObjectCollection_GetCRLs |
michael@0 | 376 | * nssPKIObjectCollection_GetPrivateKeys |
michael@0 | 377 | * nssPKIObjectCollection_GetPublicKeys |
michael@0 | 378 | */ |
michael@0 | 379 | |
michael@0 | 380 | /* nssCertificateCollection_Create |
michael@0 | 381 | * |
michael@0 | 382 | * Create a collection of certificates in the specified trust domain. |
michael@0 | 383 | * Optionally provide a starting set of certs. |
michael@0 | 384 | */ |
michael@0 | 385 | NSS_EXTERN nssPKIObjectCollection * |
michael@0 | 386 | nssCertificateCollection_Create |
michael@0 | 387 | ( |
michael@0 | 388 | NSSTrustDomain *td, |
michael@0 | 389 | NSSCertificate **certsOpt |
michael@0 | 390 | ); |
michael@0 | 391 | |
michael@0 | 392 | /* nssCRLCollection_Create |
michael@0 | 393 | * |
michael@0 | 394 | * Create a collection of CRLs/KRLs in the specified trust domain. |
michael@0 | 395 | * Optionally provide a starting set of CRLs. |
michael@0 | 396 | */ |
michael@0 | 397 | NSS_EXTERN nssPKIObjectCollection * |
michael@0 | 398 | nssCRLCollection_Create |
michael@0 | 399 | ( |
michael@0 | 400 | NSSTrustDomain *td, |
michael@0 | 401 | NSSCRL **crlsOpt |
michael@0 | 402 | ); |
michael@0 | 403 | |
michael@0 | 404 | /* nssPrivateKeyCollection_Create |
michael@0 | 405 | * |
michael@0 | 406 | * Create a collection of private keys in the specified trust domain. |
michael@0 | 407 | * Optionally provide a starting set of keys. |
michael@0 | 408 | */ |
michael@0 | 409 | NSS_EXTERN nssPKIObjectCollection * |
michael@0 | 410 | nssPrivateKeyCollection_Create |
michael@0 | 411 | ( |
michael@0 | 412 | NSSTrustDomain *td, |
michael@0 | 413 | NSSPrivateKey **pvkOpt |
michael@0 | 414 | ); |
michael@0 | 415 | |
michael@0 | 416 | /* nssPublicKeyCollection_Create |
michael@0 | 417 | * |
michael@0 | 418 | * Create a collection of public keys in the specified trust domain. |
michael@0 | 419 | * Optionally provide a starting set of keys. |
michael@0 | 420 | */ |
michael@0 | 421 | NSS_EXTERN nssPKIObjectCollection * |
michael@0 | 422 | nssPublicKeyCollection_Create |
michael@0 | 423 | ( |
michael@0 | 424 | NSSTrustDomain *td, |
michael@0 | 425 | NSSPublicKey **pvkOpt |
michael@0 | 426 | ); |
michael@0 | 427 | |
michael@0 | 428 | /* nssPKIObjectCollection_Destroy |
michael@0 | 429 | */ |
michael@0 | 430 | NSS_EXTERN void |
michael@0 | 431 | nssPKIObjectCollection_Destroy |
michael@0 | 432 | ( |
michael@0 | 433 | nssPKIObjectCollection *collection |
michael@0 | 434 | ); |
michael@0 | 435 | |
michael@0 | 436 | /* nssPKIObjectCollection_Count |
michael@0 | 437 | */ |
michael@0 | 438 | NSS_EXTERN PRUint32 |
michael@0 | 439 | nssPKIObjectCollection_Count |
michael@0 | 440 | ( |
michael@0 | 441 | nssPKIObjectCollection *collection |
michael@0 | 442 | ); |
michael@0 | 443 | |
michael@0 | 444 | NSS_EXTERN PRStatus |
michael@0 | 445 | nssPKIObjectCollection_AddObject |
michael@0 | 446 | ( |
michael@0 | 447 | nssPKIObjectCollection *collection, |
michael@0 | 448 | nssPKIObject *object |
michael@0 | 449 | ); |
michael@0 | 450 | |
michael@0 | 451 | /* nssPKIObjectCollection_AddInstances |
michael@0 | 452 | * |
michael@0 | 453 | * Add a set of object instances to the collection. The instances |
michael@0 | 454 | * will be sorted into any existing certs/proto-certs that may be in |
michael@0 | 455 | * the collection. The instances will be absorbed by the collection, |
michael@0 | 456 | * the array should not be used after this call (except to free it). |
michael@0 | 457 | * |
michael@0 | 458 | * Failure means the collection is in an invalid state. |
michael@0 | 459 | * |
michael@0 | 460 | * numInstances = 0 means the array is NULL-terminated |
michael@0 | 461 | */ |
michael@0 | 462 | NSS_EXTERN PRStatus |
michael@0 | 463 | nssPKIObjectCollection_AddInstances |
michael@0 | 464 | ( |
michael@0 | 465 | nssPKIObjectCollection *collection, |
michael@0 | 466 | nssCryptokiObject **instances, |
michael@0 | 467 | PRUint32 numInstances |
michael@0 | 468 | ); |
michael@0 | 469 | |
michael@0 | 470 | /* nssPKIObjectCollection_Traverse |
michael@0 | 471 | */ |
michael@0 | 472 | NSS_EXTERN PRStatus |
michael@0 | 473 | nssPKIObjectCollection_Traverse |
michael@0 | 474 | ( |
michael@0 | 475 | nssPKIObjectCollection *collection, |
michael@0 | 476 | nssPKIObjectCallback *callback |
michael@0 | 477 | ); |
michael@0 | 478 | |
michael@0 | 479 | /* This function is being added for NSS 3.5. It corresponds to the function |
michael@0 | 480 | * nssToken_TraverseCertificates. The idea is to use the collection during |
michael@0 | 481 | * a traversal, creating certs each time a new instance is added for which |
michael@0 | 482 | * a cert does not already exist. |
michael@0 | 483 | */ |
michael@0 | 484 | NSS_EXTERN PRStatus |
michael@0 | 485 | nssPKIObjectCollection_AddInstanceAsObject |
michael@0 | 486 | ( |
michael@0 | 487 | nssPKIObjectCollection *collection, |
michael@0 | 488 | nssCryptokiObject *instance |
michael@0 | 489 | ); |
michael@0 | 490 | |
michael@0 | 491 | /* nssPKIObjectCollection_GetCertificates |
michael@0 | 492 | * |
michael@0 | 493 | * Get all of the certificates in the collection. |
michael@0 | 494 | */ |
michael@0 | 495 | NSS_EXTERN NSSCertificate ** |
michael@0 | 496 | nssPKIObjectCollection_GetCertificates |
michael@0 | 497 | ( |
michael@0 | 498 | nssPKIObjectCollection *collection, |
michael@0 | 499 | NSSCertificate **rvOpt, |
michael@0 | 500 | PRUint32 maximumOpt, |
michael@0 | 501 | NSSArena *arenaOpt |
michael@0 | 502 | ); |
michael@0 | 503 | |
michael@0 | 504 | NSS_EXTERN NSSCRL ** |
michael@0 | 505 | nssPKIObjectCollection_GetCRLs |
michael@0 | 506 | ( |
michael@0 | 507 | nssPKIObjectCollection *collection, |
michael@0 | 508 | NSSCRL **rvOpt, |
michael@0 | 509 | PRUint32 maximumOpt, |
michael@0 | 510 | NSSArena *arenaOpt |
michael@0 | 511 | ); |
michael@0 | 512 | |
michael@0 | 513 | NSS_EXTERN NSSPrivateKey ** |
michael@0 | 514 | nssPKIObjectCollection_GetPrivateKeys |
michael@0 | 515 | ( |
michael@0 | 516 | nssPKIObjectCollection *collection, |
michael@0 | 517 | NSSPrivateKey **rvOpt, |
michael@0 | 518 | PRUint32 maximumOpt, |
michael@0 | 519 | NSSArena *arenaOpt |
michael@0 | 520 | ); |
michael@0 | 521 | |
michael@0 | 522 | NSS_EXTERN NSSPublicKey ** |
michael@0 | 523 | nssPKIObjectCollection_GetPublicKeys |
michael@0 | 524 | ( |
michael@0 | 525 | nssPKIObjectCollection *collection, |
michael@0 | 526 | NSSPublicKey **rvOpt, |
michael@0 | 527 | PRUint32 maximumOpt, |
michael@0 | 528 | NSSArena *arenaOpt |
michael@0 | 529 | ); |
michael@0 | 530 | |
michael@0 | 531 | NSS_EXTERN NSSTime * |
michael@0 | 532 | NSSTime_Now |
michael@0 | 533 | ( |
michael@0 | 534 | NSSTime *timeOpt |
michael@0 | 535 | ); |
michael@0 | 536 | |
michael@0 | 537 | NSS_EXTERN NSSTime * |
michael@0 | 538 | NSSTime_SetPRTime |
michael@0 | 539 | ( |
michael@0 | 540 | NSSTime *timeOpt, |
michael@0 | 541 | PRTime prTime |
michael@0 | 542 | ); |
michael@0 | 543 | |
michael@0 | 544 | NSS_EXTERN PRTime |
michael@0 | 545 | NSSTime_GetPRTime |
michael@0 | 546 | ( |
michael@0 | 547 | NSSTime *time |
michael@0 | 548 | ); |
michael@0 | 549 | |
michael@0 | 550 | NSS_EXTERN nssHash * |
michael@0 | 551 | nssHash_CreateCertificate |
michael@0 | 552 | ( |
michael@0 | 553 | NSSArena *arenaOpt, |
michael@0 | 554 | PRUint32 numBuckets |
michael@0 | 555 | ); |
michael@0 | 556 | |
michael@0 | 557 | /* 3.4 Certificate cache routines */ |
michael@0 | 558 | |
michael@0 | 559 | NSS_EXTERN PRStatus |
michael@0 | 560 | nssTrustDomain_InitializeCache |
michael@0 | 561 | ( |
michael@0 | 562 | NSSTrustDomain *td, |
michael@0 | 563 | PRUint32 cacheSize |
michael@0 | 564 | ); |
michael@0 | 565 | |
michael@0 | 566 | NSS_EXTERN PRStatus |
michael@0 | 567 | nssTrustDomain_AddCertsToCache |
michael@0 | 568 | ( |
michael@0 | 569 | NSSTrustDomain *td, |
michael@0 | 570 | NSSCertificate **certs, |
michael@0 | 571 | PRUint32 numCerts |
michael@0 | 572 | ); |
michael@0 | 573 | |
michael@0 | 574 | NSS_EXTERN void |
michael@0 | 575 | nssTrustDomain_RemoveCertFromCacheLOCKED ( |
michael@0 | 576 | NSSTrustDomain *td, |
michael@0 | 577 | NSSCertificate *cert |
michael@0 | 578 | ); |
michael@0 | 579 | |
michael@0 | 580 | NSS_EXTERN void |
michael@0 | 581 | nssTrustDomain_LockCertCache ( |
michael@0 | 582 | NSSTrustDomain *td |
michael@0 | 583 | ); |
michael@0 | 584 | |
michael@0 | 585 | NSS_EXTERN void |
michael@0 | 586 | nssTrustDomain_UnlockCertCache ( |
michael@0 | 587 | NSSTrustDomain *td |
michael@0 | 588 | ); |
michael@0 | 589 | |
michael@0 | 590 | NSS_IMPLEMENT PRStatus |
michael@0 | 591 | nssTrustDomain_DestroyCache |
michael@0 | 592 | ( |
michael@0 | 593 | NSSTrustDomain *td |
michael@0 | 594 | ); |
michael@0 | 595 | |
michael@0 | 596 | /* |
michael@0 | 597 | * Remove all certs for the given token from the cache. This is |
michael@0 | 598 | * needed if the token is removed. |
michael@0 | 599 | */ |
michael@0 | 600 | NSS_EXTERN PRStatus |
michael@0 | 601 | nssTrustDomain_RemoveTokenCertsFromCache |
michael@0 | 602 | ( |
michael@0 | 603 | NSSTrustDomain *td, |
michael@0 | 604 | NSSToken *token |
michael@0 | 605 | ); |
michael@0 | 606 | |
michael@0 | 607 | NSS_EXTERN PRStatus |
michael@0 | 608 | nssTrustDomain_UpdateCachedTokenCerts |
michael@0 | 609 | ( |
michael@0 | 610 | NSSTrustDomain *td, |
michael@0 | 611 | NSSToken *token |
michael@0 | 612 | ); |
michael@0 | 613 | |
michael@0 | 614 | /* |
michael@0 | 615 | * Find all cached certs with this nickname (label). |
michael@0 | 616 | */ |
michael@0 | 617 | NSS_EXTERN NSSCertificate ** |
michael@0 | 618 | nssTrustDomain_GetCertsForNicknameFromCache |
michael@0 | 619 | ( |
michael@0 | 620 | NSSTrustDomain *td, |
michael@0 | 621 | const NSSUTF8 *nickname, |
michael@0 | 622 | nssList *certListOpt |
michael@0 | 623 | ); |
michael@0 | 624 | |
michael@0 | 625 | /* |
michael@0 | 626 | * Find all cached certs with this email address. |
michael@0 | 627 | */ |
michael@0 | 628 | NSS_EXTERN NSSCertificate ** |
michael@0 | 629 | nssTrustDomain_GetCertsForEmailAddressFromCache |
michael@0 | 630 | ( |
michael@0 | 631 | NSSTrustDomain *td, |
michael@0 | 632 | NSSASCII7 *email, |
michael@0 | 633 | nssList *certListOpt |
michael@0 | 634 | ); |
michael@0 | 635 | |
michael@0 | 636 | /* |
michael@0 | 637 | * Find all cached certs with this subject. |
michael@0 | 638 | */ |
michael@0 | 639 | NSS_EXTERN NSSCertificate ** |
michael@0 | 640 | nssTrustDomain_GetCertsForSubjectFromCache |
michael@0 | 641 | ( |
michael@0 | 642 | NSSTrustDomain *td, |
michael@0 | 643 | NSSDER *subject, |
michael@0 | 644 | nssList *certListOpt |
michael@0 | 645 | ); |
michael@0 | 646 | |
michael@0 | 647 | /* |
michael@0 | 648 | * Look for a specific cert in the cache. |
michael@0 | 649 | */ |
michael@0 | 650 | NSS_EXTERN NSSCertificate * |
michael@0 | 651 | nssTrustDomain_GetCertForIssuerAndSNFromCache |
michael@0 | 652 | ( |
michael@0 | 653 | NSSTrustDomain *td, |
michael@0 | 654 | NSSDER *issuer, |
michael@0 | 655 | NSSDER *serialNum |
michael@0 | 656 | ); |
michael@0 | 657 | |
michael@0 | 658 | /* |
michael@0 | 659 | * Look for a specific cert in the cache. |
michael@0 | 660 | */ |
michael@0 | 661 | NSS_EXTERN NSSCertificate * |
michael@0 | 662 | nssTrustDomain_GetCertByDERFromCache |
michael@0 | 663 | ( |
michael@0 | 664 | NSSTrustDomain *td, |
michael@0 | 665 | NSSDER *der |
michael@0 | 666 | ); |
michael@0 | 667 | |
michael@0 | 668 | /* Get all certs from the cache */ |
michael@0 | 669 | /* XXX this is being included to make some old-style calls word, not to |
michael@0 | 670 | * say we should keep it |
michael@0 | 671 | */ |
michael@0 | 672 | NSS_EXTERN NSSCertificate ** |
michael@0 | 673 | nssTrustDomain_GetCertsFromCache |
michael@0 | 674 | ( |
michael@0 | 675 | NSSTrustDomain *td, |
michael@0 | 676 | nssList *certListOpt |
michael@0 | 677 | ); |
michael@0 | 678 | |
michael@0 | 679 | NSS_EXTERN void |
michael@0 | 680 | nssTrustDomain_DumpCacheInfo |
michael@0 | 681 | ( |
michael@0 | 682 | NSSTrustDomain *td, |
michael@0 | 683 | void (* cert_dump_iter)(const void *, void *, void *), |
michael@0 | 684 | void *arg |
michael@0 | 685 | ); |
michael@0 | 686 | |
michael@0 | 687 | NSS_EXTERN void |
michael@0 | 688 | nssCertificateList_AddReferences |
michael@0 | 689 | ( |
michael@0 | 690 | nssList *certList |
michael@0 | 691 | ); |
michael@0 | 692 | |
michael@0 | 693 | PR_END_EXTERN_C |
michael@0 | 694 | |
michael@0 | 695 | #endif /* PKIM_H */ |