All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::Crypto::X509Certificate Class Reference

#include <X509Certificate.h>

Public Member Functions

 X509Certificate (const X509Certificate &other)
 
X509Certificateoperator= (const X509Certificate &other)
 
 ~X509Certificate ()
 
void Destroy ()
 
 X509Certificate (const UString &in_certificate_path)
 
 X509Certificate (const std::vector< UChar > &in_cert_buf)
 
 X509Certificate (const UChar *in_cert_buf, size_t in_cert_buf_size)
 
X501DistinguishedName GetIssuerField () const
 
X501DistinguishedName GetSubjectField () const
 
Int64 GetNotBeforeEpochTime () const
 
Int64 GetNotAfterEpochTime () const
 
UInt32 GetRawX509VersionNumber () const
 
UString ToString () const
 
UString GetFingerprint (const enum DigestAlgorithm::Type in_digest_algorithm=DigestAlgorithm::e_SHA256) const
 
std::vector< UCharGetSerialNumber () const
 
std::vector< X509ExtensionGetExtensions () const
 
std::vector< UCharGetData () const
 
 X509Certificate (TRN_X509Certificate impl)
 

Public Attributes

TRN_X509Certificate m_impl
 

Detailed Description

This class represents an X509 public-key certificate, as specified in RFC 5280.

Definition at line 22 of file X509Certificate.h.

Constructor & Destructor Documentation

pdftron::Crypto::X509Certificate::X509Certificate ( const X509Certificate other)
pdftron::Crypto::X509Certificate::~X509Certificate ( )
pdftron::Crypto::X509Certificate::X509Certificate ( const UString in_certificate_path)

Constructor from filepath. The input must be in DER, BER, or PEM encoding. The certificate must be in X.509 format.

Parameters
in_certificate_path– the path to the file containing the certificate
pdftron::Crypto::X509Certificate::X509Certificate ( const std::vector< UChar > &  in_cert_buf)

Constructor from buffer. The input must be in DER, BER, or PEM encoding. The certificate must be in X.509 format.

Parameters
in_cert_buf– a buffer containing the certificate
pdftron::Crypto::X509Certificate::X509Certificate ( const UChar in_cert_buf,
size_t  in_cert_buf_size 
)

Constructor from buffer. The input must be in DER, BER, or PEM encoding. The certificate must be in X.509 format.

Parameters
in_cert_buf– a buffer containing the certificate
in_cert_buf_size– the size of the buffer
pdftron::Crypto::X509Certificate::X509Certificate ( TRN_X509Certificate  impl)

Member Function Documentation

void pdftron::Crypto::X509Certificate::Destroy ( )
std::vector<UChar> pdftron::Crypto::X509Certificate::GetData ( ) const

Retrieves the certificate as binary DER-encoded data. (DER is short for Distinguished Encoding Rules.).

Returns
a container of bytes representing the certificate, encoded as binary DER.
std::vector<X509Extension> pdftron::Crypto::X509Certificate::GetExtensions ( ) const

Retrieves all extensions (as first specified in V3 of X509, see RFC 5280) from the certificate.

Returns
a container of X509Extension objects.
UString pdftron::Crypto::X509Certificate::GetFingerprint ( const enum DigestAlgorithm::Type  in_digest_algorithm = DigestAlgorithm::e_SHA256) const

Retrieves, in a string, a text representation of a cryptographically-secure digest of the certificate that can be used to identify it uniquely.

Parameters
in_digest_algorithmAn enumeration representing the digest algorithm to use. Currently supported are SHA-1 (SHA-160), SHA-256, SHA-384, and SHA-512.
Returns
a string representation of the fingerprint, in the form of double ASCII characters representing hex bytes, separated by colons
Note
Default algorithm parameter is currently SHA-256, but may change in future without further warning, pursuant to security needs.
X501DistinguishedName pdftron::Crypto::X509Certificate::GetIssuerField ( ) const

Retrieves the names of the certificate issuer as a map of OIDs (i.e. one of the object identifiers from the X.500 attribute types) to string values. The issuer field identifies the entity that has signed and issued the certificate. The returned value will contain all of the AttributeTypeAndValue items from all of the RelativeDistinguishedNames in the Name of the issuer. See RFC 5280, section 4.1.2.4 and Appendix A.1 (page 116).

Returns
an X501DistinguishedName object
Int64 pdftron::Crypto::X509Certificate::GetNotAfterEpochTime ( ) const

Retrieves the notAfter time from the certificate's Validity entry in the form of an integral value representing an epoch time.

Returns
an integer containing an epoch time
Int64 pdftron::Crypto::X509Certificate::GetNotBeforeEpochTime ( ) const

Retrieves the notBefore time from the certificate's Validity entry in the form of an integral value representing an epoch time.

Returns
an integer containing an epoch time
UInt32 pdftron::Crypto::X509Certificate::GetRawX509VersionNumber ( ) const

Retrieves the version number representing which version of X509 the certificate corresponds to, from the certificate.

Returns
an integer containing the version number
Note
The X509 version number in the certificate, which we return unchanged here, is zero-indexed and therefore is one less in value than the actual version. e.g. X509v3 is represented by a returned version number of 2.
std::vector<UChar> pdftron::Crypto::X509Certificate::GetSerialNumber ( ) const

Retrieves the serialNumber entry from the certificate.

Returns
a big-integer-style container holding bytes representing the components of an integral serial number in big-endian order.
X501DistinguishedName pdftron::Crypto::X509Certificate::GetSubjectField ( ) const

Retrieves the names of the certificate subject as a map of OIDs (i.e. one of the object identifiers from the X.500 attribute types) to string values. The subject field represents the identity of the entity associated with the certificate's public key. The returned value will contain all of the AttributeTypeAndValue items from all of the RelativeDistinguishedNames in the Name of the subject. See RFC 5280, section 4.1.2.6 and Appendix A.1 (page 116).

Returns
an X501DistinguishedName object
X509Certificate& pdftron::Crypto::X509Certificate::operator= ( const X509Certificate other)
UString pdftron::Crypto::X509Certificate::ToString ( ) const

Returns a string representation of the certificate.

Returns
a string representation of the certificate.
Note
Output may change in future versions.

Member Data Documentation

TRN_X509Certificate pdftron::Crypto::X509Certificate::m_impl

Definition at line 148 of file X509Certificate.h.


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