WvStreams
Public Types | Public Member Functions | List of all members
WvCRL Class Reference

CRL Class to handle certificate revocation lists and their related functions. More...

#include <wvcrl.h>

Public Types

enum  DumpMode { CRLPEM = 0 , CRLDER , CRLFilePEM , CRLFileDER }
 Type for the encode() and decode() methods: CRLPEM = PEM Encoded X.509 CRL CRLDER = DER Encoded X.509 CRL CRLFilePEM = PEM Encoded X.509 CRL CRLFileDER = DER Encoded X.509 CRL. More...
 
enum  Valid {
  CRLERROR = -1 , VALID , NOT_THIS_CA , NO_VALID_SIGNATURE ,
  EXPIRED , UNHANDLED_CRITICAL_EXTENSIONS
}
 Type for validate() method: ERROR = there was an error that happened. More...
 

Public Member Functions

 WvCRL ()
 Initialize a blank (null) CRL object.
 
 WvCRL (const WvX509Mgr &ca)
 Initialize a CRL object, signed and created by the certificate 'ca'.
 
virtual ~WvCRL ()
 Destructor.
 
X509_CRL * getcrl ()
 Accessor for CRL.
 
bool signedbyca (const WvX509 &cacert) const
 Check the CRL in crl against the CA certificate in cert.
 
bool issuedbyca (const WvX509 &cacert) const
 Check the issuer name of the CRL in crl against the CA certificate in cert.
 
bool expired () const
 Checks to see if the CRL is expired (i.e.: the present time is past the nextUpdate extension).
 
bool has_critical_extensions () const
 
Valid validate (const WvX509 &cacert) const
 Checks to see that a CRL is signed and issued by a CA certificate, and that it has not expired.
 
WvString get_aki () const
 Get the Authority key Info.
 
WvString get_issuer () const
 Get the CRL Issuer.
 
bool isok () const
 Do we have any errors... convenience function.
 
WvString encode (const DumpMode mode) const
 Return the information requested by mode as a WvString.
 
void encode (const DumpMode mode, WvBuf &buf) const
 
void decode (const DumpMode mode, WvStringParm encoded)
 Load the information from the format requested by mode into the class - this overwrites the CRL.
 
void decode (const DumpMode mode, WvBuf &encoded)
 
bool isrevoked (const WvX509 &cert) const
 Is the certificate in cert revoked?
 
bool isrevoked (WvStringParm serial_number) const
 
void addcert (const WvX509 &cert)
 Add the certificate specified by cert to the CRL.
 
int numcerts () const
 Counts the number of certificates in this CRL.
 

Detailed Description

CRL Class to handle certificate revocation lists and their related functions.

Definition at line 28 of file wvcrl.h.

Member Enumeration Documentation

◆ DumpMode

Type for the encode() and decode() methods: CRLPEM = PEM Encoded X.509 CRL CRLDER = DER Encoded X.509 CRL CRLFilePEM = PEM Encoded X.509 CRL CRLFileDER = DER Encoded X.509 CRL.

Definition at line 38 of file wvcrl.h.

◆ Valid

Type for validate() method: ERROR = there was an error that happened.

VALID = the certificate is valid NOT_THIS_CA = the certificate is not signed by this CA NO_VALID_SIGNATURE = the certificate claims to be signed by this CA (Issuer is the same), but the signature is invalid.

Definition at line 91 of file wvcrl.h.

Constructor & Destructor Documentation

◆ WvCRL() [1/2]

WvCRL::WvCRL ( )

Initialize a blank (null) CRL object.

Definition at line 40 of file wvcrl.cc.

◆ WvCRL() [2/2]

WvCRL::WvCRL ( const WvX509Mgr ca)

Initialize a CRL object, signed and created by the certificate 'ca'.

Definition at line 47 of file wvcrl.cc.

References WvX509Mgr::signcrl().

◆ ~WvCRL()

WvCRL::~WvCRL ( )
virtual

Destructor.

