4.12. SSLCertificate Class

SSLCertificate objects are designed to work with X.509 certificate data.

Table 4.536. SSLCertificate Class Method Overview

Method

Except?

Description

SSLCertificate::constructor(string$cert_pem)

SSLCertificate::constructor(binary$cert_der)

Y

Creates the SSLCertificate object from the filename argument passed; as a deprecated, backwards-compatibilty extension, if the string variant is used and a string less then 200 bytes long is passed, it is taken as a filename to use to load the private key data from in PEM format. In this case PO_NO_FILESYSTEM is checked at run-time; if set, and exception is thrown.

SSLCertificate::destructor()

N

Destroys the SSLCertificate object.

SSLCertificate::copy()

Y

Copying objects of this class is not supported, an exception will be thrown.

stringSSLCertificate::getPEM()

N

Returns a string in PEM format representing the certificate.

intSSLCertificate::getVersion()

N

Returns the version of the certificate.

stringSSLCertificate::getSignatureType()

N

Returns the signature type of the certificate.

binarySSLCertificate::getSignature()

N

Returns a binary object representing the signature of the certificate.

stringSSLCertificate::getPublicKeyAlgorithm()

N

Returns name of the public key algorithm of the certificate.

*binarySSLCertificate::getPublicKey()

N

Returns a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format or NOTHING if the public key cannot be retrieved.

hashSSLCertificate::getSubjectHash()

N

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

hashSSLCertificate::getIssuerHash()

N

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

intSSLCertificate::getSerialNumber()

N

Returns the integer serial number of the certificate.

hashSSLCertificate::getPurposeHash()

N

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

dateSSLCertificate::getNotBeforeDate()

N

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

dateSSLCertificate::getNotAfterDate()

N

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

hashSSLCertificate::getInfo()

N

Returns a hash of all information for the certificate.


4.12.1. SSLCertificate::constructor()

Synopsis

Creates the SSLCertificate object from the argument passed. If a string is passed, the value is assumed to be the PEM representation of the certificate; if a binary is passed, the value is assumed to be the DER-encoded form of the certificate.

DEPRECATED: If a string is passed that is less than 200 bytes long, the string is assumed to be a file name; in which case the PO_NO_FILESYSTEM parse option is checked at run-time; if this restriction is not set, then the certificate is loaded from the filename (in this case, the certificate must be in PEM format). Do not use this feature; load the file first and pass the data to the constructor instead. This functionality will be removed in a future release of Qore.

Prototype

SSLCertificate::constructor(string$cert_pem)

SSLCertificate::constructor(binary$cert_der)

Example
my SSLCertificate $cert($pem_cert_string);

Table 4.537. Arguments for SSLCertificate::constructor()

Argument

Description

string$cert_pem, string$pass = ""

The PEM-encoded text representation of the X509 certificate.

binary$cert_der

The DER-encoded binary representation of the X509 certificate.


Table 4.538. Exceptions thrown by SSLCertificate::constructor()

err

desc

SSLCERTIFICATE-CONSTRUCTOR-ERROR

missing or invalid argument, unable to parse file, etc


4.12.2. SSLCertificate::destructor()

Synopsis

Destroys the SSLCertificate object.

Example
delete $cert;

4.12.3. SSLCertificate::copy()

Synopsis

Copying objects of this class is not supported, an exception will be thrown.

Table 4.539. Exceptions thrown by SSLCertificate::copy()

err

desc

SSLCERTIFICATE-COPY-ERROR

objects of this class may not be copied


4.12.4. SSLCertificate::getPEM()

Synopsis

Returns a string in PEM format representing the certificate.

Prototype

stringSSLCertificate::getPEM()

Example
$pem_str = $cert.getPEM();

Table 4.540. Return Values for SSLCertificate::getPEM()

Return Type

Description

string

A string in PEM format representing the certificate.


4.12.5. SSLCertificate::getVersion()

Synopsis

Returns the version of the certificate as an integer.

Prototype

intSSLCertificate::getVersion()

Example
$int = $cert.getVersion();

Table 4.541. Return Values for SSLCertificate::getVersion()

Return Type

