Async 1.8.0
Async::SslX509 Class Reference

A class representing an X.509 certificate. More...

#include <AsyncSslX509.h>

Public Types

enum  : long { VERSION_1 = 0 , VERSION_2 = 1 , VERSION_3 = 2 }
 

Public Member Functions

 SslX509 (void)
 Default constructor.
 
 SslX509 (X509 *cert, bool managed=true)
 Constructor.
 
 SslX509 (X509_STORE_CTX &ctx)
 Constructor.
 
 SslX509 (SslX509 &&other)
 Move constructor.
 
SslX509operator= (SslX509 &&other)
 Move assignment operator.
 
 SslX509 (const SslX509 &)=delete
 Don't allow copy construction.
 
 ~SslX509 (void)
 Constructor taking PEM data.
 
void set (X509 *cert, bool managed=true)
 Set the internal X509 object to use.
 
void clear (void)
 Set this object to empty.
 
bool isNull (void) const
 Check if this object is empty.
 
SslX509operator= (const SslX509 &)=delete
 Disallow use of the copy assignment operator.
 
bool setIssuerName (const X509_NAME *name)
 Set the issuer distinguished name.
 
const X509_NAME * issuerName (void) const
 Get the issuer distinguished name.
 
bool setSubjectName (const X509_NAME *name)
 Set the subject distinguished name.
 
const X509_NAME * subjectName (void) const
 Get the subject distinguished name.
 
 operator const X509 * (void) const
 Cast to an OpenSSL X509 pointer.
 
std::string commonName (void) const
 Get the common name of the subject.
 
bool verify (SslKeypair &keypair)
 Verify that this certificate is signed by the given key.
 
bool readPem (const std::string &pem)
 Initialize this certificate from a string containing PEM data.
 
std::string pem (void) const
 Get this certificate as PEM data.
 
bool readPemFile (const std::string &filename)
 Initialize this object with PEM data read from given file.
 
bool writePemFile (FILE *f)
 Write this certificate to file in PEM format.
 
bool writePemFile (const std::string &filename)
 Write this certificate to file in PEM format.
 
bool appendPemFile (const std::string &filename)
 Append this certificate to file in PEM format.
 
bool setVersion (long version)
 Set the version of this certificate.
 
long version (void) const
 Get the version of this certificate.
 
void setNotBefore (std::time_t in_time)
 Set the date and time from which this certificate is valid.
 
std::time_t notBefore (void) const
 Get the date and time from which this certificate is valid.
 
std::string notBeforeString (void) const
 Get the date and time from which this certificate is valid.
 
std::string notBeforeLocaltimeString (void) const
 Get the date and time from which this certificate is valid.
 
void setNotAfter (std::time_t in_time)
 Set the date and time up to which this certificate is valid.
 
std::time_t notAfter (void) const
 Get the date and time up to which this certificate is valid.
 
std::string notAfterString (void) const
 Get the date and time up to which this certificate is valid.
 
std::string notAfterLocaltimeString (void) const
 Get the date and time up to which this certificate is valid.
 
void setValidityTime (unsigned days, int offset_days=0)
 Set the validity time relative to current time.
 
void validityTime (int &days, int &seconds) const
 The duration that this certificate is valid.
 
bool timeIsWithinRange (std::time_t tbegin=time(NULL), std::time_t tend=time(NULL)) const
 Check if the certificate is valid within the given range.
 
int signatureType (void) const
 Get the signature type.
 
void setSerialNumber (long serial_number=-1)
 Set the serial number of the certificate.
 
std::string serialNumberString (void) const
 Get the serial number as a string.
 
void addIssuerName (const std::string &field, const std::string &value)
 Add a name to the issuer distinguished name.
 
void addSubjectName (const std::string &field, const std::string &value)
 Add a name to the subject distinguished name.
 
std::string issuerNameString (void) const
 Get the issuer distinguished name as a string.
 
