PcapPlusPlus  Next
pcpp::X509Certificate Class Reference

#include <X509Decoder.h>

Inheritance diagram for pcpp::X509Certificate:
pcpp::internal::CryptoDataReader< X509Certificate >

Public Member Functions

X509Version getVersion () const
 
X509SerialNumber getSerialNumber () const
 
X509Name getIssuer () const
 
X509Name getSubject () const
 
X509Timestamp getNotBefore () const
 
X509Timestamp getNotAfter () const
 
X509Algorithm getPublicKeyAlgorithm () const
 
X509Key getPublicKey () const
 
X509Algorithm getSignatureAlgorithm () const
 
X509Key getSignature () const
 
const std::vector< X509Extension > & getExtensions () const
 
bool hasExtension (const X509ExtensionType &extensionType) const
 
const X509ExtensiongetExtension (X509ExtensionType extensionType) const
 
std::vector< uint8_t > toDER () const
 
std::string toPEM () const
 
std::string toJson (int indent=-1) const
 
const X509Internal::X509CertificategetRawCertificate () const
 

Additional Inherited Members

- Static Public Member Functions inherited from pcpp::internal::CryptoDataReader< X509Certificate >
static std::unique_ptr< X509CertificatefromDER (uint8_t *derData, size_t derDataLen, bool ownDerData=false)
 
static std::unique_ptr< X509CertificatefromDER (const std::string &derData)
 
static std::unique_ptr< X509CertificatefromDERFile (const std::string &derFileName)
 
static std::unique_ptr< X509CertificatefromPEM (const std::string &pemData)
 
static std::unique_ptr< X509CertificatefromPEMFile (const std::string &pemFileName)
 

Detailed Description

Represents an X.509 certificate

Member Function Documentation

◆ getExtension()

const X509Extension* pcpp::X509Certificate::getExtension ( X509ExtensionType  extensionType) const

Gets an extension by its type

Parameters
[in]extensionTypeThe type of extension to get
Returns
Pointer to the extension if found or nullptr otherwise

◆ getExtensions()

const std::vector<X509Extension>& pcpp::X509Certificate::getExtensions ( ) const

Gets the list of extensions in the certificate

Returns
A vector containing the certificate's extensions

◆ getIssuer()

X509Name pcpp::X509Certificate::getIssuer ( ) const

Gets the issuer of the certificate

Returns
The certificate's issuer name

◆ getNotAfter()

X509Timestamp pcpp::X509Certificate::getNotAfter ( ) const

Gets the notAfter timestamp of the certificate's validity period

Returns
The notAfter timestamp

◆ getNotBefore()

X509Timestamp pcpp::X509Certificate::getNotBefore ( ) const

Gets the notBefore timestamp of the certificate's validity period

Returns
The notBefore timestamp

◆ getPublicKey()

X509Key pcpp::X509Certificate::getPublicKey ( ) const

Gets the public key from the certificate

Returns
The public key

◆ getPublicKeyAlgorithm()

X509Algorithm pcpp::X509Certificate::getPublicKeyAlgorithm ( ) const

Gets the public key algorithm used in the certificate

Returns
The public key algorithm

◆ getRawCertificate()

const X509Internal::X509Certificate* pcpp::X509Certificate::getRawCertificate ( ) const

Gets the raw internal certificate object

Returns
Pointer to the internal X509Certificate implementation

◆ getSerialNumber()

X509SerialNumber pcpp::X509Certificate::getSerialNumber ( ) const

Gets the serial number of the certificate

Returns
The certificate's serial number

◆ getSignature()

X509Key pcpp::X509Certificate::getSignature ( ) const

Gets the signature of the certificate

Returns
The certificate's signature

◆ getSignatureAlgorithm()

X509Algorithm pcpp::X509Certificate::getSignatureAlgorithm ( ) const

Gets the signature algorithm used to sign the certificate

Returns
The signature algorithm

◆ getSubject()

X509Name pcpp::X509Certificate::getSubject ( ) const

Gets the subject of the certificate

Returns
The certificate's subject name

◆ getVersion()

X509Version pcpp::X509Certificate::getVersion ( ) const

Gets the version of the certificate

Returns
The X509Version of the certificate

◆ hasExtension()

bool pcpp::X509Certificate::hasExtension ( const X509ExtensionType extensionType) const

Checks if the certificate has a specific extension

Parameters
[in]extensionTypeThe extension type to check for
Returns
true if the extension is present, false otherwise

◆ toDER()

std::vector<uint8_t> pcpp::X509Certificate::toDER ( ) const

Converts the certificate to DER-encoded format

Returns
A byte vector containing the DER-encoded data

◆ toJson()

std::string pcpp::X509Certificate::toJson ( int  indent = -1) const

Converts the certificate to a JSON string representation

Parameters
[in]indentNumber of spaces to use for indentation (-1 for no pretty printing)
Returns
A JSON string representation of the certificate

◆ toPEM()

std::string pcpp::X509Certificate::toPEM ( ) const

Converts the certificate to PEM-encoded format

Returns
A string containing the PEM-encoded data