Definition at line 81 of file wvcrl.cc.

Member Function Documentation

◆ getcrl()

X509_CRL * WvCRL::getcrl ( )
inline

Accessor for CRL.

Definition at line 55 of file wvcrl.h.

Referenced by WvX509Mgr::signcrl().

◆ signedbyca()

bool WvCRL::signedbyca ( const WvX509 cacert) const

Check the CRL in crl against the CA certificate in cert.

  • returns true if CRL was signed by that CA certificate.

Definition at line 95 of file wvcrl.cc.

References WvX509::get_subject().

Referenced by validate().

◆ issuedbyca()

bool WvCRL::issuedbyca ( const WvX509 cacert) const

Check the issuer name of the CRL in crl against the CA certificate in cert.

  • returns true if the names match.

Definition at line 117 of file wvcrl.cc.

References get_issuer(), and WvX509::get_subject().

Referenced by validate().

◆ expired()

bool WvCRL::expired ( ) const

Checks to see if the CRL is expired (i.e.: the present time is past the nextUpdate extension).

  • returns true if CRL has expired.

Definition at line 136 of file wvcrl.cc.

Referenced by validate().

◆ has_critical_extensions()

bool WvCRL::has_critical_extensions ( ) const

Definition at line 151 of file wvcrl.cc.

◆ validate()

WvCRL::Valid WvCRL::validate ( const WvX509 cacert) const

Checks to see that a CRL is signed and issued by a CA certificate, and that it has not expired.

  • returns a validity status. Get the Authority key Info

Definition at line 387 of file wvcrl.cc.

References expired(), issuedbyca(), and signedbyca().

◆ get_aki()

WvString WvCRL::get_aki ( ) const

Get the Authority key Info.

Definition at line 160 of file wvcrl.cc.

◆ get_issuer()

WvString WvCRL::get_issuer ( ) const

Get the CRL Issuer.

Definition at line 185 of file wvcrl.cc.

Referenced by issuedbyca().

◆ isok()

bool WvCRL::isok ( ) const

Do we have any errors... convenience function.

Definition at line 89 of file wvcrl.cc.

Referenced by WvX509Mgr::signcrl().

◆ encode() [1/2]

WvString WvCRL::encode ( const DumpMode  mode) const

Return the information requested by mode as a WvString.

Definition at line 197 of file wvcrl.cc.

References encode().

Referenced by encode().

◆ encode() [2/2]

void WvCRL::encode ( const DumpMode  mode,
WvBuf &  buf 
) const

Definition at line 206 of file wvcrl.cc.

◆ decode() [1/2]

void WvCRL::decode ( const DumpMode  mode,
WvStringParm  encoded 
)

Load the information from the format requested by mode into the class - this overwrites the CRL.

Definition at line 240 of file wvcrl.cc.

References WvFastString::cstr(), and decode().

Referenced by decode().

◆ decode() [2/2]

void WvCRL::decode ( const DumpMode  mode,
WvBuf &  encoded 
)

Definition at line 295 of file wvcrl.cc.

◆ isrevoked() [1/2]

bool WvCRL::isrevoked ( const WvX509 cert) const

Is the certificate in cert revoked?

Definition at line 333 of file wvcrl.cc.

References WvX509::get_serial(), WvX509::get_subject(), and isrevoked().

Referenced by isrevoked().

◆ isrevoked() [2/2]

bool WvCRL::isrevoked ( WvStringParm  serial_number) const

Definition at line 351 of file wvcrl.cc.

◆ addcert()

void WvCRL::addcert ( const WvX509 cert)

Add the certificate specified by cert to the CRL.

Definition at line 424 of file wvcrl.cc.

References WvX509::get_serial(), and WvX509::isok().

◆ numcerts()

int WvCRL::numcerts ( ) const

Counts the number of certificates in this CRL.

WARNING: this method will be very slow and will consume a lot of memory for large CRLs.

Definition at line 409 of file wvcrl.cc.


The documentation for this class was generated from the following files: