Qore Programming Language Reference Manual  0.9.1
Qore::SSLCertificate Class Reference

SSLCertificate objects allow Qore code to work with X.509 certificate data. More...

Inheritance diagram for Qore::SSLCertificate:

Public Member Methods

 constructor (string pem)
 Creates the SSLCertificate object from the PEM-encoded version of the X.509 certificate. More...
 
 constructor (binary der)
 Creates the SSLCertificate object from the DER-encoded version of the X.509 certificate. More...
 
 copy ()
 Returns a copy of the certificate object. More...
 
binary getDER ()
 Returns a binary object in DER format representing the certificate. More...
 
hash< auto > getInfo ()
 Returns a hash of all information for the certificate. More...
 
hash getIssuerHash ()
 Returns a hash of strings representing the issuer information of the certificate. More...
 
date getNotAfterDate ()
 Returns a date/time value representing the end date of the certificate. More...
 
date getNotBeforeDate ()
 Returns a date/time value representing the start date of the certificate. More...
 
string getPEM ()
 Returns a string in PEM format representing the certificate. More...
 
*binary getPublicKey ()
 Returns a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format or NOTHING if no public key is present in the certificate. More...
 
string getPublicKeyAlgorithm ()
 Returns the name of the public key algorithm of the certificate. More...
 
hash getPurposeHash ()
 Returns a hash of booleans representing the allowed purposes of the certificate. More...
 
int getSerialNumber ()
 Returns the integer serial number of the certificate. More...
 
binary getSignature ()
 Returns a binary object representing the signature of the certificate. More...
 
string getSignatureType ()
 Returns the signature type of the certificate. More...
 
hash getSubjectHash ()
 Returns a hash of strings representing the subject information of the certificate. More...
 
int getVersion ()
 Returns the version of the certificate as an integer. More...
 
- Public Member Methods inherited from Qore::Serializable
 constructor ()
 The constructor does not perform any action; this class is just used to mark a class as serializable by inheriting this class.
 
 copy ()
 The copy constructor does not perform any action; this class is just used to mark a class as serializable by inheriting this class.
 
 serialize (OutputStream stream)
 converts the object to binary data representing the object More...
 
binary serialize ()
 converts the object to binary data representing the object More...
 
hash< SerializationInfoserializeToData ()
 converts the object to a serialization hash representing the object More...
 

Additional Inherited Members

- Static Public Member Methods inherited from Qore::Serializable
static auto deserialize (InputStream stream)
 Deserializes data produced with serialize() and returns the value represented by the data. More...
 
static auto deserialize (binary bin)
 Deserializes data produced with serialize() and returns the value represented by the data. More...
 
static auto deserialize (hash< SerializationInfo > data)
 Deserializes data produced with serializeToData() and returns the value represented by the data. More...
 
static hash< SerializationInfodeserializeToData (InputStream stream)
 Deserializes data produced with serialize() and returns the value represented by the data. More...
 
static hash< SerializationInfodeserializeToData (binary bin)
 Deserializes data produced with serialize() and returns the value represented by the data. More...
 
static serialize (auto val, OutputStream stream)
 serializes the data and writes the serialized data to the given output stream More...
 
static binary serialize (auto val)
 serializes the data and returns the serialized data as a binary object More...
 
static hash< SerializationInfoserializeToData (auto val)
 converts the value to a serialization hash representing the value More...
 

Detailed Description

SSLCertificate objects allow Qore code to work with X.509 certificate data.

The SSLCertificate class supports data serialization; note that the serialized data is a representation of the data that does not require a password, so for source data that requires a password to use, the serialized representation of the private key should be protected carefully (transmitted only in an encrypted stream)

Member Function Documentation

◆ constructor() [1/2]

Qore::SSLCertificate::constructor ( string  pem)

Creates the SSLCertificate object from the PEM-encoded version of the X.509 certificate.

Parameters
pemthe PEM representation of the X.509 certificate
Example:
SSLCertificate cert(pem_cert_string);
Exceptions
SSLCERTIFICATE-CONSTRUCTOR-ERRORinvalid X.509 certificate data
Since
0.8.4: the deprecated functionality where the if the string passed was less than 200 bytes long, it was assumed to be a file name has been removed; the string is assumed to be the PEM-encoded X.509 Certificate itself

◆ constructor() [2/2]

Qore::SSLCertificate::constructor ( binary  der)

Creates the SSLCertificate object from the DER-encoded version of the X.509 certificate.

Parameters
derthe DER-encoded representation of the X.509 certificate
Example:
SSLCertificate cert(der_cert);
Exceptions
SSLCERTIFICATE-CONSTRUCTOR-ERRORinvalid X.509 certificate data

◆ copy()

Qore::SSLCertificate::copy ( )

Returns a copy of the certificate object.

Since
Qore 0.9

◆ getDER()

binary Qore::SSLCertificate::getDER ( )

Returns a binary object in DER format representing the certificate.

Code Flags:
RET_VALUE_ONLY
Example:
binary der = cert.getDER();
Returns
a binary object in DER format representing the certificate
Exceptions
SSLPRIVATEKEY-ERRORcould not create DER data from certificate data
Since
Qore 0.9

◆ getInfo()

hash<auto> Qore::SSLCertificate::getInfo ( )

Returns a hash of all information for the certificate.

Returns
a hash of all information for the certificate with the following keys:
Code Flags:
CONSTANT
Example:
hash<auto> h = cert.getInfo();

◆ getIssuerHash()

hash Qore::SSLCertificate::getIssuerHash ( )

Returns a hash of strings representing the issuer information of the certificate.

Returns
a hash of key-value pairs representing the issuer information of the certificate
Code Flags:
CONSTANT
Example:
hash h = cert.getIssuerHash();

◆ getNotAfterDate()

date Qore::SSLCertificate::getNotAfterDate ( )

Returns a date/time value representing the end date of the certificate.

Returns
a date/time value representing the end date of the certificate
Code Flags:
CONSTANT
Example:
date end = cert.getNotAfterDate();

◆ getNotBeforeDate()

date Qore::SSLCertificate::getNotBeforeDate ( )

Returns a date/time value representing the start date of the certificate.

Returns
a date/time value representing the start date of the certificate
Code Flags:
CONSTANT
Example:
date start = cert.getNotBeforeDate();

◆ getPEM()

string Qore::SSLCertificate::getPEM ( )

Returns a string in PEM format representing the certificate.

Returns
a string in PEM format representing the certificate
Example:
string pem_str = cert.getPEM();
Exceptions
X509-ERRORcould not create PEM string from X509 certificate data

◆ getPublicKey()

*binary Qore::SSLCertificate::getPublicKey ( )

Returns a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format or NOTHING if no public key is present in the certificate.

Returns
a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format or NOTHING if no public key is present in the certificate
Code Flags:
CONSTANT
Example:
*binary bin = cert.getPublicKey();

◆ getPublicKeyAlgorithm()

string Qore::SSLCertificate::getPublicKeyAlgorithm ( )

Returns the name of the public key algorithm of the certificate.

Returns
the name of the public key algorithm of the certificate
Code Flags:
CONSTANT
Example:
string str = cert.getPublicKeyAlgorithm();

◆ getPurposeHash()

hash Qore::SSLCertificate::getPurposeHash ( )

Returns a hash of booleans representing the allowed purposes of the certificate.

Returns
a hash of booleans representing the allowed purposes of the certificate
Code Flags:
CONSTANT
Example:
hash h = cert.getPurposeHash();

◆ getSerialNumber()

int Qore::SSLCertificate::getSerialNumber ( )

Returns the integer serial number of the certificate.

Returns
the integer serial number of the certificate
Code Flags:
CONSTANT
Example:
int sn = cert.getSerialNumber();

◆ getSignature()

binary Qore::SSLCertificate::getSignature ( )

Returns a binary object representing the signature of the certificate.

Returns
a binary object representing the signature of the certificate
Code Flags:
CONSTANT
Example:
binary bin = cert.getSignature();

◆ getSignatureType()

string Qore::SSLCertificate::getSignatureType ( )

Returns the signature type of the certificate.

Returns
the signature type of the certificate
Code Flags:
CONSTANT
Example:
string str = cert.getSignatureType();

◆ getSubjectHash()

hash Qore::SSLCertificate::getSubjectHash ( )

Returns a hash of strings representing the subject information of the certificate.

Returns
a hash of key-value pairs representing the subject information of the certificate
Code Flags:
CONSTANT
Example:
hash h = cert.getSubjectHash();

◆ getVersion()

int Qore::SSLCertificate::getVersion ( )

Returns the version of the certificate as an integer.

Returns
the version of the certificate as an integer
Code Flags:
CONSTANT
Example:
int ver = cert.getVersion();