OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::MbedTLSPKI Namespace Reference

Classes

class  DH
 
class  PKContext
 
class  X509Cert
 
class  X509CRL
 

Functions

static std::string x509_get_subject (const mbedtls_x509_crt *cert, bool new_format=false)
 
static std::string x509_get_common_name (const mbedtls_x509_crt *cert)
 

Function Documentation

◆ x509_get_common_name()

static std::string openvpn::MbedTLSPKI::x509_get_common_name ( const mbedtls_x509_crt *  cert)
static

Retrieves just the common name of the X.509 Certificate subject field

Parameters
certPointer to a native mbedTLS X509 object containing the certificate
Returns
Returns the contents of the extracted field on success. The resulting string may be empty if the extraction failed or the field is empty.

Definition at line 112 of file x509certinfo.hpp.

Here is the caller graph for this function:

◆ x509_get_subject()

static std::string openvpn::MbedTLSPKI::x509_get_subject ( const mbedtls_x509_crt *  cert,
bool  new_format = false 
)
static

Retrieve the complete X.509 Certificate Subject field

OpenSSL supports two ways of representing the subject line. The old format is deprecated, but there might be code expecting this old format. The old format looks like this:

/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server/emailAddress=me@myhost.mydomain

The new format is UTF-8 compliant and has a different formatting scheme:

C=KG, ST=NA, O=OpenVPN-TEST, CN=Test-Server,

emailAddress=me@my.nosp@m.host.nosp@m..mydo.nosp@m.main

This mbed TLS implementation supports generating a subject line formatted as the deprecated OpenSSL format. This is the default behaviour, to preserve OpenSSL compatibility with existing OpenVPN code.

Parameters
certPointer to a native mbed TLS X509 object containing the certificate
new_format(optional, default: false) Which format to use, true indicates the new format
Returns
Returns a std::string containing the complete certificate subject. If it was not possible to retrieve the subject, and empty string is returned.

Definition at line 56 of file x509certinfo.hpp.

Here is the caller graph for this function: