Wt  4.11.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Wt::WSslCertificate Class Reference

An interface to an SSL certificate. More...

#include <Wt/WSslCertificate.h.C>

Classes

class  DnAttribute
 Distinguished name attribute (also known as relative distinguished name) More...
 

Public Types

enum  DnAttributeName {
  CountryName , CommonName , LocalityName , Surname ,
  GivenName , SerialNumber , Title , Initials ,
  OrganizationName , OrganizationalUnitName , StateOrProvinceName , Pseudonym ,
  DnAttributeNameCount
}
 Distinguished name's attribute name. More...
 

Public Member Functions

const std::vector< DnAttribute > & subjectDn () const
 Returns the distinguished name attributes of the subject. More...
 
std::string subjectDnString () const
 Returns the distinguished name of the subject in string format. More...
 
const std::vector< DnAttribute > & issuerDn () const
 Returns the distinguished name attributes of the issuer. More...
 
std::string issuerDnString () const
 Returns the distinguished name of the issuer in string format. More...
 
const Wt::WDateTimevalidityStart () const
 Returns the start time of the validity period of the certificate. More...
 
const Wt::WDateTimevalidityEnd () const
 Returns the end time of the validity period of the certificate. More...
 
const std::string & toPem () const
 Returns the textual PEM-encoded certificate. More...
 
std::string toDer () const
 Returns the binary DER-encoded certificate. More...
 

Static Public Member Functions

static std::string pemToDer (const std::string &pem)
 Convert a certificate from PEM encoding (textual) to DER encoding (binary). More...
 

Detailed Description

An interface to an SSL certificate.

This class provides an interface to an X.509 certificate, as used by SSL (server and client cert). The certificates are usually obtained by calling methods of class WSslInfo.

This class offers you an interface to the raw (PEM/DER) certificate, as well as a convenient interface to the most common attribute fields. The attributes interpreted by Wt are limited to those listed in enum DnAttributeName.

The raw certificate can be queried in PEM/DER format, and a function is provided to convert PEM (textual format) to DER (binary format).

This class is only available when Wt was compiled with SSL support.

Member Enumeration Documentation

◆ DnAttributeName

Distinguished name's attribute name.

Note: The values of this enum have no relation with the numerical ID used in the X.509 certificate.

See also
DnAttribute
Enumerator
CountryName 

Country name.

CommonName 

Common name.

LocalityName 

Locality name.

Surname 

Surname.

GivenName 

Given name.

SerialNumber 

Serial number.

Title 

Title.

Initials 

Initials.

OrganizationName 

Name of the organization.

OrganizationalUnitName 

Name of the organizational unit.

StateOrProvinceName 

Name of the state or province.

Pseudonym 

Pseudonym.

Member Function Documentation

◆ issuerDn()

const std::vector<DnAttribute>& Wt::WSslCertificate::issuerDn ( ) const

Returns the distinguished name attributes of the issuer.

The distinguished name (DN) of the authority that signed and therefore issued the certificate. This is the Certification Authority (CA), unless a certificate chain is used.

◆ issuerDnString()

std::string Wt::WSslCertificate::issuerDnString ( ) const

Returns the distinguished name of the issuer in string format.

An example: CN=Pietje Puk,OU=Development,O=Emweb

◆ pemToDer()

std::string Wt::WSslCertificate::pemToDer ( const std::string &  pem)
static

Convert a certificate from PEM encoding (textual) to DER encoding (binary).

This function throws an WException when the input string is not in the expected format.

◆ subjectDn()

const std::vector<DnAttribute>& Wt::WSslCertificate::subjectDn ( ) const

Returns the distinguished name attributes of the subject.

A distinguished name (DN) defining the entity associated with this certificate. Only the fields listed in enum DnAttributeName are decoded from the certificate.

◆ subjectDnString()

std::string Wt::WSslCertificate::subjectDnString ( ) const

Returns the distinguished name of the subject in string format.

For example: CN=Pietje Puk,OU=Development,O=Emweb

◆ toDer()

std::string Wt::WSslCertificate::toDer ( ) const

Returns the binary DER-encoded certificate.

This function returns WSslCertificate::pemToDer(toPem()). It will therefore throw a WException if the conversion fails.

See also
pemToDer()

◆ toPem()

const std::string& Wt::WSslCertificate::toPem ( ) const

Returns the textual PEM-encoded certificate.

See also
pemToDer()

◆ validityEnd()

const Wt::WDateTime& Wt::WSslCertificate::validityEnd ( ) const

Returns the end time of the validity period of the certificate.

The returned date may be invalid if not provided in the certificate.

See also
validityStart()

◆ validityStart()

const Wt::WDateTime& Wt::WSslCertificate::validityStart ( ) const

Returns the start time of the validity period of the certificate.

The returned date may be invalid if not provided in the certificate.

See also
validityEnd()