2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2007 Net Integration Technologies, Inc. and others.
5 * X.509v3 CRL management class.
14 // Structures to make the compiler happy so we don't have to include x509v3.h ;)
16 typedef struct X509_crl_st X509_CRL
;
18 typedef struct ssl_ctx_st SSL_CTX
;
19 struct asn1_string_st
;
20 typedef struct asn1_string_st ASN1_INTEGER
;
25 * CRL Class to handle certificate revocation lists and their related
32 * Type for the @ref encode() and @ref decode() methods:
33 * CRLPEM = PEM Encoded X.509 CRL
34 * CRLDER = DER Encoded X.509 CRL
35 * CRLFilePEM = PEM Encoded X.509 CRL
36 * CRLFileDER = DER Encoded X.509 CRL
38 enum DumpMode
{ CRLPEM
= 0, CRLDER
, CRLFilePEM
, CRLFileDER
};
41 * Initialize a blank (null) CRL object.
46 * Initialize a CRL object, signed and created by the certificate
49 WvCRL(const WvX509Mgr
&cacert
);
54 /** Accessor for CRL */
59 * Check the CRL in crl against the CA certificate in cert
60 * - returns true if CRL was signed by that CA certificate.
62 bool signedbyca(const WvX509
&cacert
) const;
65 * Check the issuer name of the CRL in crl against the CA certificate in cert
66 * - returns true if the names match.
68 bool issuedbyca(const WvX509
&cacert
) const;
71 * Checks to see if the CRL is expired (i.e.: the present time is past the
72 * nextUpdate extension).
73 * - returns true if CRL has expired.
78 * Checks to see if the CRL has any critical extensions in it.
79 * - returns true if the CRL has any critical extensions.
81 bool has_critical_extensions() const;
84 * Type for @ref validate() method:
85 * ERROR = there was an error that happened..
86 * VALID = the certificate is valid
87 * NOT_THIS_CA = the certificate is not signed by this CA
88 * NO_VALID_SIGNATURE = the certificate claims to be signed by this CA (Issuer is the same),
89 * but the signature is invalid.
91 enum Valid
{ CRLERROR
= -1, VALID
, NOT_THIS_CA
, NO_VALID_SIGNATURE
,
92 EXPIRED
, UNHANDLED_CRITICAL_EXTENSIONS
};
95 * Checks to see that a CRL is signed and issued by a CA certificate, and
96 * that it has not expired.
97 * - returns a validity status.
98 * Get the Authority key Info
100 Valid
validate(const WvX509
&cacert
) const;
103 * Get the Authority key Info
105 WvString
get_aki() const;
108 * Get the CRL Issuer.
110 WvString
get_issuer() const;
113 * Do we have any errors... convenience function..
118 * Return the information requested by mode as a WvString.
120 WvString
encode(const DumpMode mode
) const;
121 void encode(const DumpMode mode
, WvBuf
&buf
) const;
124 * Load the information from the format requested by mode into
125 * the class - this overwrites the CRL.
127 void decode(const DumpMode mode
, WvStringParm encoded
);
128 void decode(const DumpMode mode
, WvBuf
&encoded
);
131 * Is the certificate in cert revoked?
133 bool isrevoked(const WvX509
&cert
) const;
134 bool isrevoked(WvStringParm serial_number
) const;
137 * Add the certificate specified by cert to the CRL.
139 void addcert(const WvX509
&cert
);
142 * Counts the number of certificates in this CRL.
143 * WARNING: this method will be very slow and will consume a lot
144 * of memory for large CRLs.
146 int numcerts() const;