std::string subjectNameString (void) const
 Get the subject distinguished name as a string.
 
void addExtensions (const SslX509Extensions &exts)
 Add v3 extensions to this certificate.
 
SslKeypair publicKey (void) const
 Get the public key @retrun Returns the public key.
 
bool setPublicKey (SslKeypair &pkey)
 Set the public key for this certificate.
 
bool sign (SslKeypair &pkey)
 Sign this certificate using the given key.
 
std::vector< unsigned char > digest (void) const
 Get the digest of this certificate.
 
bool matchHost (const std::string &name) const
 Check if the given hostname match this certificate.
 
bool matchIp (const IpAddress &ip) const
 Check if the given IP address match this certificate.
 
void print (const std::string &prefix="") const
 Print this certificate to std::cout.
 

Detailed Description

A class representing an X.509 certificate.

Author
Tobias Blomberg / SM0SVX
Date
2020-08-03
#include <AsyncSslX509.h>
int main(void)
{
// Create a key pair for the CA
if (!ca_pkey.generate(2048))
{
std::cout << "*** ERROR: Failed to generate CA key" << std::endl;
return 1;
}
if (!ca_pkey.writePrivateKeyFile("demo_ca.key"))
{
std::cout << "*** WARNING: Failed to write CA key file" << std::endl;
}
// Create a CA certificate and sign it with the key above
Async::SslX509 ca_cert;
ca_cert.setSerialNumber(1);
ca_cert.addIssuerName("CN", "Demo Root CA");
ca_cert.addIssuerName("L", "My City");
ca_cert.addIssuerName("C", "XX");
ca_cert.setSubjectName(ca_cert.issuerName());
ca_exts.addBasicConstraints("critical, CA:TRUE");
ca_exts.addKeyUsage("critical, cRLSign, digitalSignature, keyCertSign");
ca_exts.addSubjectAltNames("email:ca@example.org");
ca_cert.addExtensions(ca_exts);
time_t t = time(nullptr);
ca_cert.setNotBefore(t);
ca_cert.setNotAfter(t + 24*3600);
ca_cert.setPublicKey(ca_pkey);
ca_cert.sign(ca_pkey);
std::cout << "--------------- CA Certificate ----------------" << std::endl;
ca_cert.print();
std::cout << "-----------------------------------------------" << std::endl;
if (!ca_cert.writePemFile("demo_ca.crt"))
{
std::cout << "*** WARNING: Failed to write CA certificate file"
<< std::endl;
}
// Create a key pair for the server certificate
Async::SslKeypair cert_pkey;
if (!cert_pkey.generate(2048))
{
std::cout << "*** ERROR: Failed to generate server certificate key"
<< std::endl;
return 1;
}
if (!cert_pkey.writePrivateKeyFile("demo.key"))
{
std::cout << "*** WARNING: Failed to write CA key file" << std::endl;
}
// Create a Certificate Signing Request
csr.addSubjectName("CN", "hostname.example.org");
csr.addSubjectName("L", "My City");
csr.addSubjectName("C", "XX");
"DNS:hostname.example.org"
", DNS:alias.example.org"
", DNS:localhost"
", IP:127.0.0.1"
", email:admin@example.org"
", URI:https://www.example.org"
", otherName:msUPN;UTF8:sb@sb.local");
csr.addExtensions(csr_exts);
csr.setPublicKey(cert_pkey);
csr.sign(cert_pkey);
std::cout << "--------- Certificate Signing Request ---------" << std::endl;
csr.print();
std::cout << "-----------------------------------------------" << std::endl;
if (!csr.writePemFile("demo.csr"))
{
std::cout << "*** WARNING: Failed to write CSR file" << std::endl;
}
std::cout << "The CSR verification "
<< (csr.verify(cert_pkey) ? "PASSED" : "FAILED")
<< std::endl;
// Create the certificate using the CSR then sign it using the CA cert
cert.setSerialNumber(2);
cert.setIssuerName(ca_cert.subjectName());
cert.setNotBefore(t);
cert.setNotAfter(t + 3600);
cert_exts.addBasicConstraints("critical, CA:FALSE");
cert_exts.addKeyUsage("critical, nonRepudiation, digitalSignature, keyEncipherment, keyAgreement");
cert_exts.addExtKeyUsage("serverAuth");
Async::SslX509ExtSubjectAltName san(exts.subjectAltName());
cert_exts.addExtension(san);
cert.addExtensions(cert_exts);
Async::SslKeypair csr_pkey(csr.publicKey());
cert.setPublicKey(csr_pkey);
cert.sign(ca_pkey);
std::cout << "------------- Server Certificate --------------" << std::endl;
cert.print();
std::cout << "-----------------------------------------------" << std::endl;
if (!cert.writePemFile("demo.crt"))
{
std::cout << "*** WARNING: Failed to write certificate file"
<< std::endl;
}
std::cout << "The certificate verification "
<< (cert.verify(ca_pkey) ? "PASSED" : "FAILED")
<< std::endl;
return 0;
}
SSL context meant to be used with TcpConnection and friends.
Represent private and public keys.
Implements a representation of a X.509 certificate.
A class representing a certificate signing request.
void addExtensions(SslX509Extensions &exts)
Add extensions to this CSR.
const X509_NAME * subjectName(void) const
Return the subject name as a X509_NAME pointer.
bool setPublicKey(SslKeypair &pubkey)
Set the public key.
void print(const std::string &prefix="") const
Print the info in this CSR to std::cout.
SslKeypair publicKey(void) const
Get the public key.
SslX509Extensions extensions(void) const
Get the extensions in this CSR.
bool writePemFile(FILE *f)
Write the CSR data to a PEM file.
bool verify(SslKeypair &pubkey) const
Verify the signature of this CSR.
bool sign(SslKeypair &privkey)
Sign the CSR using the given private key.
bool addSubjectName(const std::string &field, const std::string &value)
Add a subject name component.
bool setVersion(long version)
Set the version of the request.
A class representing private and public keys.
bool writePrivateKeyFile(const std::string &filename)
Write key data to file on PEM format.
bool generate(unsigned int bits)
Generate a new RSA keypair.
A class representing the X.509 Subject Alternative Name extension.
A class representing X.509 extensions.
bool addExtKeyUsage(const std::string &eku)
Add extended key usage.
bool addSubjectAltNames(const std::string &san)
Add subject alternative names.
bool addExtension(const SslX509ExtSubjectAltName &san)
Add a subject alternative names object.
bool addBasicConstraints(const std::string &bc)
Add basic constraints extension.
bool addKeyUsage(const std::string &ku)
Add key usage.
A class representing an X.509 certificate.
void addIssuerName(const std::string &field, const std::string &value)
Add a name to the issuer distinguished name.
void print(const std::string &prefix="") const
Print this certificate to std::cout.
void setSerialNumber(long serial_number=-1)
Set the serial number of the certificate.
bool setPublicKey(SslKeypair &pkey)
Set the public key for this certificate.
bool verify(SslKeypair &keypair)
Verify that this certificate is signed by the given key.
const X509_NAME * subjectName(void) const
Get the subject distinguished name.
bool setSubjectName(const X509_NAME *name)
Set the subject distinguished name.
bool writePemFile(FILE *f)
Write this certificate to file in PEM format.
bool setIssuerName(const X509_NAME *name)
Set the issuer distinguished name.
void addExtensions(const SslX509Extensions &exts)
Add v3 extensions to this certificate.
bool sign(SslKeypair &pkey)
Sign this certificate using the given key.
const X509_NAME * issuerName(void) const
Get the issuer distinguished name.
void setNotBefore(std::time_t in_time)
Set the date and time from which this certificate is valid.
void setNotAfter(std::time_t in_time)
Set the date and time up to which this certificate is valid.
bool setVersion(long version)
Set the version of this certificate.
Examples
AsyncSslX509_demo.cpp.

