C++ Based OPC UA Client/Server SDK  1.5.5.355

Class for handling revocation lists. More...

#include <uapkirevocationlist.h>

Public Member Functions

 UaPkiRevocationList ()
 construction
 
 UaPkiRevocationList (long validity, const UaPkiIdentity &issuer, long iCrlNumber)
 Constructor. More...
 
 UaPkiRevocationList (const UaPkiRevocationList &copy)
 construction
 
 ~UaPkiRevocationList ()
 destruction
 
UaPkiRevocationListoperator= (const UaPkiRevocationList &copy)
 Assignment operator. More...
 
bool operator== (const UaPkiRevocationList &other) const
 Compares the issuer name of the CRL to another one. More...
 
void addRevoked (const UaPkiCertificate &cert, const UaDateTime &revocationDate)
 Adds a certificate to the revocation list. More...
 
bool verify (const UaPkiPrivateKey &issuerPrivateKey) const
 Verifies the signature of the revocation list. More...
 
bool sign (const UaPkiPrivateKey &issuerPrivateKey)
 Signs the revocation list. More...
 
UaPkiIdentity issuer () const
 Returns the identity of the revocation list's issuer. More...
 
long crlNumber () const
 Returns the number of the revocation list. More...
 
UaByteArray toDER () const
 Encodes the revocation list into DER format. More...
 
int toDERFile (const char *szFile) const
 Stores the revocation list into a DER encoded file. More...
 
int toDERFile (const UaString &sFile) const
 Stores the revocation list into a DER encoded file. More...
 
int toPEMFile (const char *szFile) const
 Stores the revocation list into a PEM encoded file. More...
 
int toPEMFile (const UaString &sFile) const
 Stores the revocation list into a PEM encoded file. More...
 
int toWindowsStore (WindowsStoreLocation location, const UaString &sStoreName) const
 Stores the revocation list in the given windows certificate store. More...
 

Static Public Member Functions

static UaPkiRevocationList fromDER (const UaByteArray &DERdata)
 Loads a revocation list from a DER encoded byte array. More...
 
static UaPkiRevocationList fromFile (const char *szFile)
 Loads a certificate from a CRL or PEM encoded file. More...
 
static UaPkiRevocationList fromFile (const UaString &sFile)
 Loads a certificate from a CRL or PEM encoded file. More...
 
static UaPkiRevocationList fromWindowsStore (WindowsStoreLocation location, const UaString &sStoreName, const UaPkiIdentity &issuer, long iCrlNumber=-1)
 Gets a revocation list from the given windows certificate store. More...
 

Detailed Description

Class for handling revocation lists.

The following sample demonstrates how to create a revocation list.

issuer.commonName = "Example Company";
issuer.organization = "ACME";
issuer.organizationUnit = "Development Department";
issuer.locality = "Schwabach";
issuer.state = "Bavaria";
issuer.country = "DE";
// create new keypair
int bits = 2048;
UaPkiRsaKeyPair keyPairIssuer(bits);
// create new revocation list with validity set to 5 years and CrlNumber 0
UaPkiRevocationList revocationList(3600*24*365*5, issuer, 0);
// add a certificate to the list
UaPkiCertificate certToRevoke = UaPkiCertificate::fromDERFile("/path/to/certToRevoke.der");
revocationList.addRevoked(certToRevoke, UaDateTime::now());
// sign the list
revocationList.sign(keyPairIssuer.privateKey());
// store revocation list in a DER encoded file
revocationList.toPEMFile("/path/to/myrevocationlist.crl");

Constructor & Destructor Documentation

UaPkiRevocationList::UaPkiRevocationList ( long  validity,
const UaPkiIdentity issuer,
long  iCrlNumber 
)

Constructor.

Parameters
[in]validityTime from now in seconds until a new CRL will be created.
[in]issuerThe issuer of the Certificate.
[in]iCrlNumberThe CrlNumber of the certificate

Member Function Documentation

void UaPkiRevocationList::addRevoked ( const UaPkiCertificate cert,
const UaDateTime revocationDate 
)

Adds a certificate to the revocation list.

