security/nss/lib/pki/pkitm.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

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 PKITM_H
michael@0 6 #define PKITM_H
michael@0 7
michael@0 8 /*
michael@0 9 * pkitm.h
michael@0 10 *
michael@0 11 * This file contains PKI-module specific types.
michael@0 12 */
michael@0 13
michael@0 14 #ifndef BASET_H
michael@0 15 #include "baset.h"
michael@0 16 #endif /* BASET_H */
michael@0 17
michael@0 18 #ifndef PKIT_H
michael@0 19 #include "pkit.h"
michael@0 20 #endif /* PKIT_H */
michael@0 21
michael@0 22 PR_BEGIN_EXTERN_C
michael@0 23
michael@0 24 typedef enum nssCertIDMatchEnum {
michael@0 25 nssCertIDMatch_Yes = 0,
michael@0 26 nssCertIDMatch_No = 1,
michael@0 27 nssCertIDMatch_Unknown = 2
michael@0 28 } nssCertIDMatch;
michael@0 29
michael@0 30 /*
michael@0 31 * nssDecodedCert
michael@0 32 *
michael@0 33 * This is an interface to allow the PKI module access to certificate
michael@0 34 * information that can only be found by decoding. The interface is
michael@0 35 * generic, allowing each certificate type its own way of providing
michael@0 36 * the information
michael@0 37 */
michael@0 38 struct nssDecodedCertStr {
michael@0 39 NSSCertificateType type;
michael@0 40 void *data;
michael@0 41 /* returns the unique identifier for the cert */
michael@0 42 NSSItem * (*getIdentifier)(nssDecodedCert *dc);
michael@0 43 /* returns the unique identifier for this cert's issuer */
michael@0 44 void * (*getIssuerIdentifier)(nssDecodedCert *dc);
michael@0 45 /* is id the identifier for this cert? */
michael@0 46 nssCertIDMatch (*matchIdentifier)(nssDecodedCert *dc, void *id);
michael@0 47 /* is this cert a valid CA cert? */
michael@0 48 PRBool (*isValidIssuer)(nssDecodedCert *dc);
michael@0 49 /* returns the cert usage */
michael@0 50 NSSUsage * (*getUsage)(nssDecodedCert *dc);
michael@0 51 /* is time within the validity period of the cert? */
michael@0 52 PRBool (*isValidAtTime)(nssDecodedCert *dc, NSSTime *time);
michael@0 53 /* is the validity period of this cert newer than cmpdc? */
michael@0 54 PRBool (*isNewerThan)(nssDecodedCert *dc, nssDecodedCert *cmpdc);
michael@0 55 /* does the usage for this cert match the requested usage? */
michael@0 56 PRBool (*matchUsage)(nssDecodedCert *dc, const NSSUsage *usage);
michael@0 57 /* is this cert trusted for the requested usage? */
michael@0 58 PRBool (*isTrustedForUsage)(nssDecodedCert *dc,
michael@0 59 const NSSUsage *usage);
michael@0 60 /* extract the email address */
michael@0 61 NSSASCII7 *(*getEmailAddress)(nssDecodedCert *dc);
michael@0 62 /* extract the DER-encoded serial number */
michael@0 63 PRStatus (*getDERSerialNumber)(nssDecodedCert *dc,
michael@0 64 NSSDER *derSerial, NSSArena *arena);
michael@0 65 };
michael@0 66
michael@0 67 struct NSSUsageStr {
michael@0 68 PRBool anyUsage;
michael@0 69 SECCertUsage nss3usage;
michael@0 70 PRBool nss3lookingForCA;
michael@0 71 };
michael@0 72
michael@0 73 typedef struct nssPKIObjectCollectionStr nssPKIObjectCollection;
michael@0 74
michael@0 75 typedef struct
michael@0 76 {
michael@0 77 union {
michael@0 78 PRStatus (* cert)(NSSCertificate *c, void *arg);
michael@0 79 PRStatus (* crl)(NSSCRL *crl, void *arg);
michael@0 80 PRStatus (* pvkey)(NSSPrivateKey *vk, void *arg);
michael@0 81 PRStatus (* pbkey)(NSSPublicKey *bk, void *arg);
michael@0 82 } func;
michael@0 83 void *arg;
michael@0 84 } nssPKIObjectCallback;
michael@0 85
michael@0 86 PR_END_EXTERN_C
michael@0 87
michael@0 88 #endif /* PKITM_H */

mercurial