Definition at line 123 of file AsyncSslX509.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : long
Enumerator
VERSION_1 
VERSION_2 
VERSION_3 

Definition at line 126 of file AsyncSslX509.h.

Constructor & Destructor Documentation

◆ SslX509() [1/5]

Async::SslX509::SslX509 ( void )
inline

Default constructor.

Definition at line 136 of file AsyncSslX509.h.

◆ SslX509() [2/5]

Async::SslX509::SslX509 ( X509 * cert,
bool managed = true )
inline

Constructor.

Parameters
certA pointer to an existing OpenSSL X509 object
managedIf true, the pointer will be freed on destruction

Definition at line 146 of file AsyncSslX509.h.

◆ SslX509() [3/5]

Async::SslX509::SslX509 ( X509_STORE_CTX & ctx)
inlineexplicit

Constructor.

Parameters
ctxAn OpenSSL X509_STORE_CTX

Get the current certificate from the given store context. The returned pointer will be used as the data container in this object but will not be freed on dustruction since the store context is assumed to own the certificate.

Definition at line 161 of file AsyncSslX509.h.

◆ SslX509() [4/5]

Async::SslX509::SslX509 ( SslX509 && other)
inline

Move constructor.

Parameters
otherThe object to move from

Definition at line 173 of file AsyncSslX509.h.

