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 | #ifndef PKISTORE_H |
michael@0 | 6 | #define PKISTORE_H |
michael@0 | 7 | |
michael@0 | 8 | #ifndef NSSPKIT_H |
michael@0 | 9 | #include "nsspkit.h" |
michael@0 | 10 | #endif /* NSSPKIT_H */ |
michael@0 | 11 | |
michael@0 | 12 | #ifndef BASE_H |
michael@0 | 13 | #include "base.h" |
michael@0 | 14 | #endif /* BASE_H */ |
michael@0 | 15 | |
michael@0 | 16 | PR_BEGIN_EXTERN_C |
michael@0 | 17 | |
michael@0 | 18 | /* |
michael@0 | 19 | * PKI Stores |
michael@0 | 20 | * |
michael@0 | 21 | * This is a set of routines for managing local stores of PKI objects. |
michael@0 | 22 | * Currently, the only application is in crypto contexts, where the |
michael@0 | 23 | * certificate store is used. In the future, methods should be added |
michael@0 | 24 | * here for storing local references to keys. |
michael@0 | 25 | */ |
michael@0 | 26 | |
michael@0 | 27 | /* |
michael@0 | 28 | * nssCertificateStore |
michael@0 | 29 | * |
michael@0 | 30 | * Manages local store of certificate, trust, and S/MIME profile objects. |
michael@0 | 31 | * Within a crypto context, mappings of cert to trust and cert to S/MIME |
michael@0 | 32 | * profile are always 1-1. Therefore, it is reasonable to store all objects |
michael@0 | 33 | * in a single collection, indexed by the certificate. |
michael@0 | 34 | */ |
michael@0 | 35 | |
michael@0 | 36 | NSS_EXTERN nssCertificateStore * |
michael@0 | 37 | nssCertificateStore_Create |
michael@0 | 38 | ( |
michael@0 | 39 | NSSArena *arenaOpt |
michael@0 | 40 | ); |
michael@0 | 41 | |
michael@0 | 42 | NSS_EXTERN PRStatus |
michael@0 | 43 | nssCertificateStore_Destroy |
michael@0 | 44 | ( |
michael@0 | 45 | nssCertificateStore *store |
michael@0 | 46 | ); |
michael@0 | 47 | |
michael@0 | 48 | /* Atomic Find cert in store, or add this cert to the store. |
michael@0 | 49 | ** Ref counts properly maintained. |
michael@0 | 50 | */ |
michael@0 | 51 | NSS_EXTERN NSSCertificate * |
michael@0 | 52 | nssCertificateStore_FindOrAdd |
michael@0 | 53 | ( |
michael@0 | 54 | nssCertificateStore *store, |
michael@0 | 55 | NSSCertificate *c |
michael@0 | 56 | ); |
michael@0 | 57 | |
michael@0 | 58 | NSS_EXTERN void |
michael@0 | 59 | nssCertificateStore_RemoveCertLOCKED |
michael@0 | 60 | ( |
michael@0 | 61 | nssCertificateStore *store, |
michael@0 | 62 | NSSCertificate *cert |
michael@0 | 63 | ); |
michael@0 | 64 | |
michael@0 | 65 | struct nssCertificateStoreTraceStr { |
michael@0 | 66 | nssCertificateStore* store; |
michael@0 | 67 | PZLock* lock; |
michael@0 | 68 | PRBool locked; |
michael@0 | 69 | PRBool unlocked; |
michael@0 | 70 | }; |
michael@0 | 71 | |
michael@0 | 72 | typedef struct nssCertificateStoreTraceStr nssCertificateStoreTrace; |
michael@0 | 73 | |
michael@0 | 74 | NSS_EXTERN void |
michael@0 | 75 | nssCertificateStore_Lock ( |
michael@0 | 76 | nssCertificateStore *store, nssCertificateStoreTrace* out |
michael@0 | 77 | ); |
michael@0 | 78 | |
michael@0 | 79 | NSS_EXTERN void |
michael@0 | 80 | nssCertificateStore_Unlock ( |
michael@0 | 81 | nssCertificateStore *store, const nssCertificateStoreTrace* in, |
michael@0 | 82 | nssCertificateStoreTrace* out |
michael@0 | 83 | ); |
michael@0 | 84 | |
michael@0 | 85 | NSS_EXTERN NSSCertificate ** |
michael@0 | 86 | nssCertificateStore_FindCertificatesBySubject |
michael@0 | 87 | ( |
michael@0 | 88 | nssCertificateStore *store, |
michael@0 | 89 | NSSDER *subject, |
michael@0 | 90 | NSSCertificate *rvOpt[], |
michael@0 | 91 | PRUint32 maximumOpt, |
michael@0 | 92 | NSSArena *arenaOpt |
michael@0 | 93 | ); |
michael@0 | 94 | |
michael@0 | 95 | NSS_EXTERN NSSCertificate ** |
michael@0 | 96 | nssCertificateStore_FindCertificatesByNickname |
michael@0 | 97 | ( |
michael@0 | 98 | nssCertificateStore *store, |
michael@0 | 99 | const NSSUTF8 *nickname, |
michael@0 | 100 | NSSCertificate *rvOpt[], |
michael@0 | 101 | PRUint32 maximumOpt, |
michael@0 | 102 | NSSArena *arenaOpt |
michael@0 | 103 | ); |
michael@0 | 104 | |
michael@0 | 105 | NSS_EXTERN NSSCertificate ** |
michael@0 | 106 | nssCertificateStore_FindCertificatesByEmail |
michael@0 | 107 | ( |
michael@0 | 108 | nssCertificateStore *store, |
michael@0 | 109 | NSSASCII7 *email, |
michael@0 | 110 | NSSCertificate *rvOpt[], |
michael@0 | 111 | PRUint32 maximumOpt, |
michael@0 | 112 | NSSArena *arenaOpt |
michael@0 | 113 | ); |
michael@0 | 114 | |
michael@0 | 115 | NSS_EXTERN NSSCertificate * |
michael@0 | 116 | nssCertificateStore_FindCertificateByIssuerAndSerialNumber |
michael@0 | 117 | ( |
michael@0 | 118 | nssCertificateStore *store, |
michael@0 | 119 | NSSDER *issuer, |
michael@0 | 120 | NSSDER *serial |
michael@0 | 121 | ); |
michael@0 | 122 | |
michael@0 | 123 | NSS_EXTERN NSSCertificate * |
michael@0 | 124 | nssCertificateStore_FindCertificateByEncodedCertificate |
michael@0 | 125 | ( |
michael@0 | 126 | nssCertificateStore *store, |
michael@0 | 127 | NSSDER *encoding |
michael@0 | 128 | ); |
michael@0 | 129 | |
michael@0 | 130 | NSS_EXTERN PRStatus |
michael@0 | 131 | nssCertificateStore_AddTrust |
michael@0 | 132 | ( |
michael@0 | 133 | nssCertificateStore *store, |
michael@0 | 134 | NSSTrust *trust |
michael@0 | 135 | ); |
michael@0 | 136 | |
michael@0 | 137 | NSS_EXTERN NSSTrust * |
michael@0 | 138 | nssCertificateStore_FindTrustForCertificate |
michael@0 | 139 | ( |
michael@0 | 140 | nssCertificateStore *store, |
michael@0 | 141 | NSSCertificate *cert |
michael@0 | 142 | ); |
michael@0 | 143 | |
michael@0 | 144 | NSS_EXTERN PRStatus |
michael@0 | 145 | nssCertificateStore_AddSMIMEProfile |
michael@0 | 146 | ( |
michael@0 | 147 | nssCertificateStore *store, |
michael@0 | 148 | nssSMIMEProfile *profile |
michael@0 | 149 | ); |
michael@0 | 150 | |
michael@0 | 151 | NSS_EXTERN nssSMIMEProfile * |
michael@0 | 152 | nssCertificateStore_FindSMIMEProfileForCertificate |
michael@0 | 153 | ( |
michael@0 | 154 | nssCertificateStore *store, |
michael@0 | 155 | NSSCertificate *cert |
michael@0 | 156 | ); |
michael@0 | 157 | |
michael@0 | 158 | NSS_EXTERN void |
michael@0 | 159 | nssCertificateStore_DumpStoreInfo |
michael@0 | 160 | ( |
michael@0 | 161 | nssCertificateStore *store, |
michael@0 | 162 | void (* cert_dump_iter)(const void *, void *, void *), |
michael@0 | 163 | void *arg |
michael@0 | 164 | ); |
michael@0 | 165 | |
michael@0 | 166 | PR_END_EXTERN_C |
michael@0 | 167 | |
michael@0 | 168 | #endif /* PKISTORE_H */ |