4.14. SSLCertificate Class

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

Table 4.669. SSLCertificate Class Method Overview

Method

Except?

Description

SSLCertificate::constructor()

Y

Creates the SSLCertificate object from the filename argument passed.

SSLCertificate::destructor()

N

Destroys the SSLCertificate object.

SSLCertificate::copy()

Y

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

SSLCertificate::getPEM()

N

Returns a string in PEM format representing the certificate.

SSLCertificate::getVersion()

N

Returns the version of the certificate.

SSLCertificate::getSignatureType()

N

Returns the signature type of the certificate.

SSLCertificate::getSignature()

N

Returns a binary object representing the signature of the certificate.

SSLCertificate::getPublicKeyAlgorithm()

N

Returns name of the public key algorithm of the certificate.

SSLCertificate::getPublicKey()

N

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

SSLCertificate::getSubjectHash()

N

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

SSLCertificate::getIssuerHash()

N

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

SSLCertificate::getSerialNumber()

N

Returns the integer serial number of the certificate.

SSLCertificate::getPurposeHash()

N

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

SSLCertificate::getNotBeforeDate()

N

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

SSLCertificate::getNotAfterDate()

N

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

SSLCertificate::getInfo()

N

Returns a hash of all information for the certificate.


4.14.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.

Usage
new SSLCertificate(string|binary)
Example
$cert = new SSLCertificate($pem_cert_string);

Table 4.670. Arguments for SSLCertificate::constructor()

Argument

Type

Description

certificate_data

String|Binary

The certificate data in either PEM (string argument) or DER (binary argument) format. See above for the deprecated option of passing a filename argument.


Table 4.671. Return Values for SSLCertificate::constructor()

Return Type

Description

Object

The SSLCertificate object is returned


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

err

desc

SSLCERTIFICATE-CONSTRUCTOR-ERROR

missing or invalid argument, unable to parse file, etc


4.14.2. SSLCertificate::destructor()

Synopsis

Destroys the SSLCertificate object.

Usage
delete lvalue
Example
delete $cert;

Table 4.673. Arguments for SSLCertificate::destructor()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.674. Return Values for SSLCertificate::destructor()

Return Type

Description

n/a

This method returns no value


4.14.3. SSLCertificate::copy()

Synopsis

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

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

err

desc

SSLCERTIFICATE-COPY-ERROR

objects of this class may not be copied


4.14.4. SSLCertificate::getPEM()

Synopsis

Returns a string in PEM format representing the certificate.

Usage
SSLCertificate::getPEM()
Example
$pem_str = $cert.getPEM();

Table 4.676. Arguments for SSLCertificate::getPEM()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

String

A string in PEM format representing the certificate.


4.14.5. SSLCertificate::getVersion()

Synopsis

Returns the version of the certificate as an integer.

Usage
SSLCertificate::getVersion()
Example
$int = $cert.getVersion();

Table 4.678. Arguments for SSLCertificate::getVersion()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Integer

The version of the certificate.


4.14.6. SSLCertificate::getSignatureType()

Synopsis

Returns the signature type of the certificate.

Usage
SSLCertificate::getSignatureType()
Example
$str = $cert.getSignatureType();

Table 4.680. Arguments for SSLCertificate::getSignatureType()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

String

The signature type of the certificate.


4.14.7. SSLCertificate::getSignature()

Synopsis

Returns a binary object representing the signature of the certificate.

Usage
SSLCertificate::getSignature()
Example
$bin = $cert.getSignature();

Table 4.682. Arguments for SSLCertificate::getSignature()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Binary

The signature data for the certificate.


4.14.8. SSLCertificate::getPublicKeyAlgorithm()

Synopsis

Returns name of the public key algorithm of the certificate.

Usage
SSLCertificate::getPublicKeyAlgorithm()
Example
$str = $cert.getPublicKeyAlgorithm();

Table 4.684. Arguments for SSLCertificate::getPublicKeyAlgorithm()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

String

The name of the public key algorithm of the certificate.


4.14.9. SSLCertificate::getPublicKey()

Synopsis

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

Usage
SSLCertificate::getPublicKey()
Example
$bin = $cert.getPublicKey();

Table 4.686. Arguments for SSLCertificate::getPublicKey()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Binary

The public key of the certificate in DER format.


4.14.10. SSLCertificate::getSubjectHash()

Synopsis

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

Usage
SSLCertificate::getSubjectHash()
Example
$hash = $cert.getSubjectHash();

Table 4.688. Arguments for SSLCertificate::getSubjectHash()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Hash

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


4.14.11. SSLCertificate::getIssuerHash()

Synopsis

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

Usage
SSLCertificate::getIssuerHash()
Example
$hash = $cert.getIssuerHash();

Table 4.690. Arguments for SSLCertificate::getIssuerHash()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Hash

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


4.14.12. SSLCertificate::getSerialNumber()

Synopsis

Returns the integer serial number of the certificate.

Usage
SSLCertificate::getIssuerHash()
Example
$hash = $cert.getIssuerHash();

Table 4.692. Arguments for SSLCertificate::getSerialNumber()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Integer

The serial number of the certificate.


4.14.13. SSLCertificate::getPurposeHash()

Synopsis

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

Usage
SSLCertificate::getPurposeHash()
Example
$hash = $cert.getPurposeHash();

Table 4.694. Arguments for SSLCertificate::getPurposeHash()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Hash

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


4.14.14. SSLCertificate::getNotBeforeDate()

Synopsis

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

Usage
SSLCertificate::getNotBeforeDate()
Example
$date = $cert.getNotBeforeDate();

Table 4.696. Arguments for SSLCertificate::getNotBeforeDate()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Date

The start date of the certificate.


4.14.15. SSLCertificate::getNotAfterDate()

Synopsis

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

Usage
SSLCertificate::getNotAfterDate()
Example
$date = $cert.getNotAfterDate();

Table 4.698. Arguments for SSLCertificate::getNotAfterDate()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


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

Return Type

Description

Date

The end date of the certificate.


4.14.16. SSLCertificate::getInfo()

Synopsis

Returns a hash of all information for the certificate.

Usage
SSLCertificate::getInfo()
Example
$hash = $cert.getInfo();

Table 4.700. Arguments for SSLCertificate::getInfo()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.701. 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.