References set().

◆ SslX509() [5/5]

Async::SslX509::SslX509 ( const SslX509 & )
delete

Don't allow copy construction.

◆ ~SslX509()

Async::SslX509::~SslX509 ( void )
inline

Constructor taking PEM data.

Parameters
pemThe PEM data to parse into a CSR object

Destructor

Definition at line 224 of file AsyncSslX509.h.

References set().

Member Function Documentation

◆ addExtensions()

void Async::SslX509::addExtensions ( const SslX509Extensions & exts)
inline

Add v3 extensions to this certificate.

Parameters
extsAdd the given extensions to this certificate
Examples
AsyncSslX509_demo.cpp.

Definition at line 814 of file AsyncSslX509.h.

◆ addIssuerName()

void Async::SslX509::addIssuerName ( const std::string & field,
const std::string & value )
inline

Add a name to the issuer distinguished name.

Parameters
fieldThe name of the DN field to set
valueThe value to set the DN field to
Examples
AsyncSslX509_demo.cpp.

Definition at line 711 of file AsyncSslX509.h.

◆ addSubjectName()

void Async::SslX509::addSubjectName ( const std::string & field,
const std::string & value )
inline

Add a name to the subject distinguished name.

Parameters
fieldThe name of the DN field to set
valueThe value to set the DN field to

Definition at line 734 of file AsyncSslX509.h.

◆ appendPemFile()

bool Async::SslX509::appendPemFile ( const std::string & filename)
inline

Append this certificate to file in PEM format.

Parameters
filenameThe path to the file to append PEM data to
Returns
Returns true on success

Definition at line 467 of file AsyncSslX509.h.

References writePemFile().

◆ clear()

void Async::SslX509::clear ( void )
inline

Set this object to empty.

The internal OpenSSL X509 object will be freed if it's managed by this object.

Definition at line 251 of file AsyncSslX509.h.

◆ commonName()

std::string Async::SslX509::commonName ( void ) const
inline

Get the common name of the subject.

Returns
Returns the common name as a string

Definition at line 337 of file AsyncSslX509.h.

References subjectName().

◆ digest()

std::vector< unsigned char > Async::SslX509::digest ( void ) const
inline

Get the digest of this certificate.

Returns
Returns the sha256 digest of this certificate

Definition at line 859 of file AsyncSslX509.h.

Referenced by print().

◆ isNull()

