Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: nss/lib/certdb/certt.h

Issue 1843333003: Update NSPR to 4.12 and NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 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 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/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 /* 4 /*
5 * certt.h - public data structures for the certificate library 5 * certt.h - public data structures for the certificate library
6 */ 6 */
7 #ifndef _CERTT_H_ 7 #ifndef _CERTT_H_
8 #define _CERTT_H_ 8 #define _CERTT_H_
9 9
10 #include "prclist.h" 10 #include "prclist.h"
11 #include "pkcs11t.h" 11 #include "pkcs11t.h"
12 #include "seccomon.h" 12 #include "seccomon.h"
13 #include "secmodt.h" 13 #include "secmodt.h"
14 #include "secoidt.h" 14 #include "secoidt.h"
15 #include "plarena.h" 15 #include "plarena.h"
16 #include "prcvar.h" 16 #include "prcvar.h"
17 #include "nssilock.h" 17 #include "nssilock.h"
18 #include "prio.h" 18 #include "prio.h"
19 #include "prmon.h" 19 #include "prmon.h"
20 20
21 /* Stan data types */ 21 /* Stan data types */
22 struct NSSCertificateStr; 22 struct NSSCertificateStr;
23 struct NSSTrustDomainStr; 23 struct NSSTrustDomainStr;
24 24
25 /* Non-opaque objects */ 25 /* Non-opaque objects */
26 typedef struct CERTAVAStr CERTAVA; 26 typedef struct CERTAVAStr CERTAVA;
27 typedef struct CERTAttributeStr CERTAttribute; 27 typedef struct CERTAttributeStr CERTAttribute;
28 typedef struct CERTAuthInfoAccessStr CERTAuthInfoAccess; 28 typedef struct CERTAuthInfoAccessStr CERTAuthInfoAccess;
29 typedef struct CERTAuthKeyIDStr CERTAuthKeyID; 29 typedef struct CERTAuthKeyIDStr CERTAuthKeyID;
30 typedef struct CERTBasicConstraintsStr CERTBasicConstraints; 30 typedef struct CERTBasicConstraintsStr CERTBasicConstraints;
31 typedef struct NSSTrustDomainStr CERTCertDBHandle; 31 typedef struct NSSTrustDomainStr CERTCertDBHandle;
32 typedef struct CERTCertExtensionStr CERTCertExtension; 32 typedef struct CERTCertExtensionStr CERTCertExtension;
33 typedef struct CERTCertKeyStr CERTCertKey; 33 typedef struct CERTCertKeyStr CERTCertKey;
34 typedef struct CERTCertListStr CERTCertList; 34 typedef struct CERTCertListStr CERTCertList;
35 typedef struct CERTCertListNodeStr CERTCertListNode; 35 typedef struct CERTCertListNodeStr CERTCertListNode;
36 typedef struct CERTCertNicknamesStr CERTCertNicknames; 36 typedef struct CERTCertNicknamesStr CERTCertNicknames;
37 typedef struct CERTCertTrustStr CERTCertTrust; 37 typedef struct CERTCertTrustStr CERTCertTrust;
38 typedef struct CERTCertificateStr CERTCertificate; 38 typedef struct CERTCertificateStr CERTCertificate;
39 typedef struct CERTCertificateListStr CERTCertificateList; 39 typedef struct CERTCertificateListStr CERTCertificateList;
40 typedef struct CERTCertificateRequestStr CERTCertificateRequest; 40 typedef struct CERTCertificateRequestStr CERTCertificateRequest;
41 typedef struct CERTCrlStr CERTCrl; 41 typedef struct CERTCrlStr CERTCrl;
42 typedef struct CERTCrlDistributionPointsStr CERTCrlDistributionPoints; 42 typedef struct CERTCrlDistributionPointsStr CERTCrlDistributionPoints;
43 typedef struct CERTCrlEntryStr CERTCrlEntry; 43 typedef struct CERTCrlEntryStr CERTCrlEntry;
44 typedef struct CERTCrlHeadNodeStr CERTCrlHeadNode; 44 typedef struct CERTCrlHeadNodeStr CERTCrlHeadNode;
45 typedef struct CERTCrlKeyStr CERTCrlKey; 45 typedef struct CERTCrlKeyStr CERTCrlKey;
46 typedef struct CERTCrlNodeStr CERTCrlNode; 46 typedef struct CERTCrlNodeStr CERTCrlNode;
47 typedef struct CERTDERCertsStr CERTDERCerts; 47 typedef struct CERTDERCertsStr CERTDERCerts;
48 typedef struct CERTDistNamesStr CERTDistNames; 48 typedef struct CERTDistNamesStr CERTDistNames;
49 typedef struct CERTGeneralNameStr CERTGeneralName; 49 typedef struct CERTGeneralNameStr CERTGeneralName;
50 typedef struct CERTGeneralNameListStr CERTGeneralNameList; 50 typedef struct CERTGeneralNameListStr CERTGeneralNameList;
51 typedef struct CERTIssuerAndSNStr CERTIssuerAndSN; 51 typedef struct CERTIssuerAndSNStr CERTIssuerAndSN;
52 typedef struct CERTNameStr CERTName; 52 typedef struct CERTNameStr CERTName;
53 typedef struct CERTNameConstraintStr CERTNameConstraint; 53 typedef struct CERTNameConstraintStr CERTNameConstraint;
54 typedef struct CERTNameConstraintsStr CERTNameConstraints; 54 typedef struct CERTNameConstraintsStr CERTNameConstraints;
55 typedef struct CERTOKDomainNameStr CERTOKDomainName; 55 typedef struct CERTOKDomainNameStr CERTOKDomainName;
56 typedef struct CERTPrivKeyUsagePeriodStr CERTPrivKeyUsagePeriod; 56 typedef struct CERTPrivKeyUsagePeriodStr CERTPrivKeyUsagePeriod;
57 typedef struct CERTPublicKeyAndChallengeStr CERTPublicKeyAndChallenge; 57 typedef struct CERTPublicKeyAndChallengeStr CERTPublicKeyAndChallenge;
58 typedef struct CERTRDNStr CERTRDN; 58 typedef struct CERTRDNStr CERTRDN;
59 typedef struct CERTSignedCrlStr CERTSignedCrl; 59 typedef struct CERTSignedCrlStr CERTSignedCrl;
60 typedef struct CERTSignedDataStr CERTSignedData; 60 typedef struct CERTSignedDataStr CERTSignedData;
61 typedef struct CERTStatusConfigStr CERTStatusConfig; 61 typedef struct CERTStatusConfigStr CERTStatusConfig;
62 typedef struct CERTSubjectListStr CERTSubjectList; 62 typedef struct CERTSubjectListStr CERTSubjectList;
63 typedef struct CERTSubjectNodeStr CERTSubjectNode; 63 typedef struct CERTSubjectNodeStr CERTSubjectNode;
64 typedef struct CERTSubjectPublicKeyInfoStr CERTSubjectPublicKeyInfo; 64 typedef struct CERTSubjectPublicKeyInfoStr CERTSubjectPublicKeyInfo;
65 typedef struct CERTValidityStr CERTValidity; 65 typedef struct CERTValidityStr CERTValidity;
66 typedef struct CERTVerifyLogStr CERTVerifyLog; 66 typedef struct CERTVerifyLogStr CERTVerifyLog;
67 typedef struct CERTVerifyLogNodeStr CERTVerifyLogNode; 67 typedef struct CERTVerifyLogNodeStr CERTVerifyLogNode;
68 typedef struct CRLDistributionPointStr CRLDistributionPoint; 68 typedef struct CRLDistributionPointStr CRLDistributionPoint;
69 69
70 /* CRL extensions type */ 70 /* CRL extensions type */
71 typedef unsigned long CERTCrlNumber; 71 typedef unsigned long CERTCrlNumber;
72 72
73 /* 73 /*
74 ** An X.500 AVA object 74 ** An X.500 AVA object
75 */ 75 */
76 struct CERTAVAStr { 76 struct CERTAVAStr {
77 SECItem type; 77 SECItem type;
78 SECItem value; 78 SECItem value;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 /* 143 /*
144 * defined the types of trust that exist 144 * defined the types of trust that exist
145 */ 145 */
146 typedef enum SECTrustTypeEnum { 146 typedef enum SECTrustTypeEnum {
147 trustSSL = 0, 147 trustSSL = 0,
148 trustEmail = 1, 148 trustEmail = 1,
149 trustObjectSigning = 2, 149 trustObjectSigning = 2,
150 trustTypeNone = 3 150 trustTypeNone = 3
151 } SECTrustType; 151 } SECTrustType;
152 152
153 #define SEC_GET_TRUST_FLAGS(trust,type) \ 153 #define SEC_GET_TRUST_FLAGS(trust, type) \
154 (((type)==trustSSL)?((trust)->sslFlags): \ 154 (((type) == trustSSL) \
155 » (((type)==trustEmail)?((trust)->emailFlags): \ 155 ? ((trust)->sslFlags) \
156 » (((type)==trustObjectSigning)?((trust)->objectSigningFlags):0))) 156 : (((type) == trustEmail) ? ((trust)->emailFlags) \
157 : (((type) == trustObjectSigning) \
158 ? ((trust)->objectSigningFlags) \
159 : 0)))
157 160
158 /* 161 /*
159 ** An X.509.3 certificate extension 162 ** An X.509.3 certificate extension
160 */ 163 */
161 struct CERTCertExtensionStr { 164 struct CERTCertExtensionStr {
162 SECItem id; 165 SECItem id;
163 SECItem critical; 166 SECItem critical;
164 SECItem value; 167 SECItem value;
165 }; 168 };
166 169
(...skipping 21 matching lines...) Expand all
188 * lifetime as the cert. This is all stuff that hangs off of the cert 191 * lifetime as the cert. This is all stuff that hangs off of the cert
189 * structure, and is all freed at the same time. It is used when the 192 * structure, and is all freed at the same time. It is used when the
190 * cert is decoded, destroyed, and at some times when it changes 193 * cert is decoded, destroyed, and at some times when it changes
191 * state 194 * state
192 */ 195 */
193 PLArenaPool *arena; 196 PLArenaPool *arena;
194 197
195 /* The following fields are static after the cert has been decoded */ 198 /* The following fields are static after the cert has been decoded */
196 char *subjectName; 199 char *subjectName;
197 char *issuerName; 200 char *issuerName;
198 CERTSignedData signatureWrap;» /* XXX */ 201 CERTSignedData signatureWrap; /* XXX */
199 SECItem derCert;» » » /* original DER for the cert */ 202 SECItem derCert; /* original DER for the cert */
200 SECItem derIssuer;» » » /* DER for issuer name */ 203 SECItem derIssuer; /* DER for issuer name */
201 SECItem derSubject;»» » /* DER for subject name */ 204 SECItem derSubject; /* DER for subject name */
202 SECItem derPublicKey;» » /* DER for the public key */ 205 SECItem derPublicKey; /* DER for the public key */
203 SECItem certKey;» » » /* database key for this cert */ 206 SECItem certKey; /* database key for this cert */
204 SECItem version; 207 SECItem version;
205 SECItem serialNumber; 208 SECItem serialNumber;
206 SECAlgorithmID signature; 209 SECAlgorithmID signature;
207 CERTName issuer; 210 CERTName issuer;
208 CERTValidity validity; 211 CERTValidity validity;
209 CERTName subject; 212 CERTName subject;
210 CERTSubjectPublicKeyInfo subjectPublicKeyInfo; 213 CERTSubjectPublicKeyInfo subjectPublicKeyInfo;
211 SECItem issuerID; 214 SECItem issuerID;
212 SECItem subjectID; 215 SECItem subjectID;
213 CERTCertExtension **extensions; 216 CERTCertExtension **extensions;
214 char *emailAddr; 217 char *emailAddr;
215 CERTCertDBHandle *dbhandle; 218 CERTCertDBHandle *dbhandle;
216 SECItem subjectKeyID;» /* x509v3 subject key identifier */ 219 SECItem subjectKeyID; /* x509v3 subject key identifier */
217 PRBool keyIDGenerated;» /* was the keyid generated? */ 220 PRBool keyIDGenerated; /* was the keyid generated? */
218 unsigned int keyUsage;» /* what uses are allowed for this cert */ 221 unsigned int keyUsage; /* what uses are allowed for this cert */
219 unsigned int rawKeyUsage;» /* value of the key usage extension */ 222 unsigned int rawKeyUsage; /* value of the key usage extension */
220 PRBool keyUsagePresent;» /* was the key usage extension present */ 223 PRBool keyUsagePresent; /* was the key usage extension present */
221 PRUint32 nsCertType;» /* value of the ns cert type extension */ 224 PRUint32 nsCertType; /* value of the ns cert type extension */
222 » » » » /* must be 32-bit for PR_ATOMIC_SET */ 225 /* must be 32-bit for PR_ATOMIC_SET */
223 226
224 /* these values can be set by the application to bypass certain checks 227 /* these values can be set by the application to bypass certain checks
225 * or to keep the cert in memory for an entire session. 228 * or to keep the cert in memory for an entire session.
226 * XXX - need an api to set these 229 * XXX - need an api to set these
227 */ 230 */
228 PRBool keepSession;»» » /* keep this cert for entire session*/ 231 PRBool keepSession; /* keep this cert for entire session*/
229 PRBool timeOK;» » » /* is the bad validity time ok? */ 232 PRBool timeOK; /* is the bad validity time ok? */
230 CERTOKDomainName *domainOK;»» /* these domain names are ok */ 233 CERTOKDomainName *domainOK; /* these domain names are ok */
231 234
232 /* 235 /*
233 * these values can change when the cert changes state. These state 236 * these values can change when the cert changes state. These state
234 * changes include transitions from temp to perm or vice-versa, and 237 * changes include transitions from temp to perm or vice-versa, and
235 * changes of trust flags 238 * changes of trust flags
236 */ 239 */
237 PRBool isperm; 240 PRBool isperm;
238 PRBool istemp; 241 PRBool istemp;
239 char *nickname; 242 char *nickname;
240 char *dbnickname; 243 char *dbnickname;
241 struct NSSCertificateStr *nssCertificate;» /* This is Stan stuff. */ 244 struct NSSCertificateStr *nssCertificate; /* This is Stan stuff. */
242 CERTCertTrust *trust; 245 CERTCertTrust *trust;
243 246
244 /* the reference count is modified whenever someone looks up, dups 247 /* the reference count is modified whenever someone looks up, dups
245 * or destroys a certificate 248 * or destroys a certificate
246 */ 249 */
247 int referenceCount; 250 int referenceCount;
248 251
249 /* The subject list is a list of all certs with the same subject name. 252 /* The subject list is a list of all certs with the same subject name.
250 * It can be modified any time a cert is added or deleted from either 253 * It can be modified any time a cert is added or deleted from either
251 * the in-memory(temporary) or on-disk(permanent) database. 254 * the in-memory(temporary) or on-disk(permanent) database.
252 */ 255 */
253 CERTSubjectList *subjectList; 256 CERTSubjectList *subjectList;
254 257
255 /* these belong in the static section, but are here to maintain 258 /* these belong in the static section, but are here to maintain
256 * the structure's integrity 259 * the structure's integrity
257 */ 260 */
258 CERTAuthKeyID * authKeyID; /* x509v3 authority key identifier */ 261 CERTAuthKeyID *authKeyID; /* x509v3 authority key identifier */
259 PRBool isRoot; /* cert is the end of a chain */ 262 PRBool isRoot; /* cert is the end of a chain */
260 263
261 /* these fields are used by client GUI code to keep track of ssl sockets 264 /* these fields are used by client GUI code to keep track of ssl sockets
262 * that are blocked waiting on GUI feedback related to this cert. 265 * that are blocked waiting on GUI feedback related to this cert.
263 * XXX - these should be moved into some sort of application specific 266 * XXX - these should be moved into some sort of application specific
264 * data structure. They are only used by the browser right now. 267 * data structure. They are only used by the browser right now.
265 */ 268 */
266 union { 269 union {
267 void* apointer; /* was struct SECSocketNode* authsocketlist */ 270 void *apointer; /* was struct SECSocketNode* authsocketlist */
268 struct { 271 struct {
269 unsigned int hasUnsupportedCriticalExt :1; 272 unsigned int hasUnsupportedCriticalExt : 1;
270 /* add any new option bits needed here */ 273 /* add any new option bits needed here */
271 } bits; 274 } bits;
272 } options; 275 } options;
273 int series; /* was int authsocketcount; record the series of the pkcs11ID */ 276 int series; /* was int authsocketcount; record the series of the pkcs11ID */
274 277
275 /* This is PKCS #11 stuff. */ 278 /* This is PKCS #11 stuff. */
276 PK11SlotInfo *slot;»» /*if this cert came of a token, which is it*/ 279 PK11SlotInfo *slot; /*if this cert came of a token, which is it*/
277 CK_OBJECT_HANDLE pkcs11ID;» /*and which object on that token is it */ 280 CK_OBJECT_HANDLE pkcs11ID; /*and which object on that token is it */
278 PRBool ownSlot;» » /*true if the cert owns the slot reference */ 281 PRBool ownSlot; /*true if the cert owns the slot reference */
279 }; 282 };
280 #define SEC_CERTIFICATE_VERSION_1» » 0» /* default created */ 283 #define SEC_CERTIFICATE_VERSION_1 0 /* default created */
281 #define SEC_CERTIFICATE_VERSION_2» » 1» /* v2 */ 284 #define SEC_CERTIFICATE_VERSION_2 1 /* v2 */
282 #define SEC_CERTIFICATE_VERSION_3» » 2» /* v3 extensions */ 285 #define SEC_CERTIFICATE_VERSION_3 2 /* v3 extensions */
283 286
284 #define SEC_CRL_VERSION_1» » 0» /* default */ 287 #define SEC_CRL_VERSION_1 0 /* default */
285 #define SEC_CRL_VERSION_2» » 1» /* v2 extensions */ 288 #define SEC_CRL_VERSION_2 1 /* v2 extensions */
286 289
287 /* 290 /*
288 * used to identify class of cert in mime stream code 291 * used to identify class of cert in mime stream code
289 */ 292 */
290 #define SEC_CERT_CLASS_CA» 1 293 #define SEC_CERT_CLASS_CA 1
291 #define SEC_CERT_CLASS_SERVER» 2 294 #define SEC_CERT_CLASS_SERVER 2
292 #define SEC_CERT_CLASS_USER» 3 295 #define SEC_CERT_CLASS_USER 3
293 #define SEC_CERT_CLASS_EMAIL» 4 296 #define SEC_CERT_CLASS_EMAIL 4
294 297
295 struct CERTDERCertsStr { 298 struct CERTDERCertsStr {
296 PLArenaPool *arena; 299 PLArenaPool *arena;
297 int numcerts; 300 int numcerts;
298 SECItem *rawCerts; 301 SECItem *rawCerts;
299 }; 302 };
300 303
301 /* 304 /*
302 ** A PKCS ? Attribute 305 ** A PKCS ? Attribute
303 ** XXX this is duplicated through out the code, it *should* be moved 306 ** XXX this is duplicated through out the code, it *should* be moved
304 ** to a central location. Where would be appropriate? 307 ** to a central location. Where would be appropriate?
305 */ 308 */
306 struct CERTAttributeStr { 309 struct CERTAttributeStr {
307 SECItem attrType; 310 SECItem attrType;
308 SECItem **attrValue; 311 SECItem **attrValue;
309 }; 312 };
310 313
311 /* 314 /*
312 ** A PKCS#10 certificate-request object (the unsigned form) 315 ** A PKCS#10 certificate-request object (the unsigned form)
313 */ 316 */
314 struct CERTCertificateRequestStr { 317 struct CERTCertificateRequestStr {
315 PLArenaPool *arena; 318 PLArenaPool *arena;
316 SECItem version; 319 SECItem version;
317 CERTName subject; 320 CERTName subject;
318 CERTSubjectPublicKeyInfo subjectPublicKeyInfo; 321 CERTSubjectPublicKeyInfo subjectPublicKeyInfo;
319 CERTAttribute **attributes; 322 CERTAttribute **attributes;
320 }; 323 };
321 #define SEC_CERTIFICATE_REQUEST_VERSION»» 0» /* what we *create* */ 324 #define SEC_CERTIFICATE_REQUEST_VERSION 0 /* what we *create* */
322
323 325
324 /* 326 /*
325 ** A certificate list object. 327 ** A certificate list object.
326 */ 328 */
327 struct CERTCertificateListStr { 329 struct CERTCertificateListStr {
328 SECItem *certs; 330 SECItem *certs;
329 int len;» » » » » /* number of certs */ 331 int len; /* number of certs */
330 PLArenaPool *arena; 332 PLArenaPool *arena;
331 }; 333 };
332 334
333 struct CERTCertListNodeStr { 335 struct CERTCertListNodeStr {
334 PRCList links; 336 PRCList links;
335 CERTCertificate *cert; 337 CERTCertificate *cert;
336 void *appData; 338 void *appData;
337 }; 339 };
338 340
339 struct CERTCertListStr { 341 struct CERTCertListStr {
340 PRCList list; 342 PRCList list;
341 PLArenaPool *arena; 343 PLArenaPool *arena;
342 }; 344 };
343 345
344 #define CERT_LIST_HEAD(l) ((CERTCertListNode *)PR_LIST_HEAD(&l->list)) 346 #define CERT_LIST_HEAD(l) ((CERTCertListNode *)PR_LIST_HEAD(&l->list))
345 #define CERT_LIST_TAIL(l) ((CERTCertListNode *)PR_LIST_TAIL(&l->list)) 347 #define CERT_LIST_TAIL(l) ((CERTCertListNode *)PR_LIST_TAIL(&l->list))
346 #define CERT_LIST_NEXT(n) ((CERTCertListNode *)n->links.next) 348 #define CERT_LIST_NEXT(n) ((CERTCertListNode *)n->links.next)
347 #define CERT_LIST_END(n,l) (((void *)n) == ((void *)&l->list)) 349 #define CERT_LIST_END(n, l) (((void *)n) == ((void *)&l->list))
348 #define CERT_LIST_EMPTY(l) CERT_LIST_END(CERT_LIST_HEAD(l), l) 350 #define CERT_LIST_EMPTY(l) CERT_LIST_END(CERT_LIST_HEAD(l), l)
349 351
350 struct CERTCrlEntryStr { 352 struct CERTCrlEntryStr {
351 SECItem serialNumber; 353 SECItem serialNumber;
352 SECItem revocationDate; 354 SECItem revocationDate;
353 CERTCertExtension **extensions; 355 CERTCertExtension **extensions;
354 }; 356 };
355 357
356 struct CERTCrlStr { 358 struct CERTCrlStr {
357 PLArenaPool *arena; 359 PLArenaPool *arena;
358 SECItem version; 360 SECItem version;
359 SECAlgorithmID signatureAlg; 361 SECAlgorithmID signatureAlg;
360 SECItem derName; 362 SECItem derName;
361 CERTName name; 363 CERTName name;
362 SECItem lastUpdate; 364 SECItem lastUpdate;
363 SECItem nextUpdate;»» » » /* optional for x.509 CRL */ 365 SECItem nextUpdate; /* optional for x.509 CRL */
364 CERTCrlEntry **entries; 366 CERTCrlEntry **entries;
365 CERTCertExtension **extensions; 367 CERTCertExtension **extensions;
366 /* can't add anything there for binary backwards compatibility reasons */ 368 /* can't add anything there for binary backwards compatibility reasons */
367 }; 369 };
368 370
369 struct CERTCrlKeyStr { 371 struct CERTCrlKeyStr {
370 SECItem derName; 372 SECItem derName;
371 SECItem dummy;» » » /* The decoder can not skip a primitive, 373 SECItem dummy; /* The decoder can not skip a primitive,
372 » » » » » this serves as a place holder for the 374 this serves as a place holder for the
373 » » » » » decoder to finish its task only 375 decoder to finish its task only
374 » » » » » */ 376 */
375 }; 377 };
376 378
377 struct CERTSignedCrlStr { 379 struct CERTSignedCrlStr {
378 PLArenaPool *arena; 380 PLArenaPool *arena;
379 CERTCrl crl; 381 CERTCrl crl;
380 void *reserved1; 382 void *reserved1;
381 PRBool reserved2; 383 PRBool reserved2;
382 PRBool isperm; 384 PRBool isperm;
383 PRBool istemp; 385 PRBool istemp;
384 int referenceCount; 386 int referenceCount;
385 CERTCertDBHandle *dbhandle; 387 CERTCertDBHandle *dbhandle;
386 CERTSignedData signatureWrap;» /* XXX */ 388 CERTSignedData signatureWrap; /* XXX */
387 char *url; 389 char *url;
388 SECItem *derCrl; 390 SECItem *derCrl;
389 PK11SlotInfo *slot; 391 PK11SlotInfo *slot;
390 CK_OBJECT_HANDLE pkcs11ID; 392 CK_OBJECT_HANDLE pkcs11ID;
391 void* opaque; /* do not touch */ 393 void *opaque; /* do not touch */
392 }; 394 };
393 395
394
395 struct CERTCrlHeadNodeStr { 396 struct CERTCrlHeadNodeStr {
396 PLArenaPool *arena; 397 PLArenaPool *arena;
397 CERTCertDBHandle *dbhandle; 398 CERTCertDBHandle *dbhandle;
398 CERTCrlNode *first; 399 CERTCrlNode *first;
399 CERTCrlNode *last; 400 CERTCrlNode *last;
400 }; 401 };
401 402
402
403 struct CERTCrlNodeStr { 403 struct CERTCrlNodeStr {
404 CERTCrlNode *next; 404 CERTCrlNode *next;
405 int » type; 405 int type;
406 CERTSignedCrl *crl; 406 CERTSignedCrl *crl;
407 }; 407 };
408 408
409
410 /* 409 /*
411 * Array of X.500 Distinguished Names 410 * Array of X.500 Distinguished Names
412 */ 411 */
413 struct CERTDistNamesStr { 412 struct CERTDistNamesStr {
414 PLArenaPool *arena; 413 PLArenaPool *arena;
415 int nnames; 414 int nnames;
416 SECItem *names; 415 SECItem *names;
417 void *head; /* private */ 416 void *head; /* private */
418 }; 417 };
419 418
419 #define NS_CERT_TYPE_SSL_CLIENT (0x80) /* bit 0 */
420 #define NS_CERT_TYPE_SSL_SERVER (0x40) /* bit 1 */
421 #define NS_CERT_TYPE_EMAIL (0x20) /* bit 2 */
422 #define NS_CERT_TYPE_OBJECT_SIGNING (0x10) /* bit 3 */
423 #define NS_CERT_TYPE_RESERVED (0x08) /* bit 4 */
424 #define NS_CERT_TYPE_SSL_CA (0x04) /* bit 5 */
425 #define NS_CERT_TYPE_EMAIL_CA (0x02) /* bit 6 */
426 #define NS_CERT_TYPE_OBJECT_SIGNING_CA (0x01) /* bit 7 */
420 427
421 #define NS_CERT_TYPE_SSL_CLIENT»» (0x80)» /* bit 0 */ 428 #define EXT_KEY_USAGE_TIME_STAMP (0x8000)
422 #define NS_CERT_TYPE_SSL_SERVER»» (0x40) /* bit 1 */ 429 #define EXT_KEY_USAGE_STATUS_RESPONDER (0x4000)
423 #define NS_CERT_TYPE_EMAIL» » (0x20) /* bit 2 */
424 #define NS_CERT_TYPE_OBJECT_SIGNING» (0x10) /* bit 3 */
425 #define NS_CERT_TYPE_RESERVED» » (0x08) /* bit 4 */
426 #define NS_CERT_TYPE_SSL_CA» » (0x04) /* bit 5 */
427 #define NS_CERT_TYPE_EMAIL_CA» » (0x02) /* bit 6 */
428 #define NS_CERT_TYPE_OBJECT_SIGNING_CA» (0x01) /* bit 7 */
429 430
430 #define EXT_KEY_USAGE_TIME_STAMP (0x8000) 431 #define NS_CERT_TYPE_APP \
431 #define EXT_KEY_USAGE_STATUS_RESPONDER» (0x4000) 432 (NS_CERT_TYPE_SSL_CLIENT | NS_CERT_TYPE_SSL_SERVER | NS_CERT_TYPE_EMAIL | \
433 NS_CERT_TYPE_OBJECT_SIGNING)
432 434
433 #define NS_CERT_TYPE_APP ( NS_CERT_TYPE_SSL_CLIENT | \ 435 #define NS_CERT_TYPE_CA \
434 » » » NS_CERT_TYPE_SSL_SERVER | \ 436 (NS_CERT_TYPE_SSL_CA | NS_CERT_TYPE_EMAIL_CA | \
435 » » » NS_CERT_TYPE_EMAIL | \ 437 NS_CERT_TYPE_OBJECT_SIGNING_CA | EXT_KEY_USAGE_STATUS_RESPONDER)
436 » » » NS_CERT_TYPE_OBJECT_SIGNING )
437
438 #define NS_CERT_TYPE_CA ( NS_CERT_TYPE_SSL_CA | \
439 » » » NS_CERT_TYPE_EMAIL_CA | \
440 » » » NS_CERT_TYPE_OBJECT_SIGNING_CA | \
441 » » » EXT_KEY_USAGE_STATUS_RESPONDER )
442 typedef enum SECCertUsageEnum { 438 typedef enum SECCertUsageEnum {
443 certUsageSSLClient = 0, 439 certUsageSSLClient = 0,
444 certUsageSSLServer = 1, 440 certUsageSSLServer = 1,
445 certUsageSSLServerWithStepUp = 2, 441 certUsageSSLServerWithStepUp = 2,
446 certUsageSSLCA = 3, 442 certUsageSSLCA = 3,
447 certUsageEmailSigner = 4, 443 certUsageEmailSigner = 4,
448 certUsageEmailRecipient = 5, 444 certUsageEmailRecipient = 5,
449 certUsageObjectSigner = 6, 445 certUsageObjectSigner = 6,
450 certUsageUserCertImport = 7, 446 certUsageUserCertImport = 7,
451 certUsageVerifyCA = 8, 447 certUsageVerifyCA = 8,
452 certUsageProtectedObjectSigner = 9, 448 certUsageProtectedObjectSigner = 9,
453 certUsageStatusResponder = 10, 449 certUsageStatusResponder = 10,
454 certUsageAnyCA = 11 450 certUsageAnyCA = 11
455 } SECCertUsage; 451 } SECCertUsage;
456 452
457 typedef PRInt64 SECCertificateUsage; 453 typedef PRInt64 SECCertificateUsage;
458 454
459 #define certificateUsageCheckAllUsages (0x0000) 455 #define certificateUsageCheckAllUsages (0x0000)
460 #define certificateUsageSSLClient (0x0001) 456 #define certificateUsageSSLClient (0x0001)
461 #define certificateUsageSSLServer (0x0002) 457 #define certificateUsageSSLServer (0x0002)
462 #define certificateUsageSSLServerWithStepUp (0x0004) 458 #define certificateUsageSSLServerWithStepUp (0x0004)
463 #define certificateUsageSSLCA (0x0008) 459 #define certificateUsageSSLCA (0x0008)
464 #define certificateUsageEmailSigner (0x0010) 460 #define certificateUsageEmailSigner (0x0010)
465 #define certificateUsageEmailRecipient (0x0020) 461 #define certificateUsageEmailRecipient (0x0020)
466 #define certificateUsageObjectSigner (0x0040) 462 #define certificateUsageObjectSigner (0x0040)
467 #define certificateUsageUserCertImport (0x0080) 463 #define certificateUsageUserCertImport (0x0080)
468 #define certificateUsageVerifyCA (0x0100) 464 #define certificateUsageVerifyCA (0x0100)
469 #define certificateUsageProtectedObjectSigner (0x0200) 465 #define certificateUsageProtectedObjectSigner (0x0200)
470 #define certificateUsageStatusResponder (0x0400) 466 #define certificateUsageStatusResponder (0x0400)
471 #define certificateUsageAnyCA (0x0800) 467 #define certificateUsageAnyCA (0x0800)
472 468
473 #define certificateUsageHighest certificateUsageAnyCA 469 #define certificateUsageHighest certificateUsageAnyCA
474 470
475 /* 471 /*
476 * Does the cert belong to the user, a peer, or a CA. 472 * Does the cert belong to the user, a peer, or a CA.
477 */ 473 */
478 typedef enum CERTCertOwnerEnum { 474 typedef enum CERTCertOwnerEnum {
479 certOwnerUser = 0, 475 certOwnerUser = 0,
480 certOwnerPeer = 1, 476 certOwnerPeer = 1,
481 certOwnerCA = 2 477 certOwnerCA = 2
482 } CERTCertOwner; 478 } CERTCertOwner;
483 479
484 /* 480 /*
485 * This enum represents the state of validity times of a certificate 481 * This enum represents the state of validity times of a certificate
486 */ 482 */
487 typedef enum SECCertTimeValidityEnum { 483 typedef enum SECCertTimeValidityEnum {
488 secCertTimeValid = 0, 484 secCertTimeValid = 0,
489 secCertTimeExpired = 1, 485 secCertTimeExpired = 1,
490 secCertTimeNotValidYet = 2, 486 secCertTimeNotValidYet = 2,
491 secCertTimeUndetermined = 3 /* validity could not be decoded from the 487 secCertTimeUndetermined = 3 /* validity could not be decoded from the
492 cert, most likely because it was NULL */ 488 cert, most likely because it was NULL */
493 } SECCertTimeValidity; 489 } SECCertTimeValidity;
494 490
495 /* 491 /*
496 * This is used as return status in functions that compare the validity 492 * This is used as return status in functions that compare the validity
497 * periods of two certificates A and B, currently only 493 * periods of two certificates A and B, currently only
498 * CERT_CompareValidityTimes. 494 * CERT_CompareValidityTimes.
499 */ 495 */
500 496
501 typedef enum CERTCompareValidityStatusEnum 497 typedef enum CERTCompareValidityStatusEnum {
502 { 498 certValidityUndetermined = 0, /* the function is unable to select one cert
503 certValidityUndetermined = 0, /* the function is unable to select one cert
504 over another */ 499 over another */
505 certValidityChooseB = 1, /* cert B should be preferred */ 500 certValidityChooseB = 1, /* cert B should be preferred */
506 certValidityEqual = 2, /* both certs have the same validity period */ 501 certValidityEqual = 2, /* both certs have the same validity period */
507 certValidityChooseA = 3 /* cert A should be preferred */ 502 certValidityChooseA = 3 /* cert A should be preferred */
508 } CERTCompareValidityStatus; 503 } CERTCompareValidityStatus;
509 504
510 /* 505 /*
511 * Interface for getting certificate nickname strings out of the database 506 * Interface for getting certificate nickname strings out of the database
512 */ 507 */
513 508
514 /* these are values for the what argument below */ 509 /* these are values for the what argument below */
515 #define SEC_CERT_NICKNAMES_ALL» » 1 510 #define SEC_CERT_NICKNAMES_ALL 1
516 #define SEC_CERT_NICKNAMES_USER»» 2 511 #define SEC_CERT_NICKNAMES_USER 2
517 #define SEC_CERT_NICKNAMES_SERVER» 3 512 #define SEC_CERT_NICKNAMES_SERVER 3
518 #define SEC_CERT_NICKNAMES_CA» » 4 513 #define SEC_CERT_NICKNAMES_CA 4
519 514
520 struct CERTCertNicknamesStr { 515 struct CERTCertNicknamesStr {
521 PLArenaPool *arena; 516 PLArenaPool *arena;
522 void *head; 517 void *head;
523 int numnicknames; 518 int numnicknames;
524 char **nicknames; 519 char **nicknames;
525 int what; 520 int what;
526 int totallen; 521 int totallen;
527 }; 522 };
528 523
529 struct CERTIssuerAndSNStr { 524 struct CERTIssuerAndSNStr {
530 SECItem derIssuer; 525 SECItem derIssuer;
531 CERTName issuer; 526 CERTName issuer;
532 SECItem serialNumber; 527 SECItem serialNumber;
533 }; 528 };
534 529
535
536 /* X.509 v3 Key Usage Extension flags */ 530 /* X.509 v3 Key Usage Extension flags */
537 #define KU_DIGITAL_SIGNATURE» » (0x80)» /* bit 0 */ 531 #define KU_DIGITAL_SIGNATURE (0x80) /* bit 0 */
538 #define KU_NON_REPUDIATION» » (0x40) /* bit 1 */ 532 #define KU_NON_REPUDIATION (0x40) /* bit 1 */
539 #define KU_KEY_ENCIPHERMENT» » (0x20) /* bit 2 */ 533 #define KU_KEY_ENCIPHERMENT (0x20) /* bit 2 */
540 #define KU_DATA_ENCIPHERMENT» » (0x10) /* bit 3 */ 534 #define KU_DATA_ENCIPHERMENT (0x10) /* bit 3 */
541 #define KU_KEY_AGREEMENT» » (0x08) /* bit 4 */ 535 #define KU_KEY_AGREEMENT (0x08) /* bit 4 */
542 #define KU_KEY_CERT_SIGN» » (0x04) /* bit 5 */ 536 #define KU_KEY_CERT_SIGN (0x04) /* bit 5 */
543 #define KU_CRL_SIGN» » » (0x02) /* bit 6 */ 537 #define KU_CRL_SIGN (0x02) /* bit 6 */
544 #define KU_ENCIPHER_ONLY» » (0x01) /* bit 7 */ 538 #define KU_ENCIPHER_ONLY (0x01) /* bit 7 */
545 #define KU_ALL» » » » (KU_DIGITAL_SIGNATURE | \ 539 #define KU_ALL \
546 » » » » » KU_NON_REPUDIATION | \ 540 (KU_DIGITAL_SIGNATURE | KU_NON_REPUDIATION | KU_KEY_ENCIPHERMENT | \
547 » » » » » KU_KEY_ENCIPHERMENT | \ 541 KU_DATA_ENCIPHERMENT | KU_KEY_AGREEMENT | KU_KEY_CERT_SIGN | \
548 » » » » » KU_DATA_ENCIPHERMENT | \ 542 KU_CRL_SIGN | KU_ENCIPHER_ONLY)
549 » » » » » KU_KEY_AGREEMENT | \
550 » » » » » KU_KEY_CERT_SIGN | \
551 » » » » » KU_CRL_SIGN | \
552 » » » » » KU_ENCIPHER_ONLY)
553 543
554 /* This value will not occur in certs. It is used internally for the case 544 /* This value will not occur in certs. It is used internally for the case
555 * when either digital signature or non-repudiation is the correct value. 545 * when either digital signature or non-repudiation is the correct value.
556 */ 546 */
557 #define KU_DIGITAL_SIGNATURE_OR_NON_REPUDIATION (0x2000) 547 #define KU_DIGITAL_SIGNATURE_OR_NON_REPUDIATION (0x2000)
558 548
559 /* This value will not occur in certs. It is used internally for the case 549 /* This value will not occur in certs. It is used internally for the case
560 * when the key type is not know ahead of time and either key agreement or 550 * when the key type is not know ahead of time and either key agreement or
561 * key encipherment are the correct value based on key type 551 * key encipherment are the correct value based on key type
562 */ 552 */
563 #define KU_KEY_AGREEMENT_OR_ENCIPHERMENT (0x4000) 553 #define KU_KEY_AGREEMENT_OR_ENCIPHERMENT (0x4000)
564 554
565 /* internal bits that do not match bits in the x509v3 spec, but are used 555 /* internal bits that do not match bits in the x509v3 spec, but are used
566 * for similar purposes 556 * for similar purposes
567 */ 557 */
568 #define KU_NS_GOVT_APPROVED» » (0x8000) /*don't make part of KU_ALL!*/ 558 #define KU_NS_GOVT_APPROVED (0x8000) /*don't make part of KU_ALL!*/
569 /* 559 /*
570 * x.509 v3 Basic Constraints Extension 560 * x.509 v3 Basic Constraints Extension
571 * If isCA is false, the pathLenConstraint is ignored. 561 * If isCA is false, the pathLenConstraint is ignored.
572 * Otherwise, the following pathLenConstraint values will apply: 562 * Otherwise, the following pathLenConstraint values will apply:
573 *» < 0 - there is no limit to the certificate path 563 *» < 0 - there is no limit to the certificate path
574 *» 0 - CA can issues end-entity certificates only 564 *» 0 - CA can issues end-entity certificates only
575 *» > 0 - the number of certificates in the certificate path is 565 *» > 0 - the number of certificates in the certificate path is
576 *» limited to this number 566 *» limited to this number
577 */ 567 */
578 #define CERT_UNLIMITED_PATH_CONSTRAINT -2 568 #define CERT_UNLIMITED_PATH_CONSTRAINT -2
579 569
580 struct CERTBasicConstraintsStr { 570 struct CERTBasicConstraintsStr {
581 PRBool isCA;» » » /* on if is CA */ 571 PRBool isCA; /* on if is CA */
582 int pathLenConstraint;» » /* maximum number of certificates that c an be 572 int pathLenConstraint; /* maximum number of certificates that can be
583 » » » » » in the cert path. Only applies to a CA 573 in the cert path. Only applies to a CA
584 » » » » » certificate; otherwise, it's ignored. 574 certificate; otherwise, it's ignored.
585 » » » » » */ 575 */
586 }; 576 };
587 577
588 /* Maximum length of a certificate chain */ 578 /* Maximum length of a certificate chain */
589 #define CERT_MAX_CERT_CHAIN 20 579 #define CERT_MAX_CERT_CHAIN 20
590 580
591 #define CERT_MAX_SERIAL_NUMBER_BYTES 20 /* from RFC 3280 */ 581 #define CERT_MAX_SERIAL_NUMBER_BYTES 20 /* from RFC 3280 */
592 #define CERT_MAX_DN_BYTES 4096 /* arbitrary */ 582 #define CERT_MAX_DN_BYTES 4096 /* arbitrary */
593 583
594 /* x.509 v3 Reason Flags, used in CRLDistributionPoint Extension */ 584 /* x.509 v3 Reason Flags, used in CRLDistributionPoint Extension */
595 #define RF_UNUSED» » » (0x80)» /* bit 0 */ 585 #define RF_UNUSED (0x80) /* bit 0 */
596 #define RF_KEY_COMPROMISE» » (0x40) /* bit 1 */ 586 #define RF_KEY_COMPROMISE (0x40) /* bit 1 */
597 #define RF_CA_COMPROMISE» » (0x20) /* bit 2 */ 587 #define RF_CA_COMPROMISE (0x20) /* bit 2 */
598 #define RF_AFFILIATION_CHANGED» » (0x10) /* bit 3 */ 588 #define RF_AFFILIATION_CHANGED (0x10) /* bit 3 */
599 #define RF_SUPERSEDED» » » (0x08) /* bit 4 */ 589 #define RF_SUPERSEDED (0x08) /* bit 4 */
600 #define RF_CESSATION_OF_OPERATION» (0x04) /* bit 5 */ 590 #define RF_CESSATION_OF_OPERATION (0x04) /* bit 5 */
601 #define RF_CERTIFICATE_HOLD» » (0x02) /* bit 6 */ 591 #define RF_CERTIFICATE_HOLD (0x02) /* bit 6 */
602 592
603 /* enum for CRL Entry Reason Code */ 593 /* enum for CRL Entry Reason Code */
604 typedef enum CERTCRLEntryReasonCodeEnum { 594 typedef enum CERTCRLEntryReasonCodeEnum {
605 crlEntryReasonUnspecified = 0, 595 crlEntryReasonUnspecified = 0,
606 crlEntryReasonKeyCompromise = 1, 596 crlEntryReasonKeyCompromise = 1,
607 crlEntryReasonCaCompromise = 2, 597 crlEntryReasonCaCompromise = 2,
608 crlEntryReasonAffiliationChanged = 3, 598 crlEntryReasonAffiliationChanged = 3,
609 crlEntryReasonSuperseded = 4, 599 crlEntryReasonSuperseded = 4,
610 crlEntryReasonCessationOfOperation = 5, 600 crlEntryReasonCessationOfOperation = 5,
611 crlEntryReasoncertificatedHold = 6, 601 crlEntryReasoncertificatedHold = 6,
612 crlEntryReasonRemoveFromCRL = 8, 602 crlEntryReasonRemoveFromCRL = 8,
613 crlEntryReasonPrivilegeWithdrawn = 9, 603 crlEntryReasonPrivilegeWithdrawn = 9,
614 crlEntryReasonAaCompromise = 10 604 crlEntryReasonAaCompromise = 10
615 } CERTCRLEntryReasonCode; 605 } CERTCRLEntryReasonCode;
616 606
617 /* If we needed to extract the general name field, use this */ 607 /* If we needed to extract the general name field, use this */
618 /* General Name types */ 608 /* General Name types */
619 typedef enum CERTGeneralNameTypeEnum { 609 typedef enum CERTGeneralNameTypeEnum {
620 certOtherName = 1, 610 certOtherName = 1,
621 certRFC822Name = 2, 611 certRFC822Name = 2,
622 certDNSName = 3, 612 certDNSName = 3,
623 certX400Address = 4, 613 certX400Address = 4,
624 certDirectoryName = 5, 614 certDirectoryName = 5,
625 certEDIPartyName = 6, 615 certEDIPartyName = 6,
626 certURI = 7, 616 certURI = 7,
627 certIPAddress = 8, 617 certIPAddress = 8,
628 certRegisterID = 9 618 certRegisterID = 9
629 } CERTGeneralNameType; 619 } CERTGeneralNameType;
630 620
631
632 typedef struct OtherNameStr { 621 typedef struct OtherNameStr {
633 SECItem name; 622 SECItem name;
634 SECItem oid; 623 SECItem oid;
635 }OtherName; 624 } OtherName;
636
637
638 625
639 struct CERTGeneralNameStr { 626 struct CERTGeneralNameStr {
640 CERTGeneralNameType type;» » /* name type */ 627 CERTGeneralNameType type; /* name type */
641 union { 628 union {
642 » CERTName directoryName; /* distinguish name */ 629 CERTName directoryName; /* distinguish name */
643 » OtherName OthName;» » /* Other Name */ 630 OtherName OthName; /* Other Name */
644 » SECItem other; /* the rest of the name forms */ 631 SECItem other; /* the rest of the name forms */
645 }name; 632 } name;
646 SECItem derDirectoryName;» » /* this is saved to simplify directory n ame 633 SECItem derDirectoryName; /* this is saved to simplify directory name
647 » » » » » comparison */ 634 comparison */
648 PRCList l; 635 PRCList l;
649 }; 636 };
650 637
651 struct CERTGeneralNameListStr { 638 struct CERTGeneralNameListStr {
652 PLArenaPool *arena; 639 PLArenaPool *arena;
653 CERTGeneralName *name; 640 CERTGeneralName *name;
654 int refCount; 641 int refCount;
655 int len; 642 int len;
656 PZLock *lock; 643 PZLock *lock;
657 }; 644 };
658 645
659 struct CERTNameConstraintStr { 646 struct CERTNameConstraintStr {
660 CERTGeneralName name; 647 CERTGeneralName name;
661 SECItem DERName; 648 SECItem DERName;
662 SECItem min; 649 SECItem min;
663 SECItem max; 650 SECItem max;
664 PRCList l; 651 PRCList l;
665 }; 652 };
666 653
667
668 struct CERTNameConstraintsStr { 654 struct CERTNameConstraintsStr {
669 CERTNameConstraint *permited; 655 CERTNameConstraint *permited;
670 CERTNameConstraint *excluded; 656 CERTNameConstraint *excluded;
671 SECItem **DERPermited; 657 SECItem **DERPermited;
672 SECItem **DERExcluded; 658 SECItem **DERExcluded;
673 }; 659 };
674 660
675
676 /* Private Key Usage Period extension struct. */ 661 /* Private Key Usage Period extension struct. */
677 struct CERTPrivKeyUsagePeriodStr { 662 struct CERTPrivKeyUsagePeriodStr {
678 SECItem notBefore; 663 SECItem notBefore;
679 SECItem notAfter; 664 SECItem notAfter;
680 PLArenaPool *arena; 665 PLArenaPool *arena;
681 }; 666 };
682 667
683 /* X.509 v3 Authority Key Identifier extension. For the authority certificate 668 /* X.509 v3 Authority Key Identifier extension. For the authority certificate
684 issuer field, we only support URI now. 669 issuer field, we only support URI now.
685 */ 670 */
686 struct CERTAuthKeyIDStr { 671 struct CERTAuthKeyIDStr {
687 SECItem keyID;» » » /* unique key identifier */ 672 SECItem keyID; /* unique key identifier */
688 CERTGeneralName *authCertIssuer;» /* CA's issuer name. End with a NULL */ 673 CERTGeneralName *authCertIssuer; /* CA's issuer name. End with a NULL */
689 SECItem authCertSerialNumber;» /* CA's certificate serial number */ 674 SECItem authCertSerialNumber; /* CA's certificate serial number */
690 SECItem **DERAuthCertIssuer;» /* This holds the DER encoded format of 675 SECItem **DERAuthCertIssuer; /* This holds the DER encoded format of
691 » » » » » the authCertIssuer field. It is used 676 the authCertIssuer field. It is used
692 » » » » » by the encoding engine. It should be 677 by the encoding engine. It should be
693 » » » » » used as a read only field by the call er. 678 used as a read only field by the caller.
694 » » » » » */ 679 */
695 }; 680 };
696 681
697 /* x.509 v3 CRL Distributeion Point */ 682 /* x.509 v3 CRL Distributeion Point */
698 683
699 /* 684 /*
700 * defined the types of CRL Distribution points 685 * defined the types of CRL Distribution points
701 */ 686 */
702 typedef enum DistributionPointTypesEnum { 687 typedef enum DistributionPointTypesEnum {
703 generalName = 1,» » » /* only support this for now */ 688 generalName = 1, /* only support this for now */
704 relativeDistinguishedName = 2 689 relativeDistinguishedName = 2
705 } DistributionPointTypes; 690 } DistributionPointTypes;
706 691
707 struct CRLDistributionPointStr { 692 struct CRLDistributionPointStr {
708 DistributionPointTypes distPointType; 693 DistributionPointTypes distPointType;
709 union { 694 union {
710 » CERTGeneralName *fullName; 695 CERTGeneralName *fullName;
711 » CERTRDN relativeName; 696 CERTRDN relativeName;
712 } distPoint; 697 } distPoint;
713 SECItem reasons; 698 SECItem reasons;
714 CERTGeneralName *crlIssuer; 699 CERTGeneralName *crlIssuer;
715 700
716 /* Reserved for internal use only*/ 701 /* Reserved for internal use only*/
717 SECItem derDistPoint; 702 SECItem derDistPoint;
718 SECItem derRelativeName; 703 SECItem derRelativeName;
719 SECItem **derCrlIssuer; 704 SECItem **derCrlIssuer;
720 SECItem **derFullName; 705 SECItem **derFullName;
721 SECItem bitsmap; 706 SECItem bitsmap;
722 }; 707 };
723 708
724 struct CERTCrlDistributionPointsStr { 709 struct CERTCrlDistributionPointsStr {
725 CRLDistributionPoint **distPoints; 710 CRLDistributionPoint **distPoints;
726 }; 711 };
727 712
728 /* 713 /*
729 * This structure is used to keep a log of errors when verifying 714 * This structure is used to keep a log of errors when verifying
730 * a cert chain. This allows multiple errors to be reported all at 715 * a cert chain. This allows multiple errors to be reported all at
731 * once. 716 * once.
732 */ 717 */
733 struct CERTVerifyLogNodeStr { 718 struct CERTVerifyLogNodeStr {
734 CERTCertificate *cert;» /* what cert had the error */ 719 CERTCertificate *cert; /* what cert had the error */
735 long error;»» » /* what error was it? */ 720 long error; /* what error was it? */
736 unsigned int depth;»» /* how far up the chain are we */ 721 unsigned int depth; /* how far up the chain are we */
737 void *arg;» » » /* error specific argument */ 722 void *arg; /* error specific argument */
738 struct CERTVerifyLogNodeStr *next; /* next in the list */ 723 struct CERTVerifyLogNodeStr *next; /* next in the list */
739 struct CERTVerifyLogNodeStr *prev; /* next in the list */ 724 struct CERTVerifyLogNodeStr *prev; /* next in the list */
740 }; 725 };
741 726
742
743 struct CERTVerifyLogStr { 727 struct CERTVerifyLogStr {
744 PLArenaPool *arena; 728 PLArenaPool *arena;
745 unsigned int count; 729 unsigned int count;
746 struct CERTVerifyLogNodeStr *head; 730 struct CERTVerifyLogNodeStr *head;
747 struct CERTVerifyLogNodeStr *tail; 731 struct CERTVerifyLogNodeStr *tail;
748 }; 732 };
749 733
750
751 struct CERTOKDomainNameStr { 734 struct CERTOKDomainNameStr {
752 CERTOKDomainName *next; 735 CERTOKDomainName *next;
753 char name[1]; /* actual length may be longer. */ 736 char name[1]; /* actual length may be longer. */
754 }; 737 };
755 738
739 typedef SECStatus(PR_CALLBACK *CERTStatusChecker)(CERTCertDBHandle *handle,
740 CERTCertificate *cert,
741 PRTime time, void *pwArg);
756 742
757 typedef SECStatus (PR_CALLBACK *CERTStatusChecker) (CERTCertDBHandle *handle, 743 typedef SECStatus(PR_CALLBACK *CERTStatusDestroy)(CERTStatusConfig *handle);
758 » » » » » » CERTCertificate *cert,
759 » » » » » » PRTime time,
760 » » » » » » void *pwArg);
761
762 typedef SECStatus (PR_CALLBACK *CERTStatusDestroy) (CERTStatusConfig *handle);
763 744
764 struct CERTStatusConfigStr { 745 struct CERTStatusConfigStr {
765 CERTStatusChecker statusChecker;» /* NULL means no checking enabled */ 746 CERTStatusChecker statusChecker; /* NULL means no checking enabled */
766 CERTStatusDestroy statusDestroy;» /* enabled or no, will clean up */ 747 CERTStatusDestroy statusDestroy; /* enabled or no, will clean up */
767 void *statusContext;» » /* cx specific to checking protocol */ 748 void *statusContext; /* cx specific to checking protocol */
768 }; 749 };
769 750
770 struct CERTAuthInfoAccessStr { 751 struct CERTAuthInfoAccessStr {
771 SECItem method; 752 SECItem method;
772 SECItem derLocation; 753 SECItem derLocation;
773 CERTGeneralName *location;» » /* decoded location */ 754 CERTGeneralName *location; /* decoded location */
774 }; 755 };
775 756
776
777 /* This is the typedef for the callback passed to CERT_OpenCertDB() */ 757 /* This is the typedef for the callback passed to CERT_OpenCertDB() */
778 /* callback to return database name based on version number */ 758 /* callback to return database name based on version number */
779 typedef char * (*CERTDBNameFunc)(void *arg, int dbVersion); 759 typedef char *(*CERTDBNameFunc)(void *arg, int dbVersion);
780 760
781 /* 761 /*
782 * types of cert packages that we can decode 762 * types of cert packages that we can decode
783 */ 763 */
784 typedef enum CERTPackageTypeEnum { 764 typedef enum CERTPackageTypeEnum {
785 certPackageNone = 0, 765 certPackageNone = 0,
786 certPackageCert = 1, 766 certPackageCert = 1,
787 certPackagePKCS7 = 2, 767 certPackagePKCS7 = 2,
788 certPackageNSCertSeq = 3, 768 certPackageNSCertSeq = 3,
789 certPackageNSCertWrap = 4 769 certPackageNSCertWrap = 4
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 * - currentChain is the currently validated chain. It is ordered with the leaf 848 * - currentChain is the currently validated chain. It is ordered with the leaf
869 * certificate at the head and the trust anchor at the tail. 849 * certificate at the head and the trust anchor at the tail.
870 * 850 *
871 * The callback should set *chainOK = PR_TRUE and return SECSuccess if the 851 * The callback should set *chainOK = PR_TRUE and return SECSuccess if the
872 * certificate chain is acceptable. It should set *chainOK = PR_FALSE and 852 * certificate chain is acceptable. It should set *chainOK = PR_FALSE and
873 * return SECSuccess if the chain is unacceptable, to indicate that the given 853 * return SECSuccess if the chain is unacceptable, to indicate that the given
874 * chain is bad and path building should continue. It should return SECFailure 854 * chain is bad and path building should continue. It should return SECFailure
875 * to indicate an fatal error that will cause path validation to fail 855 * to indicate an fatal error that will cause path validation to fail
876 * immediately. 856 * immediately.
877 */ 857 */
878 typedef SECStatus (*CERTChainVerifyCallbackFunc) 858 typedef SECStatus (*CERTChainVerifyCallbackFunc)(
879 (void *isChainValidArg, 859 void *isChainValidArg, const CERTCertList *currentChain, PRBool *chainOK);
880 const CERTCertList *currentChain,
881 PRBool *chainOK);
882 860
883 /* 861 /*
884 * Note: If extending this structure, it will be necessary to change the 862 * Note: If extending this structure, it will be necessary to change the
885 * associated CERTValParamInType 863 * associated CERTValParamInType
886 */ 864 */
887 typedef struct { 865 typedef struct {
888 CERTChainVerifyCallbackFunc isChainValid; 866 CERTChainVerifyCallbackFunc isChainValid;
889 void *isChainValidArg; 867 void *isChainValidArg;
890 } CERTChainVerifyCallback; 868 } CERTChainVerifyCallback;
891 869
892 /* 870 /*
893 * these types are for the CERT_PKIX* Verification functions 871 * these types are for the CERT_PKIX* Verification functions
894 * These are all optional parameters. 872 * These are all optional parameters.
895 */ 873 */
896 874
897 typedef enum { 875 typedef enum {
898 cert_pi_end = 0, /* SPECIAL: signifies end of array of 876 cert_pi_end = 0, /* SPECIAL: signifies end of array of
899 * CERTValParam* */ 877 * CERTValParam* */
900 cert_pi_nbioContext = 1, /* specify a non-blocking IO context used to 878 cert_pi_nbioContext = 1, /* specify a non-blocking IO context used to
901 * resume a session. If this argument is 879 * resume a session. If this argument is
902 * specified, no other arguments should be. 880 * specified, no other arguments should be.
903 * Specified in value.pointer.p. If the 881 * Specified in value.pointer.p. If the
904 * operation completes the context will be 882 * operation completes the context will be
905 * freed. */ 883 * freed. */
906 cert_pi_nbioAbort = 2, /* specify a non-blocking IO context for an 884 cert_pi_nbioAbort = 2, /* specify a non-blocking IO context for an
907 * existing operation which the caller wants 885 * existing operation which the caller wants
908 * to abort. If this argument is 886 * to abort. If this argument is
909 * specified, no other arguments should be. 887 * specified, no other arguments should be.
910 * Specified in value.pointer.p. If the 888 * Specified in value.pointer.p. If the
911 * operation succeeds the context will be 889 * operation succeeds the context will be
912 * freed. */ 890 * freed. */
913 cert_pi_certList = 3, /* specify the chain to validate against. If 891 cert_pi_certList = 3, /* specify the chain to validate against. If
914 * this value is given, then the path 892 * this value is given, then the path
915 * construction step in the validation is 893 * construction step in the validation is
916 * skipped. Specified in value.pointer.chain */ 894 * skipped. Specified in value.pointer.chain */
917 cert_pi_policyOID = 4, /* validate certificate for policy OID. 895 cert_pi_policyOID = 4, /* validate certificate for policy OID.
918 * Specified in value.array.oids. Cert must 896 * Specified in value.array.oids. Cert must
919 * be good for at least one OID in order 897 * be good for at least one OID in order
920 * to validate. Default is that the user is not 898 * to validate. Default is that the user is not
921 * concerned about certificate policy. */ 899 * concerned about certificate policy. */
922 cert_pi_policyFlags = 5, /* flags for each policy specified in policyOID. 900 cert_pi_policyFlags = 5, /* flags for each policy specified in policyOID.
923 * Specified in value.scalar.ul. Policy flags 901 * Specified in value.scalar.ul. Policy flags
924 * apply to all specified oids. 902 * apply to all specified oids.
925 * Use CERT_POLICY_FLAG_* macros below. If not 903 * Use CERT_POLICY_FLAG_* macros below. If not
926 * specified policy flags default to 0 */ 904 * specified policy flags default to 0 */
927 cert_pi_keyusage = 6, /* specify what the keyusages the certificate 905 cert_pi_keyusage = 6, /* specify what the keyusages the certificate
928 * will be evaluated against, specified in 906 * will be evaluated against, specified in
929 * value.scalar.ui. The cert must validate for 907 * value.scalar.ui. The cert must validate for
930 * at least one of the specified key usages. 908 * at least one of the specified key usages.
931 * Values match the KU_ bit flags defined 909 * Values match the KU_ bit flags defined
932 * in this file. Default is derived from 910 * in this file. Default is derived from
933 * the 'usages' function argument */ 911 * the 'usages' function argument */
934 cert_pi_extendedKeyusage= 7, /* specify what the required extended key 912 cert_pi_extendedKeyusage = 7, /* specify what the required extended key
935 * usage of the certificate. Specified as 913 * usage of the certificate. Specified as
936 * an array of oidTags in value.array.oids. 914 * an array of oidTags in value.array.oids.
937 * The cert must validate for at least one 915 * The cert must validate for at least one
938 * of the specified extended key usages. 916 * of the specified extended key usages.
939 * If not specified, no extended key usages 917 * If not specified, no extended key usages
940 * will be checked. */ 918 * will be checked. */
941 cert_pi_date = 8, /* validate certificate is valid as of date 919 cert_pi_date = 8, /* validate certificate is valid as of date
942 * specified in value.scalar.time. A special 920 * specified in value.scalar.time. A special
943 * value '0' indicates 'now'. default is '0' */ 921 * value '0' indicates 'now'. default is '0' * /
944 cert_pi_revocationFlags = 9, /* Specify what revocation checking to do. 922 cert_pi_revocationFlags = 9, /* Specify what revocation checking to do.
945 * See CERT_REV_FLAG_* macros below 923 * See CERT_REV_FLAG_* macros below
946 * Set in value.pointer.revocation */ 924 * Set in value.pointer.revocation */
947 cert_pi_certStores = 10,/* Bitmask of Cert Store flags (see below) 925 cert_pi_certStores = 10, /* Bitmask of Cert Store flags (see below)
948 * Set in value.scalar.ui */ 926 * Set in value.scalar.ui */
949 cert_pi_trustAnchors = 11,/* Specify the list of trusted roots to 927 cert_pi_trustAnchors =
950 * validate against. 928 11, /* Specify the list of trusted roots to
951 * The default set of trusted roots, these are 929 * validate against.
952 * root CA certs from libnssckbi.so or CA 930 * The default set of trusted roots, these are
953 * certs trusted by user, are used in any of 931 * root CA certs from libnssckbi.so or CA
954 * the following cases: 932 * certs trusted by user, are used in any of
955 * * when the parameter is not set. 933 * the following cases:
956 * * when the list of trust anchors is empt y. 934 * * when the parameter is not set.
957 * Note that this handling can be further altere d by altering the 935 * * when the list of trust anchors is
958 * cert_pi_useOnlyTrustAnchors flag 936 * empty.
959 * Specified in value.pointer.chain */ 937 * Note that this handling can be further
960 cert_pi_useAIACertFetch = 12, /* Enables cert fetching using AIA extension. 938 * altered by altering the
961 * In NSS 3.12.1 or later. Default is off. 939 * cert_pi_useOnlyTrustAnchors flag
962 * Value is in value.scalar.b */ 940 * Specified in value.pointer.chain */
963 cert_pi_chainVerifyCallback = 13, 941 cert_pi_useAIACertFetch = 12, /* Enables cert fetching using AIA extension.
964 /* The callback container for doing extra 942 * In NSS 3.12.1 or later. Default is off.
965 * validation on the currently calculated chain. 943 * Value is in value.scalar.b */
966 * Value is in value.pointer.chainVerifyCallback */ 944 cert_pi_chainVerifyCallback = 13,
967 cert_pi_useOnlyTrustAnchors = 14,/* If true, disables trusting any 945 /* The callback container for doing extra
968 * certificates other than the ones passed in vi a cert_pi_trustAnchors. 946 * validation on the currently calculated chain.
969 * If false, then the certificates specified via cert_pi_trustAnchors 947 * Value is in value.pointer.chainVerifyCallback */
970 * will be combined with the pre-existing truste d roots, but only for 948 cert_pi_useOnlyTrustAnchors = 14,
971 * the certificate validation being performed. 949 /* If true, disables trusting any
972 * If no value has been supplied via cert_pi_tru stAnchors, this has no 950 * certificates other than the ones passed in via cert_pi_trustAnchors.
973 * effect. 951 * If false, then the certificates specified via cert_pi_trustAnchors
974 * The default value is true, meaning if this is not supplied, only 952 * will be combined with the pre-existing trusted roots, but only
975 * trust anchors supplied via cert_pi_trustAncho rs are trusted. 953 * for the certificate validation being performed.
976 * Specified in value.scalar.b */ 954 * If no value has been supplied via cert_pi_trustAnchors, this has
977 cert_pi_max /* SPECIAL: signifies maximum allowed value, 955 * no effect.
978 * can increase in future releases */ 956 * The default value is true, meaning if this is not supplied, only
957 * trust anchors supplied via cert_pi_trustAnchors are trusted.
958 * Specified in value.scalar.b */
959 cert_pi_max /* SPECIAL: signifies maximum allowed value,
960 * can increase in future releases */
979 } CERTValParamInType; 961 } CERTValParamInType;
980 962
981 /* 963 /*
982 * for all out parameters: 964 * for all out parameters:
983 * out parameters are only returned if the caller asks for them in 965 * out parameters are only returned if the caller asks for them in
984 * the CERTValOutParam array. Caller is responsible for the CERTValOutParam 966 * the CERTValOutParam array. Caller is responsible for the CERTValOutParam
985 * array itself. The pkix verify function will allocate and other arrays 967 * array itself. The pkix verify function will allocate and other arrays
986 * pointers, or objects. The Caller is responsible for freeing those results. 968 * pointers, or objects. The Caller is responsible for freeing those results.
987 * If SECWouldBlock is returned, only cert_pi_nbioContext is returned. 969 * If SECWouldBlock is returned, only cert_pi_nbioContext is returned.
988 */ 970 */
989 typedef enum { 971 typedef enum {
990 cert_po_end = 0, /* SPECIAL: signifies end of array of 972 cert_po_end = 0, /* SPECIAL: signifies end of array of
991 » » » » * CERTValParam* */ 973 * CERTValParam* */
992 cert_po_nbioContext = 1, /* Return a nonblocking context. If no 974 cert_po_nbioContext = 1, /* Return a nonblocking context. If no
993 » » » » * non-blocking context is specified, then 975 * non-blocking context is specified, then
994 » » » » * blocking IO will be used. 976 * blocking IO will be used.
995 » » » » * Returned in value.pointer.p. The context is 977 * Returned in value.pointer.p. The context is
996 » » » » * freed after an abort or a complete operation. 978 * freed after an abort or a complete operatio n.
997 » » » » * This value is only returned on SECWouldBlock. 979 * This value is only returned on SECWouldBloc k.
998 » » » » */ 980 */
999 cert_po_trustAnchor = 2, /* Return the trust anchor for the chain that 981 cert_po_trustAnchor = 2, /* Return the trust anchor for the chain that
1000 » » » » * was validated. Returned in 982 * was validated. Returned in
1001 » » » » * value.pointer.cert, this value is only 983 * value.pointer.cert, this value is only
1002 » » » » * returned on SECSuccess. */ 984 * returned on SECSuccess. */
1003 cert_po_certList = 3, /* Return the entire chain that was validated. 985 cert_po_certList = 3, /* Return the entire chain that was validated.
1004 » » » » * Returned in value.pointer.certList. If no 986 * Returned in value.pointer.certList. If no
1005 » » » » * chain could be constructed, this value 987 * chain could be constructed, this value
1006 » » » » * would be NULL. */ 988 * would be NULL. */
1007 cert_po_policyOID = 4, /* Return the policies that were found to be 989 cert_po_policyOID = 4, /* Return the policies that were found to be
1008 » » » » * valid. Returned in value.array.oids as an 990 * valid. Returned in value.array.oids as an
1009 » » » » * array. This is only returned on 991 * array. This is only returned on
1010 » » » » * SECSuccess. */ 992 * SECSuccess. */
1011 cert_po_errorLog = 5, /* Return a log of problems with the chain. 993 cert_po_errorLog = 5, /* Return a log of problems with the chain.
1012 » » » » * Returned in value.pointer.log */ 994 * Returned in value.pointer.log */
1013 cert_po_usages = 6, /* Return what usages the certificate is valid 995 cert_po_usages = 6, /* Return what usages the certificate is valid
1014 » » » » for. Returned in value.scalar.usages */ 996 for. Returned in value.scalar.usages */
1015 cert_po_keyUsage = 7, /* Return what key usages the certificate 997 cert_po_keyUsage = 7, /* Return what key usages the certificate
1016 » » » » * is valid for. 998 * is valid for.
1017 » » » » * Returned in value.scalar.usage */ 999 * Returned in value.scalar.usage */
1018 cert_po_extendedKeyusage= 8, /* Return what extended key usages the 1000 cert_po_extendedKeyusage = 8, /* Return what extended key usages the
1019 » » » » * certificate is valid for. 1001 * certificate is valid for.
1020 » » » » * Returned in value.array.oids */ 1002 * Returned in value.array.oids */
1021 cert_po_max /* SPECIAL: signifies maximum allowed value, 1003 cert_po_max /* SPECIAL: signifies maximum allowed value,
1022 » » » » * can increase in future releases */ 1004 * can increase in future releases */
1023 1005
1024 } CERTValParamOutType; 1006 } CERTValParamOutType;
1025 1007
1026 typedef enum { 1008 typedef enum {
1027 cert_revocation_method_crl = 0, 1009 cert_revocation_method_crl = 0,
1028 cert_revocation_method_ocsp, 1010 cert_revocation_method_ocsp,
1029 cert_revocation_method_count 1011 cert_revocation_method_count
1030 } CERTRevocationMethodIndex; 1012 } CERTRevocationMethodIndex;
1031 1013
1032
1033 /* 1014 /*
1034 * The following flags are supposed to be used to control bits in 1015 * The following flags are supposed to be used to control bits in
1035 * each integer contained in the array pointed to be: 1016 * each integer contained in the array pointed to be:
1036 * CERTRevocationTests.cert_rev_flags_per_method 1017 * CERTRevocationTests.cert_rev_flags_per_method
1037 * All Flags are prefixed by CERT_REV_M_, where _M_ indicates 1018 * All Flags are prefixed by CERT_REV_M_, where _M_ indicates
1038 * this is a method dependent flag. 1019 * this is a method dependent flag.
1039 */ 1020 */
1040 1021
1041 /* 1022 /*
1042 * Whether or not to use a method for revocation testing. 1023 * Whether or not to use a method for revocation testing.
1043 * If set to "do not test", then all other flags are ignored. 1024 * If set to "do not test", then all other flags are ignored.
1044 */ 1025 */
1045 #define CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD 0UL 1026 #define CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD 0UL
1046 #define CERT_REV_M_TEST_USING_THIS_METHOD 1UL 1027 #define CERT_REV_M_TEST_USING_THIS_METHOD 1UL
1047 1028
1048 /* 1029 /*
1049 * Whether or not NSS is allowed to attempt to fetch fresh information 1030 * Whether or not NSS is allowed to attempt to fetch fresh information
1050 * from the network. 1031 * from the network.
1051 * (Although fetching will never happen if fresh information for the 1032 * (Although fetching will never happen if fresh information for the
1052 * method is already locally available.) 1033 * method is already locally available.)
1053 */ 1034 */
1054 #define CERT_REV_M_ALLOW_NETWORK_FETCHING 0UL 1035 #define CERT_REV_M_ALLOW_NETWORK_FETCHING 0UL
1055 #define CERT_REV_M_FORBID_NETWORK_FETCHING 2UL 1036 #define CERT_REV_M_FORBID_NETWORK_FETCHING 2UL
1056 1037
1057 /* 1038 /*
1058 * Example for an implicit default source: 1039 * Example for an implicit default source:
1059 * The globally configured default OCSP responder. 1040 * The globally configured default OCSP responder.
1060 * IGNORE means: 1041 * IGNORE means:
1061 * ignore the implicit default source, whether it's configured or not. 1042 * ignore the implicit default source, whether it's configured or not.
1062 * ALLOW means: 1043 * ALLOW means:
1063 * if an implicit default source is configured, 1044 * if an implicit default source is configured,
1064 * then it overrides any available or missing source in the cert. 1045 * then it overrides any available or missing source in the cert.
1065 * if no implicit default source is configured, 1046 * if no implicit default source is configured,
1066 * then we continue to use what's available (or not available) 1047 * then we continue to use what's available (or not available)
1067 * in the certs. 1048 * in the certs.
1068 */ 1049 */
1069 #define CERT_REV_M_ALLOW_IMPLICIT_DEFAULT_SOURCE 0UL 1050 #define CERT_REV_M_ALLOW_IMPLICIT_DEFAULT_SOURCE 0UL
1070 #define CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE 4UL 1051 #define CERT_REV_M_IGNORE_IMPLICIT_DEFAULT_SOURCE 4UL
1071 1052
1072 /* 1053 /*
1073 * Defines the behavior if no fresh information is available, 1054 * Defines the behavior if no fresh information is available,
1074 * fetching from the network is allowed, but the source of revocation 1055 * fetching from the network is allowed, but the source of revocation
1075 * information is unknown (even after considering implicit sources, 1056 * information is unknown (even after considering implicit sources,
1076 * if allowed by other flags). 1057 * if allowed by other flags).
1077 * SKIPT_TEST means: 1058 * SKIPT_TEST means:
1078 * We ignore that no fresh information is available and 1059 * We ignore that no fresh information is available and
1079 * skip this test. 1060 * skip this test.
1080 * REQUIRE_INFO means: 1061 * REQUIRE_INFO means:
1081 * We still require that fresh information is available. 1062 * We still require that fresh information is available.
1082 * Other flags define what happens on missing fresh info. 1063 * Other flags define what happens on missing fresh info.
1083 */ 1064 */
1084 #define CERT_REV_M_SKIP_TEST_ON_MISSING_SOURCE 0UL 1065 #define CERT_REV_M_SKIP_TEST_ON_MISSING_SOURCE 0UL
1085 #define CERT_REV_M_REQUIRE_INFO_ON_MISSING_SOURCE 8UL 1066 #define CERT_REV_M_REQUIRE_INFO_ON_MISSING_SOURCE 8UL
1086 1067
1087 /* 1068 /*
1088 * Defines the behavior if we are unable to obtain fresh information. 1069 * Defines the behavior if we are unable to obtain fresh information.
1089 * INGORE means: 1070 * INGORE means:
1090 * Return "cert status unknown" 1071 * Return "cert status unknown"
1091 * FAIL means: 1072 * FAIL means:
1092 * Return "cert revoked". 1073 * Return "cert revoked".
1093 */ 1074 */
1094 #define CERT_REV_M_IGNORE_MISSING_FRESH_INFO 0UL 1075 #define CERT_REV_M_IGNORE_MISSING_FRESH_INFO 0UL
1095 #define CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO 16UL 1076 #define CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO 16UL
1096 1077
1097 /* 1078 /*
1098 * What should happen if we were able to find fresh information using 1079 * What should happen if we were able to find fresh information using
1099 * this method, and the data indicated the cert is good? 1080 * this method, and the data indicated the cert is good?
1100 * STOP_TESTING means: 1081 * STOP_TESTING means:
1101 * Our success is sufficient, do not continue testing 1082 * Our success is sufficient, do not continue testing
1102 * other methods. 1083 * other methods.
1103 * CONTINUE_TESTING means: 1084 * CONTINUE_TESTING means:
1104 * We will continue and test the next allowed 1085 * We will continue and test the next allowed
1105 * specified method. 1086 * specified method.
1106 */ 1087 */
1107 #define CERT_REV_M_STOP_TESTING_ON_FRESH_INFO 0UL 1088 #define CERT_REV_M_STOP_TESTING_ON_FRESH_INFO 0UL
1108 #define CERT_REV_M_CONTINUE_TESTING_ON_FRESH_INFO 32UL 1089 #define CERT_REV_M_CONTINUE_TESTING_ON_FRESH_INFO 32UL
1109 1090
1110 /* When this flag is used, libpkix will never attempt to use the GET HTTP 1091 /* When this flag is used, libpkix will never attempt to use the GET HTTP
1111 * method for OCSP requests; it will always use POST. 1092 * method for OCSP requests; it will always use POST.
1112 */ 1093 */
1113 #define CERT_REV_M_FORCE_POST_METHOD_FOR_OCSP 64UL 1094 #define CERT_REV_M_FORCE_POST_METHOD_FOR_OCSP 64UL
1114 1095
1115 /* 1096 /*
1116 * The following flags are supposed to be used to control bits in 1097 * The following flags are supposed to be used to control bits in
1117 * CERTRevocationTests.cert_rev_method_independent_flags 1098 * CERTRevocationTests.cert_rev_method_independent_flags
1118 * All Flags are prefixed by CERT_REV_M_, where _M_ indicates 1099 * All Flags are prefixed by CERT_REV_M_, where _M_ indicates
1119 * this is a method independent flag. 1100 * this is a method independent flag.
1120 */ 1101 */
1121 1102
1122 /* 1103 /*
1123 * This defines the order to checking. 1104 * This defines the order to checking.
1124 * EACH_METHOD_SEPARATELY means: 1105 * EACH_METHOD_SEPARATELY means:
1125 * Do all tests related to a particular allowed method 1106 * Do all tests related to a particular allowed method
1126 * (both local information and network fetching) in a single step. 1107 * (both local information and network fetching) in a single step.
1127 * Only after testing for a particular method is done, 1108 * Only after testing for a particular method is done,
1128 * then switching to the next method will happen. 1109 * then switching to the next method will happen.
1129 * ALL_LOCAL_INFORMATION_FIRST means: 1110 * ALL_LOCAL_INFORMATION_FIRST means:
1130 * Start by testing the information for all allowed methods 1111 * Start by testing the information for all allowed methods
1131 * which are already locally available. Only after that is done 1112 * which are already locally available. Only after that is done
1132 * consider to fetch from the network (as allowed by other flags). 1113 * consider to fetch from the network (as allowed by other flags).
1133 */ 1114 */
1134 #define CERT_REV_MI_TEST_EACH_METHOD_SEPARATELY 0UL 1115 #define CERT_REV_MI_TEST_EACH_METHOD_SEPARATELY 0UL
1135 #define CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST 1UL 1116 #define CERT_REV_MI_TEST_ALL_LOCAL_INFORMATION_FIRST 1UL
1136 1117
1137 /* 1118 /*
1138 * Use this flag to specify that it's necessary that fresh information 1119 * Use this flag to specify that it's necessary that fresh information
1139 * is available for at least one of the allowed methods, but it's 1120 * is available for at least one of the allowed methods, but it's
1140 * irrelevant which of the mechanisms succeeded. 1121 * irrelevant which of the mechanisms succeeded.
1141 * NO_OVERALL_INFO_REQUIREMENT means: 1122 * NO_OVERALL_INFO_REQUIREMENT means:
1142 * We strictly follow the requirements for each individual method. 1123 * We strictly follow the requirements for each individual method.
1143 * REQUIRE_SOME_FRESH_INFO_AVAILABLE means: 1124 * REQUIRE_SOME_FRESH_INFO_AVAILABLE means:
1144 * After the individual tests have been executed, we must have 1125 * After the individual tests have been executed, we must have
1145 * been able to find fresh information using at least one method. 1126 * been able to find fresh information using at least one method.
1146 * If we were unable to find fresh info, it's a failure. 1127 * If we were unable to find fresh info, it's a failure.
1147 * This setting overrides the CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO 1128 * This setting overrides the CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO
1148 * flag on all methods. 1129 * flag on all methods.
1149 */ 1130 */
1150 #define CERT_REV_MI_NO_OVERALL_INFO_REQUIREMENT 0UL 1131 #define CERT_REV_MI_NO_OVERALL_INFO_REQUIREMENT 0UL
1151 #define CERT_REV_MI_REQUIRE_SOME_FRESH_INFO_AVAILABLE 2UL 1132 #define CERT_REV_MI_REQUIRE_SOME_FRESH_INFO_AVAILABLE 2UL
1152 1133
1153
1154 typedef struct { 1134 typedef struct {
1155 /* 1135 /*
1156 * The size of the array that cert_rev_flags_per_method points to, 1136 * The size of the array that cert_rev_flags_per_method points to,
1157 * meaning, the number of methods that are known and defined 1137 * meaning, the number of methods that are known and defined
1158 * by the caller. 1138 * by the caller.
1159 */ 1139 */
1160 PRUint32 number_of_defined_methods; 1140 PRUint32 number_of_defined_methods;
1161 1141
1162 /* 1142 /*
1163 * A pointer to an array of integers. 1143 * A pointer to an array of integers.
1164 * Each integer defines revocation checking for a single method, 1144 * Each integer defines revocation checking for a single method,
1165 * by having individual CERT_REV_M_* bits set or not set. 1145 * by having individual CERT_REV_M_* bits set or not set.
1166 * The meaning of index numbers into this array are defined by 1146 * The meaning of index numbers into this array are defined by
1167 * enum CERTRevocationMethodIndex 1147 * enum CERTRevocationMethodIndex
1168 * The size of the array must be specified by the caller in the separate 1148 * The size of the array must be specified by the caller in the separate
1169 * variable number_of_defined_methods. 1149 * variable number_of_defined_methods.
1170 * The size of the array may be smaller than 1150 * The size of the array may be smaller than
1171 * cert_revocation_method_count, it can happen if a caller 1151 * cert_revocation_method_count, it can happen if a caller
1172 * is not yet aware of the latest revocation methods 1152 * is not yet aware of the latest revocation methods
1173 * (or does not want to use them). 1153 * (or does not want to use them).
1174 */ 1154 */
1175 PRUint64 *cert_rev_flags_per_method; 1155 PRUint64 *cert_rev_flags_per_method;
1176 1156
1177 /* 1157 /*
1178 * How many preferred methods are specified? 1158 * How many preferred methods are specified?
1179 * This is equivalent to the size of the array that 1159 * This is equivalent to the size of the array that
1180 * preferred_methods points to. 1160 * preferred_methods points to.
1181 * It's allowed to set this value to zero, 1161 * It's allowed to set this value to zero,
1182 * then NSS will decide which methods to prefer. 1162 * then NSS will decide which methods to prefer.
1183 */ 1163 */
1184 PRUint32 number_of_preferred_methods; 1164 PRUint32 number_of_preferred_methods;
1185 1165
1186 /* Array that may specify an optional order of preferred methods. 1166 /* Array that may specify an optional order of preferred methods.
1187 * Each array entry shall contain a method identifier as defined 1167 * Each array entry shall contain a method identifier as defined
1188 * by CERTRevocationMethodIndex. 1168 * by CERTRevocationMethodIndex.
1189 * The entry at index [0] specifies the method with highest preference. 1169 * The entry at index [0] specifies the method with highest preference.
(...skipping 10 matching lines...) Expand all
1200 PRUint64 cert_rev_method_independent_flags; 1180 PRUint64 cert_rev_method_independent_flags;
1201 } CERTRevocationTests; 1181 } CERTRevocationTests;
1202 1182
1203 typedef struct { 1183 typedef struct {
1204 CERTRevocationTests leafTests; 1184 CERTRevocationTests leafTests;
1205 CERTRevocationTests chainTests; 1185 CERTRevocationTests chainTests;
1206 } CERTRevocationFlags; 1186 } CERTRevocationFlags;
1207 1187
1208 typedef struct CERTValParamInValueStr { 1188 typedef struct CERTValParamInValueStr {
1209 union { 1189 union {
1210 PRBool b; 1190 PRBool b;
1211 PRInt32 i; 1191 PRInt32 i;
1212 PRUint32 ui; 1192 PRUint32 ui;
1213 PRInt64 l; 1193 PRInt64 l;
1214 PRUint64 ul; 1194 PRUint64 ul;
1215 PRTime time; 1195 PRTime time;
1216 } scalar; 1196 } scalar;
1217 union { 1197 union {
1218 const void* p; 1198 const void *p;
1219 const char* s; 1199 const char *s;
1220 const CERTCertificate* cert; 1200 const CERTCertificate *cert;
1221 const CERTCertList *chain; 1201 const CERTCertList *chain;
1222 const CERTRevocationFlags *revocation; 1202 const CERTRevocationFlags *revocation;
1223 const CERTChainVerifyCallback *chainVerifyCallback; 1203 const CERTChainVerifyCallback *chainVerifyCallback;
1224 } pointer; 1204 } pointer;
1225 union { 1205 union {
1226 const PRInt32 *pi; 1206 const PRInt32 *pi;
1227 const PRUint32 *pui; 1207 const PRUint32 *pui;
1228 const PRInt64 *pl; 1208 const PRInt64 *pl;
1229 const PRUint64 *pul; 1209 const PRUint64 *pul;
1230 const SECOidTag *oids; 1210 const SECOidTag *oids;
1231 } array; 1211 } array;
1232 int arraySize; 1212 int arraySize;
1233 } CERTValParamInValue; 1213 } CERTValParamInValue;
1234 1214
1235
1236 typedef struct CERTValParamOutValueStr { 1215 typedef struct CERTValParamOutValueStr {
1237 union { 1216 union {
1238 PRBool b; 1217 PRBool b;
1239 PRInt32 i; 1218 PRInt32 i;
1240 PRUint32 ui; 1219 PRUint32 ui;
1241 PRInt64 l; 1220 PRInt64 l;
1242 PRUint64 ul; 1221 PRUint64 ul;
1243 SECCertificateUsage usages; 1222 SECCertificateUsage usages;
1244 } scalar; 1223 } scalar;
1245 union { 1224 union {
1246 void* p; 1225 void *p;
1247 char* s; 1226 char *s;
1248 CERTVerifyLog *log; 1227 CERTVerifyLog *log;
1249 CERTCertificate* cert; 1228 CERTCertificate *cert;
1250 CERTCertList *chain; 1229 CERTCertList *chain;
1251 } pointer; 1230 } pointer;
1252 union { 1231 union {
1253 void » *p; 1232 void *p;
1254 SECOidTag *oids; 1233 SECOidTag *oids;
1255 } array; 1234 } array;
1256 int arraySize; 1235 int arraySize;
1257 } CERTValParamOutValue; 1236 } CERTValParamOutValue;
1258 1237
1259 typedef struct { 1238 typedef struct {
1260 CERTValParamInType type; 1239 CERTValParamInType type;
1261 CERTValParamInValue value; 1240 CERTValParamInValue value;
1262 } CERTValInParam; 1241 } CERTValInParam;
1263 1242
1264 typedef struct { 1243 typedef struct {
1265 CERTValParamOutType type; 1244 CERTValParamOutType type;
1266 CERTValParamOutValue value; 1245 CERTValParamOutValue value;
1267 } CERTValOutParam; 1246 } CERTValOutParam;
1268 1247
1269 /* 1248 /*
1270 * Levels of standards conformance strictness for CERT_NameToAsciiInvertible 1249 * Levels of standards conformance strictness for CERT_NameToAsciiInvertible
1271 */ 1250 */
1272 typedef enum CertStrictnessLevels { 1251 typedef enum CertStrictnessLevels {
1273 CERT_N2A_READABLE = 0, /* maximum human readability */ 1252 CERT_N2A_READABLE = 0, /* maximum human readability */
1274 CERT_N2A_STRICT = 10, /* strict RFC compliance */ 1253 CERT_N2A_STRICT = 10, /* strict RFC compliance */
1275 CERT_N2A_INVERTIBLE = 20 /* maximum invertibility, 1254 CERT_N2A_INVERTIBLE = 20 /* maximum invertibility,
1276 all DirectoryStrings encoded in hex */ 1255 all DirectoryStrings encoded in hex */
1277 } CertStrictnessLevel; 1256 } CertStrictnessLevel;
1278 1257
1279 /* 1258 /*
1280 * policy flag defines 1259 * policy flag defines
1281 */ 1260 */
1282 #define CERT_POLICY_FLAG_NO_MAPPING 1 1261 #define CERT_POLICY_FLAG_NO_MAPPING 1
1283 #define CERT_POLICY_FLAG_EXPLICIT 2 1262 #define CERT_POLICY_FLAG_EXPLICIT 2
1284 #define CERT_POLICY_FLAG_NO_ANY 4 1263 #define CERT_POLICY_FLAG_NO_ANY 4
1285 1264
1286 /* 1265 /*
1287 * CertStore flags 1266 * CertStore flags
1288 */ 1267 */
1289 #define CERT_ENABLE_LDAP_FETCH 1 1268 #define CERT_ENABLE_LDAP_FETCH 1
1290 #define CERT_ENABLE_HTTP_FETCH 2 1269 #define CERT_ENABLE_HTTP_FETCH 2
1291 1270
1292 /* This functin pointer type may be used for any function that takes 1271 /* This functin pointer type may be used for any function that takes
1293 * a CERTCertificate * and returns an allocated string, which must be 1272 * a CERTCertificate * and returns an allocated string, which must be
1294 * freed by a call to PORT_Free. 1273 * freed by a call to PORT_Free.
1295 */ 1274 */
1296 typedef char * (*CERT_StringFromCertFcn)(CERTCertificate *cert); 1275 typedef char *(*CERT_StringFromCertFcn)(CERTCertificate *cert);
1297 1276
1298 /* XXX Lisa thinks the template declarations belong in cert.h, not here? */ 1277 /* XXX Lisa thinks the template declarations belong in cert.h, not here? */
1299 1278
1300 #include "secasn1t.h"» /* way down here because I expect template stuff to 1279 #include "secasn1t.h" /* way down here because I expect template stuff to
1301 » » » * move out of here anyway */ 1280 * move out of here anyway */
1302 1281
1303 SEC_BEGIN_PROTOS 1282 SEC_BEGIN_PROTOS
1304 1283
1305 extern const SEC_ASN1Template CERT_CertificateRequestTemplate[]; 1284 extern const SEC_ASN1Template CERT_CertificateRequestTemplate[];
1306 extern const SEC_ASN1Template CERT_CertificateTemplate[]; 1285 extern const SEC_ASN1Template CERT_CertificateTemplate[];
1307 extern const SEC_ASN1Template SEC_SignedCertificateTemplate[]; 1286 extern const SEC_ASN1Template SEC_SignedCertificateTemplate[];
1308 extern const SEC_ASN1Template CERT_CertExtensionTemplate[]; 1287 extern const SEC_ASN1Template CERT_CertExtensionTemplate[];
1309 extern const SEC_ASN1Template CERT_SequenceOfCertExtensionTemplate[]; 1288 extern const SEC_ASN1Template CERT_SequenceOfCertExtensionTemplate[];
1310 extern const SEC_ASN1Template SECKEY_PublicKeyTemplate[]; 1289 extern const SEC_ASN1Template SECKEY_PublicKeyTemplate[];
1311 extern const SEC_ASN1Template CERT_SubjectPublicKeyInfoTemplate[]; 1290 extern const SEC_ASN1Template CERT_SubjectPublicKeyInfoTemplate[];
(...skipping 28 matching lines...) Expand all
1340 SEC_ASN1_CHOOSER_DECLARE(CERT_SetOfSignedCrlTemplate) 1319 SEC_ASN1_CHOOSER_DECLARE(CERT_SetOfSignedCrlTemplate)
1341 SEC_ASN1_CHOOSER_DECLARE(CERT_SignedDataTemplate) 1320 SEC_ASN1_CHOOSER_DECLARE(CERT_SignedDataTemplate)
1342 SEC_ASN1_CHOOSER_DECLARE(CERT_SubjectPublicKeyInfoTemplate) 1321 SEC_ASN1_CHOOSER_DECLARE(CERT_SubjectPublicKeyInfoTemplate)
1343 SEC_ASN1_CHOOSER_DECLARE(SEC_SignedCertificateTemplate) 1322 SEC_ASN1_CHOOSER_DECLARE(SEC_SignedCertificateTemplate)
1344 SEC_ASN1_CHOOSER_DECLARE(CERT_SignedCrlTemplate) 1323 SEC_ASN1_CHOOSER_DECLARE(CERT_SignedCrlTemplate)
1345 SEC_ASN1_CHOOSER_DECLARE(CERT_TimeChoiceTemplate) 1324 SEC_ASN1_CHOOSER_DECLARE(CERT_TimeChoiceTemplate)
1346 1325
1347 SEC_END_PROTOS 1326 SEC_END_PROTOS
1348 1327
1349 #endif /* _CERTT_H_ */ 1328 #endif /* _CERTT_H_ */
OLDNEW
« no previous file with comments | « nss/lib/certdb/certi.h ('k') | nss/lib/certdb/certv3.c » ('j') | nss/lib/util/secoid.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698