Parameters
[in]certThe certificate to be added.
[in]revocationDateThe certificate will be revoked from this date on.
long UaPkiRevocationList::crlNumber ( ) const

Returns the number of the revocation list.

UaPkiRevocationList UaPkiRevocationList::fromDER ( const UaByteArray DERdata)
static

Loads a revocation list from a DER encoded byte array.

Returns
A new UaPkiRevocationList instance.
Parameters
[in]DERdataThe DER data.
UaPkiRevocationList UaPkiRevocationList::fromFile ( const char *  szFile)
static

Loads a certificate from a CRL or PEM encoded file.

Returns
A new UaPkiRevocationList instance.
Parameters
[in]szFileThe file name (local 8 bit encoded).
UaPkiRevocationList UaPkiRevocationList::fromFile ( const UaString sFile)
static

Loads a certificate from a CRL or PEM encoded file.

Returns
A new UaPkiRevocationList instance.
Parameters
[in]sFileThe file name (UTF8 encoded).
UaPkiRevocationList UaPkiRevocationList::fromWindowsStore ( WindowsStoreLocation  location,
const UaString sStoreName,
const UaPkiIdentity issuer,
long  iCrlNumber = -1 
)
static

Gets a revocation list from the given windows certificate store.

Returns
The revocation list if it has been found. Else, a NULL revocation list is returned.
Parameters
[in]locationThe system store location.
[in]sStoreNameThe name of the certificate store to search in.
[in]issuerissuer of the revocation list to find.
[in]iCrlNumberThe number of the revocation list to find.
UaPkiIdentity UaPkiRevocationList::issuer ( ) const

Returns the identity of the revocation list's issuer.

UaPkiRevocationList & UaPkiRevocationList::operator= ( const UaPkiRevocationList copy)

Assignment operator.

Parameters
copyAn existing UaPkiRevocationList.
Returns
UaPkiRevocationList to the current instance
bool UaPkiRevocationList::operator== ( const UaPkiRevocationList other) const

Compares the issuer name of the CRL to another one.

Parameters
other[in] The other CRL to compare to.
Returns
True if the issuer names are equal, false if not.
bool UaPkiRevocationList::sign ( const UaPkiPrivateKey issuerPrivateKey)

Signs the revocation list.

Returns
True if signing was successful, false otherwise.
Parameters
[in]issuerPrivateKeyThe private key of the issuer to sign the list with.
UaByteArray UaPkiRevocationList::toDER ( ) const

Encodes the revocation list into DER format.

Returns
UaByteArray with DER data.
int UaPkiRevocationList::toDERFile ( const char *  szFile) const

Stores the revocation list into a DER encoded file.

Returns
1 on success, 0 otherwise.
Parameters
[in]szFileThe filename to use (local 8 bit encoded).
int UaPkiRevocationList::toDERFile ( const UaString sFile) const

Stores the revocation list into a DER encoded file.

Returns
1 on success, 0 otherwise.
Parameters
[in]sFileThe filename to use (UTF8 encoded).
int UaPkiRevocationList::toPEMFile ( const char *  szFile) const

Stores the revocation list into a PEM encoded file.

Returns
1 on success, 0 otherwise.
Parameters
[in]szFileThe filename to use (local 8 bit encoded).
int UaPkiRevocationList::toPEMFile ( const UaString sFile) const

Stores the revocation list into a PEM encoded file.

Returns
1 on success, 0 otherwise.
Parameters
[in]sFileThe filename to use (UTF8 encoded).
int UaPkiRevocationList::toWindowsStore ( WindowsStoreLocation  location,
const UaString sStoreName 
) const

Stores the revocation list in the given windows certificate store.

The windows certificate store identifies the revocation list by all it's information, so no name parameter is needed.

Returns
Returns 0 if the method succeeded, otherwise -1.
Parameters
[in]locationThe system store location.
[in]sStoreNameThe name of the certificate store to use.
bool UaPkiRevocationList::verify ( const UaPkiPrivateKey issuerPrivateKey) const

Verifies the signature of the revocation list.

Returns
True if the list is valid, false otherwise.
Parameters
[in]issuerPrivateKeyThe issuer's private key to verify with.

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