bool Async::SslX509::isNull ( void ) const
inline

Check if this object is empty.

Returns
Returns true if this object is empty

Definition at line 264 of file AsyncSslX509.h.

Referenced by print().

◆ issuerName()

const X509_NAME * Async::SslX509::issuerName ( void ) const
inline

Get the issuer distinguished name.

Returns
Returns a pointer to a X509_NAME OpenSSL object
Examples
AsyncSslX509_demo.cpp.

Definition at line 293 of file AsyncSslX509.h.

Referenced by issuerNameString().

◆ issuerNameString()

std::string Async::SslX509::issuerNameString ( void ) const
inline

Get the issuer distinguished name as a string.

Returns
Returns the issuer DN as a string

Definition at line 756 of file AsyncSslX509.h.

References issuerName().

Referenced by print().

◆ matchHost()

bool Async::SslX509::matchHost ( const std::string & name) const
inline

Check if the given hostname match this certificate.

Parameters
nameThe hostname to match against
Returns
Returns true on success

Definition at line 889 of file AsyncSslX509.h.

◆ matchIp()

bool Async::SslX509::matchIp ( const IpAddress & ip) const
inline

Check if the given IP address match this certificate.

Parameters
ipThe IP address to match against
Returns
Returns true on success

Definition at line 900 of file AsyncSslX509.h.

References Async::IpAddress::toString().

◆ notAfter()

std::time_t Async::SslX509::notAfter ( void ) const
inline

Get the date and time up to which this certificate is valid.

Returns
Returns the time as seconds since the Unix epoch

Definition at line 554 of file AsyncSslX509.h.

Referenced by notAfterLocaltimeString().

◆ notAfterLocaltimeString()

std::string Async::SslX509::notAfterLocaltimeString ( void ) const
inline

Get the date and time up to which this certificate is valid.

Returns
Returns the time in the local timezone as a readable string

Definition at line 584 of file AsyncSslX509.h.

References notAfter().

Referenced by print().

◆ notAfterString()

std::string Async::SslX509::notAfterString ( void ) const
inline

Get the date and time up to which this certificate is valid.

Returns
Returns the time in UTC as a readable string

Definition at line 568 of file AsyncSslX509.h.

◆ notBefore()

std::time_t Async::SslX509::notBefore ( void ) const
inline

Get the date and time from which this certificate is valid.

Returns
Returns the time as seconds since the Unix epoch

Definition at line 503 of file AsyncSslX509.h.

Referenced by notBeforeLocaltimeString().

◆ notBeforeLocaltimeString()

std::string Async::SslX509::notBeforeLocaltimeString ( void ) const
inline

Get the date and time from which this certificate is valid.

Returns
Returns the time in the local timezone as a readable string

Definition at line 533 of file AsyncSslX509.h.

References notBefore().

Referenced by print().

◆ notBeforeString()

std::string Async::SslX509::notBeforeString ( void ) const
inline

Get the date and time from which this certificate is valid.

Returns
Returns the time in UTC as a readable string

Definition at line 517 of file AsyncSslX509.h.

◆ operator const X509 *()

Async::SslX509::operator const X509 * ( void ) const
inline

Cast to an OpenSSL X509 pointer.

Returns
Returns a pointer to an OpenSSL X509 object

Definition at line 331 of file AsyncSslX509.h.

◆ operator=() [1/2]

SslX509 & Async::SslX509::operator= ( const SslX509 & )
delete

Disallow use of the copy assignment operator.

◆ operator=() [2/2]

SslX509 & Async::SslX509::operator= ( SslX509 && other)
inline

Move assignment operator.

Parameters
otherThe object to move from

Definition at line 191 of file AsyncSslX509.h.

References set().

◆ pem()

std::string Async::SslX509::pem ( void ) const
inline

Get this certificate as PEM data.

Returns
Returns the PEM data as a string

Definition at line 397 of file AsyncSslX509.h.

