PLCnext API Documentation
22.9.0.33
|
Class to handle x.509 certificates More...
#include <Certificate.hpp>
Public Member Functions | |
Certificate (void) | |
Constructs an empty Certificate instance to be loaded from file or memory. More... | |
Certificate (const String &filename) | |
Constructs an Certificate instance load from a file More... | |
Certificate (const std::vector< byte > &pemOrDerEncoding) | |
Constructs an Certificate instance load from memory More... | |
Certificate (const Certificate &arg) | |
Copy constructor. More... | |
virtual Certificate & | operator= (const Certificate &arg) |
Assignment operator. More... | |
virtual | ~Certificate (void) |
Destructs this instance and frees all resources. More... | |
operator X509 * () const | |
implicit conversion operator to openssl X509* More... | |
const String & | GetFilename (void) const |
returns the filename were this x.509 certificate was loaded from More... | |
String | GetSerialNumberHex (void) const |
returns the filename were this x.509 certificate was loaded from More... | |
String | GetSubject (void) const |
returns the subject of the x.509 certificate as string (rfc2253 formatted) More... | |
String | GetSubjectCommonName (void) const |
returns the common name of the subject More... | |
String | GetSubjectSerialNumber (void) const |
return the serialnumber of the subject as string More... | |
String | GetIssuer (void) const |
returns the issuer of the x.509 certificate as string (rfc2253 formatted) More... | |
String | GetIssuerCommonName (void) const |
returns the common name of the issuer More... | |
const String & | GetIdentifier (void) const |
returns an unique identifier for this certificate as string (sha256 hash of the x.509 certificate) More... | |
DateTime | GetValidityNotBefore (void) const |
returns the notBefore field of the x.509 as DateTime object More... | |
Asn1Time | GetValidityNotBeforeAsn1 (void) const |
returns the notBefore field of the x.509 as Asn1Time object More... | |
DateTime | GetValidityNotAfter (void) const |
returns the notAfter field of the x.509 as DateTime object More... | |
Asn1Time | GetValidityNotAfterAsn1 (void) const |
returns the notAfter field of the x.509 as Asn1Time object More... | |
std::vector< byte > | GetPemData (void) const |
returns the certificate encoded in PEM format More... | |
std::vector< byte > | GetDerData (void) const |
returns the certificate encoded in DER format More... | |
ItemInfo | GetItemInfo (void) const |
returns ItemInfo for the Certificate More... | |
void | LoadFromFile (const String &filename) |
loads the certificate from a file. File can be PEM or DER encoded More... | |
int | LoadFromMemory (const std::vector< byte > &data, int offset=0) |
loads the certificate from memory. byte vector can be PEM or DER encoded More... | |
bool | TryLoadFromMemory (const std::vector< byte > &data, int &offset) |
tries to load the certificate from memory. byte vector can be PEM or DER encoded More... | |
bool | TryLoadFromBio (OpenSslBio &bio, int &offset) |
tries to load the certificate from OpenSslBio. More... | |
void | SaveToFilePem (const String &filename) const |
saves the certificate in PEM format to filename More... | |
void | AppendToFilePem (const String &filename) const |
appends the certificate in PEM format to filename More... | |
void | SaveToFileDer (const String &filename) const |
saves the certificate in DER format to filename More... | |
Static Public Member Functions | |
static String | Rfc2253Format (X509_NAME *name) |
static function to convert an openssl X509_NAME to an rfc2253 string More... | |
static String | GetAttributeValueByNid (X509_NAME *name, int nid) |
static function to extract an attribute value out of an openssl X509_NAME object identified by NID More... | |
static String | HexString (ASN1_INTEGER *integer) |
static function convert an openssl ASN1_INTEGER to hexadecimal String representation More... | |
Protected Attributes | |
String | identifier |
X509 * | internalCertificate |
Class to handle x.509 certificates
Arp::System::Commons::Security::Certificate::Certificate | ( | void | ) |
Constructs an empty Certificate instance to be loaded from file or memory.
Arp::System::Commons::Security::Certificate::Certificate | ( | const String & | filename | ) |
Constructs an Certificate instance load from a file
Arp::System::Commons::Security::Certificate::Certificate | ( | const std::vector< byte > & | pemOrDerEncoding | ) |
Constructs an Certificate instance load from memory
Arp::System::Commons::Security::Certificate::Certificate | ( | const Certificate & | arg | ) |
Copy constructor.
|
virtual |
Destructs this instance and frees all resources.
void Arp::System::Commons::Security::Certificate::AppendToFilePem | ( | const String & | filename | ) | const |
appends the certificate in PEM format to filename
|
static |
static function to extract an attribute value out of an openssl X509_NAME object identified by NID
name | pointer to the openssl X509_NAME object where the attribute value should be extracted from |
nid | nid of the attribute which should be extracted |
std::vector<byte> Arp::System::Commons::Security::Certificate::GetDerData | ( | void | ) | const |
returns the certificate encoded in DER format
|
inline |
returns the filename were this x.509 certificate was loaded from
const String& Arp::System::Commons::Security::Certificate::GetIdentifier | ( | void | ) | const |
returns an unique identifier for this certificate as string (sha256 hash of the x.509 certificate)
String Arp::System::Commons::Security::Certificate::GetIssuer | ( | void | ) | const |
returns the issuer of the x.509 certificate as string (rfc2253 formatted)
String Arp::System::Commons::Security::Certificate::GetIssuerCommonName | ( | void | ) | const |
returns the common name of the issuer
ItemInfo Arp::System::Commons::Security::Certificate::GetItemInfo | ( | void | ) | const |
returns ItemInfo for the Certificate
std::vector<byte> Arp::System::Commons::Security::Certificate::GetPemData | ( | void | ) | const |
returns the certificate encoded in PEM format
String Arp::System::Commons::Security::Certificate::GetSerialNumberHex | ( | void | ) | const |
returns the filename were this x.509 certificate was loaded from
String Arp::System::Commons::Security::Certificate::GetSubject | ( | void | ) | const |
returns the subject of the x.509 certificate as string (rfc2253 formatted)
String Arp::System::Commons::Security::Certificate::GetSubjectCommonName | ( | void | ) | const |
returns the common name of the subject
String Arp::System::Commons::Security::Certificate::GetSubjectSerialNumber | ( | void | ) | const |
return the serialnumber of the subject as string
DateTime Arp::System::Commons::Security::Certificate::GetValidityNotAfter | ( | void | ) | const |
returns the notAfter field of the x.509 as DateTime object
Asn1Time Arp::System::Commons::Security::Certificate::GetValidityNotAfterAsn1 | ( | void | ) | const |
returns the notAfter field of the x.509 as Asn1Time object
DateTime Arp::System::Commons::Security::Certificate::GetValidityNotBefore | ( | void | ) | const |
returns the notBefore field of the x.509 as DateTime object
Asn1Time Arp::System::Commons::Security::Certificate::GetValidityNotBeforeAsn1 | ( | void | ) | const |
returns the notBefore field of the x.509 as Asn1Time object
|
static |
static function convert an openssl ASN1_INTEGER to hexadecimal String representation
integer | pointer to the openssl ASN1_INTEGER object which should be converted to hexadecimal string representation |
void Arp::System::Commons::Security::Certificate::LoadFromFile | ( | const String & | filename | ) |
loads the certificate from a file. File can be PEM or DER encoded
int Arp::System::Commons::Security::Certificate::LoadFromMemory | ( | const std::vector< byte > & | data, |
int | offset = 0 |
||
) |
loads the certificate from memory. byte vector can be PEM or DER encoded
|
inline |
implicit conversion operator to openssl X509*
|
virtual |
Assignment operator.
|
static |
static function to convert an openssl X509_NAME to an rfc2253 string
void Arp::System::Commons::Security::Certificate::SaveToFileDer | ( | const String & | filename | ) | const |
saves the certificate in DER format to filename
void Arp::System::Commons::Security::Certificate::SaveToFilePem | ( | const String & | filename | ) | const |
saves the certificate in PEM format to filename
bool Arp::System::Commons::Security::Certificate::TryLoadFromBio | ( | OpenSslBio & | bio, |
int & | offset | ||
) |
tries to load the certificate from OpenSslBio.
bool Arp::System::Commons::Security::Certificate::TryLoadFromMemory | ( | const std::vector< byte > & | data, |
int & | offset | ||
) |
tries to load the certificate from memory. byte vector can be PEM or DER encoded