Module: Secure Communication Module Package: Secure Sockets
RWX509CertificateRWHandleBase
#include <rw/secsock/RWX509Certificate.h>
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.
typedef X509* RWX509CertificateRep;
Used by getRep().
RWX509Certificate(const char** certData, int numLines);
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.
Throws RWUnableToReadCertificateError if the certificate is corrupted. Throws RWSecureSocketUnderlyingAllocationError if the cryptographic library is unsuccessful in allocating memory.
RWX509Certificate(istream& is);
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.
Throws RWUnableToReadCertificateError if the certificate is corrupted. Throws RWSecureSocketUnderlyingAllocationError if the cryptographic library is unsuccessful in allocating memory.
RWCString getIssuerNameString() const;
Returns an RWCString containing the individual components of the name of the issuer of the certificate, concatenated together.
RWDateTime getNotAfterDate() const;
Returns the date and time after which the certificate is not valid.
RWDateTime getNotBeforeDate() const;
Returns the date and time before which the certificate is not valid.
int getPublicKeyLength() const;
Returns the number of bits in the subject's public key.
RWX509CertificateRep getRep() const;
Returns a pointer to the cryptographic library's representation of the certificate.
NOTE -- The memory that this pointer references is owned by the body class RWX509CertificateImp, so do not attempt to delete the memory. RWX509CertificateImp deletes the memory when all handles referring to that body are destroyed.
RWCString getSerialNumber() const;
Returns the serial number of the certificate.
RWCString getSubjectNameString() const;
Returns an RWCString object containing the individual components of the name, concatenated together.
long getVersion() const;
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 isValid(const RWDateTime& date = RWDateTime (RWDateTime::setCurrentTime)) const;
Returns true if the certificate is valid relative to the date/time false otherwise. The parameter defaults to the current date/time.
void throwIfNotValid(const RWDateTime& date = RWDateTime (RWDateTime::setCurrentTime)) const;
Throws RWCertificateNotValidError if the certificate is not valid relative to the date/time. The date parameter defaults to the current date/time.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.