Referenced by readPem().

◆ print()

void Async::SslX509::print ( const std::string & prefix = "") const
inline

Print this certificate to std::cout.

Parameters
prefixA prefix to add to each printed row
Examples
AsyncSslX509_demo.cpp.

Definition at line 910 of file AsyncSslX509.h.

References digest(), isNull(), issuerNameString(), notAfterLocaltimeString(), notBeforeLocaltimeString(), serialNumberString(), subjectNameString(), and Async::SslX509ExtSubjectAltName::toString().

◆ publicKey()

SslKeypair Async::SslX509::publicKey ( void ) const
inline

Get the public key @retrun Returns the public key.

Definition at line 827 of file AsyncSslX509.h.

◆ readPem()

bool Async::SslX509::readPem ( const std::string & pem)
inline

Initialize this certificate from a string containing PEM data.

Parameters
pemThe PEM data
Returns
Returns true on success

Definition at line 380 of file AsyncSslX509.h.

References pem().

◆ readPemFile()

bool Async::SslX509::readPemFile ( const std::string & filename)
inline

Initialize this object with PEM data read from given file.

Parameters
filenameThe path to the file to read PEM data from
Returns
Returns true on success

Definition at line 415 of file AsyncSslX509.h.

◆ serialNumberString()

std::string Async::SslX509::serialNumberString ( void ) const
inline

Get the serial number as a string.

Returns
Returns the serial number as a hex string

Definition at line 677 of file AsyncSslX509.h.

Referenced by print().

◆ set()

void Async::SslX509::set ( X509 * cert,
bool managed = true )
inline

Set the internal X509 object to use.

Parameters
certA pointer to an existing OpenSSL X509 object
managedSet to true to free the X509 object on destruction

Definition at line 235 of file AsyncSslX509.h.

Referenced by operator=(), SslX509(), and ~SslX509().

◆ setIssuerName()

bool Async::SslX509::setIssuerName ( const X509_NAME * name)
inline

Set the issuer distinguished name.

Parameters
nameA pointer to an already existing X509_NAME OpenSSL object
Returns
Returns true on success
Examples
AsyncSslX509_demo.cpp.

Definition at line 276 of file AsyncSslX509.h.

◆ setNotAfter()

void Async::SslX509::setNotAfter ( std::time_t in_time)
inline

Set the date and time up to which this certificate is valid.

Parameters
in_timeThe time as seconds since the Unix epoch
Examples
AsyncSslX509_demo.cpp.

Definition at line 545 of file AsyncSslX509.h.

Referenced by setValidityTime().

◆ setNotBefore()

void Async::SslX509::setNotBefore ( std::time_t in_time)
inline

Set the date and time from which this certificate is valid.

Parameters
in_timeThe time as seconds since the Unix epoch
Examples
AsyncSslX509_demo.cpp.

Definition at line 494 of file AsyncSslX509.h.

Referenced by setValidityTime().

◆ setPublicKey()

bool Async::SslX509::setPublicKey ( SslKeypair & pkey)
inline

Set the public key for this certificate.

Parameters
pkeyThe public key to set
Returns
Returns true on success
Examples
AsyncSslX509_demo.cpp.

Definition at line 838 of file AsyncSslX509.h.

◆ setSerialNumber()

void Async::SslX509::setSerialNumber ( long serial_number = -1)
inline

Set the serial number of the certificate.

Parameters
serial_numberThe serial number to set

If no serial number is given, it will be randomized.

Examples
AsyncSslX509_demo.cpp.

Definition at line 657 of file AsyncSslX509.h.

◆ setSubjectName()

bool Async::SslX509::setSubjectName ( const X509_NAME * name)
inline

Set the subject distinguished name.

Parameters
nameA pointer to an already existing X509_NAME OpenSSL object
Returns
Returns true on success
Examples
AsyncSslX509_demo.cpp.

