| OLD | NEW |
| (Empty) |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| 4 | |
| 5 #ifndef PKIT_H | |
| 6 #define PKIT_H | |
| 7 | |
| 8 #ifdef DEBUG | |
| 9 static const char PKIT_CVS_ID[] = "@(#) $RCSfile: pkit.h,v $ $Revision: 1.20 $ $
Date: 2012/04/25 14:50:07 $"; | |
| 10 #endif /* DEBUG */ | |
| 11 | |
| 12 /* | |
| 13 * pkit.h | |
| 14 * | |
| 15 * This file contains definitions for the types of the top-level PKI objects. | |
| 16 */ | |
| 17 | |
| 18 #ifndef NSSBASET_H | |
| 19 #include "nssbaset.h" | |
| 20 #endif /* NSSBASET_H */ | |
| 21 | |
| 22 #ifndef BASET_H | |
| 23 #include "baset.h" | |
| 24 #endif /* BASET_H */ | |
| 25 | |
| 26 #include "certt.h" | |
| 27 #include "pkcs11t.h" | |
| 28 | |
| 29 #ifndef NSSPKIT_H | |
| 30 #include "nsspkit.h" | |
| 31 #endif /* NSSPKIT_H */ | |
| 32 | |
| 33 #ifndef NSSDEVT_H | |
| 34 #include "nssdevt.h" | |
| 35 #endif /* NSSDEVT_H */ | |
| 36 | |
| 37 #ifndef DEVT_H | |
| 38 #include "devt.h" | |
| 39 #endif /* DEVT_H */ | |
| 40 | |
| 41 #ifndef nssrwlkt_h__ | |
| 42 #include "nssrwlkt.h" | |
| 43 #endif /* nssrwlkt_h__ */ | |
| 44 | |
| 45 PR_BEGIN_EXTERN_C | |
| 46 | |
| 47 /* | |
| 48 * A note on ephemeral certs | |
| 49 * | |
| 50 * The key objects defined here can only be created on tokens, and can only | |
| 51 * exist on tokens. Therefore, any instance of a key object must have | |
| 52 * a corresponding cryptoki instance. OTOH, certificates created in | |
| 53 * crypto contexts need not be stored as session objects on the token. | |
| 54 * There are good performance reasons for not doing so. The certificate | |
| 55 * and trust objects have been defined with a cryptoContext field to | |
| 56 * allow for ephemeral certs, which may have a single instance in a crypto | |
| 57 * context along with any number (including zero) of cryptoki instances. | |
| 58 * Since contexts may not share objects, there can be only one context | |
| 59 * for each object. | |
| 60 */ | |
| 61 | |
| 62 typedef enum { | |
| 63 nssPKILock = 1, | |
| 64 nssPKIMonitor = 2 | |
| 65 } nssPKILockType; | |
| 66 | |
| 67 /* nssPKIObject | |
| 68 * | |
| 69 * This is the base object class, common to all PKI objects defined in | |
| 70 * nsspkit.h | |
| 71 */ | |
| 72 struct nssPKIObjectStr | |
| 73 { | |
| 74 /* The arena for all object memory */ | |
| 75 NSSArena *arena; | |
| 76 /* Atomically incremented/decremented reference counting */ | |
| 77 PRInt32 refCount; | |
| 78 /* lock protects the array of nssCryptokiInstance's of the object */ | |
| 79 union { | |
| 80 PZLock* lock; | |
| 81 PZMonitor *mlock; | |
| 82 } sync; | |
| 83 nssPKILockType lockType; | |
| 84 /* XXX with LRU cache, this cannot be guaranteed up-to-date. It cannot | |
| 85 * be compared against the update level of the trust domain, since it is | |
| 86 * also affected by import/export. Where is this array needed? | |
| 87 */ | |
| 88 nssCryptokiObject **instances; | |
| 89 PRUint32 numInstances; | |
| 90 /* The object must live in a trust domain */ | |
| 91 NSSTrustDomain *trustDomain; | |
| 92 /* The object may live in a crypto context */ | |
| 93 NSSCryptoContext *cryptoContext; | |
| 94 /* XXX added so temp certs can have nickname, think more ... */ | |
| 95 NSSUTF8 *tempName; | |
| 96 }; | |
| 97 | |
| 98 typedef struct nssDecodedCertStr nssDecodedCert; | |
| 99 | |
| 100 typedef struct nssCertificateStoreStr nssCertificateStore; | |
| 101 | |
| 102 /* How wide is the scope of this? */ | |
| 103 typedef struct nssSMIMEProfileStr nssSMIMEProfile; | |
| 104 | |
| 105 typedef struct nssPKIObjectStr nssPKIObject; | |
| 106 | |
| 107 struct NSSTrustStr | |
| 108 { | |
| 109 nssPKIObject object; | |
| 110 NSSCertificate *certificate; | |
| 111 nssTrustLevel serverAuth; | |
| 112 nssTrustLevel clientAuth; | |
| 113 nssTrustLevel emailProtection; | |
| 114 nssTrustLevel codeSigning; | |
| 115 PRBool stepUpApproved; | |
| 116 }; | |
| 117 | |
| 118 struct nssSMIMEProfileStr | |
| 119 { | |
| 120 nssPKIObject object; | |
| 121 NSSCertificate *certificate; | |
| 122 NSSASCII7 *email; | |
| 123 NSSDER *subject; | |
| 124 NSSItem *profileTime; | |
| 125 NSSItem *profileData; | |
| 126 }; | |
| 127 | |
| 128 struct NSSCertificateStr | |
| 129 { | |
| 130 nssPKIObject object; | |
| 131 NSSCertificateType type; | |
| 132 NSSItem id; | |
| 133 NSSBER encoding; | |
| 134 NSSDER issuer; | |
| 135 NSSDER subject; | |
| 136 NSSDER serial; | |
| 137 NSSASCII7 *email; | |
| 138 nssDecodedCert *decoding; | |
| 139 }; | |
| 140 | |
| 141 struct NSSPrivateKeyStr; | |
| 142 | |
| 143 struct NSSPublicKeyStr; | |
| 144 | |
| 145 struct NSSSymmetricKeyStr; | |
| 146 | |
| 147 typedef struct nssTDCertificateCacheStr nssTDCertificateCache; | |
| 148 | |
| 149 struct NSSTrustDomainStr { | |
| 150 PRInt32 refCount; | |
| 151 NSSArena *arena; | |
| 152 NSSCallback *defaultCallback; | |
| 153 nssList *tokenList; | |
| 154 nssListIterator *tokens; | |
| 155 nssTDCertificateCache *cache; | |
| 156 NSSRWLock *tokensLock; | |
| 157 void *spkDigestInfo; | |
| 158 CERTStatusConfig *statusConfig; | |
| 159 }; | |
| 160 | |
| 161 struct NSSCryptoContextStr | |
| 162 { | |
| 163 PRInt32 refCount; | |
| 164 NSSArena *arena; | |
| 165 NSSTrustDomain *td; | |
| 166 NSSToken *token; | |
| 167 nssSession *session; | |
| 168 nssCertificateStore *certStore; | |
| 169 }; | |
| 170 | |
| 171 struct NSSTimeStr { | |
| 172 PRTime prTime; | |
| 173 }; | |
| 174 | |
| 175 struct NSSCRLStr { | |
| 176 nssPKIObject object; | |
| 177 NSSDER encoding; | |
| 178 NSSUTF8 *url; | |
| 179 PRBool isKRL; | |
| 180 }; | |
| 181 | |
| 182 typedef struct NSSCRLStr NSSCRL; | |
| 183 | |
| 184 struct NSSPoliciesStr; | |
| 185 | |
| 186 struct NSSAlgorithmAndParametersStr; | |
| 187 | |
| 188 struct NSSPKIXCertificateStr; | |
| 189 | |
| 190 PR_END_EXTERN_C | |
| 191 | |
| 192 #endif /* PKIT_H */ | |
| OLD | NEW |