Description

int

The version of the certificate.


4.12.6. SSLCertificate::getSignatureType()

Synopsis

Returns the signature type of the certificate.

Prototype

stringSSLCertificate::getSignatureType()

Example
$str = $cert.getSignatureType();

Table 4.542. Return Values for SSLCertificate::getSignatureType()

Return Type

Description

string

The signature type of the certificate.


4.12.7. SSLCertificate::getSignature()

Synopsis

Returns a binary object representing the signature of the certificate.

Prototype

binarySSLCertificate::getSignature()

Example
$bin = $cert.getSignature();

Table 4.543. Return Values for SSLCertificate::getSignature()

Return Type

Description

binary

The signature data for the certificate.


4.12.8. SSLCertificate::getPublicKeyAlgorithm()

Synopsis

Returns name of the public key algorithm of the certificate.

Prototype

stringSSLCertificate::getPublicKeyAlgorithm()

Example
$str = $cert.getPublicKeyAlgorithm();

Table 4.544. Return Values for SSLCertificate::getPublicKeyAlgorithm()

Return Type

Description

string

The name of the public key algorithm of the certificate.


4.12.9. SSLCertificate::getPublicKey()

Synopsis

Returns a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format.

Prototype

*binarySSLCertificate::getPublicKey()

Example
my *binary $bin = $cert.getPublicKey();

Table 4.545. Return Values for SSLCertificate::getPublicKey()

Return Type

Description

*binary

The public key of the certificate in DER format.


4.12.10. SSLCertificate::getSubjectHash()

Synopsis

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

Prototype

hashSSLCertificate::getSubjectHash()

Example
$hash = $cert.getSubjectHash();

Table 4.546. Return Values for SSLCertificate::getSubjectHash()

Return Type

Description

hash

Key-value pairs representing the subject information of the certificate.


4.12.11. SSLCertificate::getIssuerHash()

Synopsis

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

Prototype

hashSSLCertificate::getIssuerHash()

Example
$hash = $cert.getIssuerHash();

Table 4.547. Return Values for SSLCertificate::getIssuerHash()

Return Type

Description

hash

Key-value pairs representing the issuer information of the certificate.


4.12.12. SSLCertificate::getSerialNumber()

Synopsis

Returns the integer serial number of the certificate.

Prototype

intSSLCertificate::getSerialNumber()

Example
$hash = $cert.getIssuerHash();

Table 4.548. Return Values for SSLCertificate::getSerialNumber()

Return Type

Description

int

The serial number of the certificate.


4.12.13. SSLCertificate::getPurposeHash()

Synopsis

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

Prototype

hashSSLCertificate::getPurposeHash()

Example
$hash = $cert.getPurposeHash();

Table 4.549. Return Values for SSLCertificate::getPurposeHash()

Return Type

Description

hash

Key-value pairs representing the allowed purposes of the certificate.


4.12.14. SSLCertificate::getNotBeforeDate()

Synopsis

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

Prototype

dateSSLCertificate::getNotBeforeDate()

Example
$date = $cert.getNotBeforeDate();

Table 4.550. Return Values for SSLCertificate::getNotBeforeDate()

Return Type

Description

date

The start date of the certificate.


4.12.15. SSLCertificate::getNotAfterDate()

Synopsis

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

Prototype

dateSSLCertificate::getNotAfterDate()

Example
$date = $cert.getNotAfterDate();

Table 4.551. Return Values for SSLCertificate::getNotAfterDate()

Return Type

Description

date

The end date of the certificate.


4.12.16. SSLCertificate::getInfo()

Synopsis

Returns a hash of all information for the certificate.

Prototype

hashSSLCertificate::getInfo()

Example
$hash = $cert.getInfo();

Table 4.552. Return Values for SSLCertificate::getInfo()

Return Type

Description

hash

Keys are 'version', 'serialNumber', 'subject', 'issuer', 'purposes', 'notBefore', 'notAfter', 'signatureType', 'signature', and 'publicKey' corresponding to the respective attributes of the certificate.


There are no comments yet

Leave a Comment



?
? ?
?

 
Powered by TalkBack