Definition at line 304 of file AsyncSslX509.h.

◆ setValidityTime()

void Async::SslX509::setValidityTime ( unsigned days,
int offset_days = 0 )
inline

Set the validity time relative to current time.

Parameters
daysThe number of days this certificate should be valid
offset_daysThe number of days to offset from current time

Definition at line 597 of file AsyncSslX509.h.

References setNotAfter(), and setNotBefore().

◆ setVersion()

bool Async::SslX509::setVersion ( long version)
inline

Set the version of this certificate.

Parameters
versionThe version that this certificate adheres to
Returns
Returns true on success

Ex: setVersion(Async::SslX509::VERSION_3)

Examples
AsyncSslX509_demo.cpp.

Definition at line 479 of file AsyncSslX509.h.

References version().

◆ sign()

bool Async::SslX509::sign ( SslKeypair & pkey)
inline

Sign this certificate using the given key.

Parameters
pkeyThe key to sign with
Returns
Returns true on success
Examples
AsyncSslX509_demo.cpp.

Definition at line 848 of file AsyncSslX509.h.

◆ signatureType()

int Async::SslX509::signatureType ( void ) const
inline

Get the signature type.

Returns
Returns the signature type

See the documentation for the OpenSSL X509_get_signature_type function for more information.

Definition at line 646 of file AsyncSslX509.h.

◆ subjectName()

const X509_NAME * Async::SslX509::subjectName ( void ) const
inline

Get the subject distinguished name.

Returns
Returns a pointer to a X509_NAME OpenSSL object
Examples
AsyncSslX509_demo.cpp.

Definition at line 321 of file AsyncSslX509.h.

Referenced by commonName(), and subjectNameString().

◆ subjectNameString()

std::string Async::SslX509::subjectNameString ( void ) const
inline

Get the subject distinguished name as a string.

Returns
Returns the subject DN as a string

Definition at line 785 of file AsyncSslX509.h.

References subjectName().

Referenced by print().

◆ timeIsWithinRange()

bool Async::SslX509::timeIsWithinRange ( std::time_t tbegin = time(NULL),
std::time_t tend = time(NULL) ) const
inline

Check if the certificate is valid within the given range.

Parameters
tbeginThe earliest time the certificate must be valid
tendThe latest time the certificate must be valid
Returns
Returns true if the certificate is valid

Definition at line 628 of file AsyncSslX509.h.

◆ validityTime()

void Async::SslX509::validityTime ( int & days,
int & seconds ) const
inline

The duration that this certificate is valid.

Parameters
daysReturn the number of days of validity
secondsReturn the number of additional seconds of validity

Definition at line 615 of file AsyncSslX509.h.

◆ verify()

bool Async::SslX509::verify ( SslKeypair & keypair)
inline

Verify that this certificate is signed by the given key.

Parameters
keypairThe key to check against
Returns
Returns true if the verification succeeds
Examples
AsyncSslX509_demo.cpp.

Definition at line 369 of file AsyncSslX509.h.

◆ version()

long Async::SslX509::version ( void ) const
inline

Get the version of this certificate.

Returns
Returns the version of this certificate

Definition at line 488 of file AsyncSslX509.h.

Referenced by setVersion().

◆ writePemFile() [1/2]

bool Async::SslX509::writePemFile ( const std::string & filename)
inline

Write this certificate to file in PEM format.

Parameters
filenameThe path to the file to write PEM data to
Returns
Returns true on success

Definition at line 457 of file AsyncSslX509.h.

References writePemFile().

◆ writePemFile() [2/2]

bool Async::SslX509::writePemFile ( FILE * f)
inline

Write this certificate to file in PEM format.

Parameters
fAn open file to write data to
Returns
Returns true on success
Examples
AsyncSslX509_demo.cpp.

Definition at line 438 of file AsyncSslX509.h.

Referenced by appendPemFile(), and writePemFile().


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