dodo  0.0.1
A C++ library to create containerized Linux services
dodo::network::X509Common Class Reference

Interface common to X509 documents. More...

#include <x509cert.hpp>

Inheritance diagram for dodo::network::X509Common:

Data Structures

struct  Identity
 Attributes that together constitute a X509 identity. More...
 
struct  SAN
 Subject AltName record. More...
 

Public Types

enum  SANType { SANType::stDNS = GEN_DNS, SANType::stURI = GEN_URI, SANType::stEMAIL = GEN_EMAIL, SANType::stIP = GEN_IPADD }
 The SubjectAltName type. More...
 
enum  X509Type {
  X509Type::Unknown, X509Type::PrivateKey, X509Type::PublicKey, X509Type::CertificateSigningRequest,
  X509Type::Certificate
}
 Enumeration of X509 document types. More...
 

Static Public Member Functions

static X509Type detectX509Type (const std::string file, std::string &tag)
 Detects a X509 document type from a PEM file. More...
 
static std::string SANTypeAsString (const SANType &san_type)
 Convert the SANType name to a string. More...
 

Static Protected Member Functions

static Identity parseIdentity (const std::string src)
 Parse a subject or issuer string into an Identity. More...
 

Private Member Functions

 X509Common ()=delete
 Never construct, interface class. More...
 
 ~X509Common ()=delete
 Never destruct, interface class. More...
 

Detailed Description

Interface common to X509 documents.

See Secure sockets for details on the role of this class.

Definition at line 39 of file x509cert.hpp.

Member Enumeration Documentation

◆ SANType

The SubjectAltName type.

Enumerator
stDNS 

A DNS name such as myhost.mydomain.org.

stURI 

An URI.

stEMAIL 

An email address.

stIP 

An IPv4 or IPv6 address.

Definition at line 45 of file x509cert.hpp.

◆ X509Type

Enumeration of X509 document types.

Enumerator
Unknown 

Unknown PEM document.

PrivateKey 

Private key PEM document (possibly encrypted).

PublicKey 

Public key PEM document.

CertificateSigningRequest 

CSR PEM document.

Certificate 

Certificate PEM document.

Definition at line 165 of file x509cert.hpp.

Constructor & Destructor Documentation

◆ X509Common()

dodo::network::X509Common::X509Common ( )
privatedelete

Never construct, interface class.

◆ ~X509Common()

dodo::network::X509Common::~X509Common ( )
privatedelete

Never destruct, interface class.

Member Function Documentation

◆ detectX509Type()

X509Common::X509Type dodo::network::X509Common::detectX509Type ( const std::string  file,
std::string &  tag 
)
static

Detects a X509 document type from a PEM file.

The PEM is not checked on validity, and a result other than X509Type::Unknown does not imply the document is well formed and valid. Note that both private key and encrypted private key PEM files are identified as X509Type::PrivateKey.

Parameters
fileThe file name to be content-checked.
tagReceives the PEM tag (eg 'CERTIFICATE','PRIVATE KEY',..).
Returns
the X509Type.

Definition at line 41 of file x509cert.cpp.

References Certificate, CertificateSigningRequest, PrivateKey, PublicKey, and Unknown.

◆ parseIdentity()

◆ SANTypeAsString()

static std::string dodo::network::X509Common::SANTypeAsString ( const SANType san_type)
inlinestatic

Convert the SANType name to a string.

Parameters
san_typeThe SANType to convert.
Returns
the string representation.

Definition at line 57 of file x509cert.hpp.

References stDNS, stEMAIL, stIP, and stURI.


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