SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Related Functions
RWX509Certificate Class Reference

Adapter class for the cryptographic library's representation of an X.509 certificate. More...

#include <rw/secsock/RWX509Certificate.h>

Inheritance diagram for RWX509Certificate:
RWHandleBase

Public Member Functions

 RWX509Certificate (const char **certData, int numLines)
 
 RWX509Certificate (std::istream &is)
 
RWCString getIssuerNameString () const
 
RWDateTime getNotAfterDate () const
 
RWDateTime getNotBeforeDate () const
 
int getPublicKeyLength () const
 
RWX509CertificateRep getRep () const
 
RWCString getSerialNumber () const
 
RWCString getSubjectNameString () const
 
long getVersion () const
 
bool isValid (const RWDateTime &date=RWDateTime(RWDateTime::setCurrentTime)) const
 
void throwIfNotValid (const RWDateTime &date=RWDateTime(RWDateTime::setCurrentTime)) const
 
- Public Member Functions inherited from RWHandleBase
bool isValid (void) const
 
bool operator!= (const RWHandleBase &second) const
 
bool operator< (const RWHandleBase &second) const
 
bool operator== (const RWHandleBase &second) const
 

Related Functions

(Note that these are not member functions.)

typedef X509 * RWX509CertificateRep
 

Additional Inherited Members

- Protected Member Functions inherited from RWHandleBase
 RWHandleBase (void)
 
 RWHandleBase (RWStaticCtor)
 
 RWHandleBase (RWBodyBase *body)
 
 RWHandleBase (const RWHandleBase &second)
 
 ~RWHandleBase (void)
 
RWBodyBasebody (void) const
 
RWHandleBaseoperator= (const RWHandleBase &second)
 

Detailed Description

RWX509Certificate is an adapter for the cryptographic library's representation of an X.509 certificate. A certificate contains a public key and some information concerning the validity of the certificate. The certificate is digitally signed by the issuer to protect its integrity.

Constructor & Destructor Documentation

RWX509Certificate::RWX509Certificate ( const char **  certData,
int  numLines 
)
inline

Constructs a certificate from the data pointed to by certData. certData is a pointer to an array of C-style strings that contain the PEM-encoded certificate. Each line of a PEM-encoded certificate is an element in the array of strings.

numLines is the number of lines in the certData array. For example, if you are passing the pointer certData as the first parameter to this constructor, you should pass sizeof(certData)/sizeof(certData[0]) as the second parameter to this constructor.

Exceptions
RWUnableToReadCertificateErrorThrown if the certificate is corrupted.
RWSecureSocketUnderlyingAllocationErrorThrown if the cryptographic library is unsuccessful in allocating memory.
RWX509Certificate::RWX509Certificate ( std::istream &  is)
inline

Constructs a certificate from the istream. The input stream should contain only one certificate.

This constructor reads from the istream until an EOF is read. ifstream instances automatically end transmissions with an EOF. For example, if you pass an RWPortalIStream that ultimately reads from a socket, the stream only enters the EOF state when the sending socket is closed.

Exceptions
RWUnableToReadCertificateErrorThrown if the certificate is corrupted.
RWSecureSocketUnderlyingAllocationErrorThrown if the cryptographic library is unsuccessful in allocating memory.

Member Function Documentation

RWCString RWX509Certificate::getIssuerNameString ( ) const
inline

Returns an RWCString containing the individual components of the name of the issuer of the certificate, concatenated together.

RWDateTime RWX509Certificate::getNotAfterDate ( ) const
inline

Returns the date and time after which the certificate is not valid.

RWDateTime RWX509Certificate::getNotBeforeDate ( ) const
inline

Returns the date and time before which the certificate is not valid.

int RWX509Certificate::getPublicKeyLength ( ) const
inline

Returns the number of bits in the subject's public key.

RWX509CertificateRep RWX509Certificate::getRep ( ) const
inline

Returns a pointer to the cryptographic library's representation of the certificate.

Note
The memory that this pointer references is owned by the RWX509Certificate instance. Users should not attempt to delete the memory.
RWCString RWX509Certificate::getSerialNumber ( ) const
inline

Returns the serial number of the certificate.

RWCString RWX509Certificate::getSubjectNameString ( ) const
inline

Returns an RWCString object containing the individual components of the name, concatenated together.

long RWX509Certificate::getVersion ( ) const
inline

Returns the certificate version number. The returned value is always one less than the certificate version. A value of 0 would indicate a certificate version 1.

bool RWX509Certificate::isValid ( const RWDateTime date = RWDateTime(RWDateTime::setCurrentTime)) const
inline

Returns true if the certificate is valid relative to the date/time false otherwise. The parameter defaults to the current date/time.

void RWX509Certificate::throwIfNotValid ( const RWDateTime date = RWDateTime(RWDateTime::setCurrentTime)) const
inline
Exceptions
RWCertificateNotValidErrorThrown if the certificate is not valid relative to the date/time. The date parameter defaults to the current date/time.

Friends And Related Function Documentation

typedef X509* RWX509CertificateRep
related

This is the internal X.509 certificate representation.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.