SSLCertificate objects are designed to work with X.509 certificate data.
Table 4.536. SSLCertificate Class Method Overview
|
Method |
Except? |
Description |
|---|---|---|
|
|
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 |
|
N |
Destroys the SSLCertificate object. | |
|
Y |
Copying objects of this class is not supported, an exception will be thrown. | |
|
N |
Returns a string in PEM format representing the certificate. | |
|
N |
Returns the version of the certificate. | |
|
N |
Returns the signature type of the certificate. | |
|
N |
Returns a binary object representing the signature of the certificate. | |
|
N |
Returns name of the public key algorithm of the certificate. | |
|
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. | |
|
N |
Returns a hash of strings representing the subject information of the certificate. | |
|
N |
Returns a hash of strings representing the issuer information of the certificate. | |
|
N |
Returns the integer serial number of the certificate. | |
|
N |
Returns a hash of booleans representing the allowed purposes of the certificate. | |
|
N |
Returns a date/time value representing the start date of the certificate. | |
|
N |
Returns a date/time value representing the end date of the certificate. | |
|
N |
Returns a hash of all information for the certificate. |
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.
SSLCertificate::constructor(string $cert_pem)
SSLCertificate::constructor(binary $cert_der)
my SSLCertificate $cert($pem_cert_string);
Table 4.538. Exceptions thrown by SSLCertificate::constructor()
|
err |
desc |
|---|---|
|
|
missing or invalid argument, unable to parse file, etc |
Destroys the SSLCertificate object.
delete $cert;
Copying objects of this class is not supported, an exception will be thrown.
Table 4.539. Exceptions thrown by SSLCertificate::copy()
|
err |
desc |
|---|---|
|
|
objects of this class may not be copied |
Returns a string in PEM format representing the certificate.
$pem_str = $cert.getPEM();
Table 4.540. Return Values for SSLCertificate::getPEM()
|
Return Type |
Description |
|---|---|
|
A string in PEM format representing the certificate. |
Returns the version of the certificate as an integer.
$int = $cert.getVersion();
Table 4.541. Return Values for SSLCertificate::getVersion()
|
Return Type |
Description |
|---|---|
|
The version of the certificate. |
Returns the signature type of the certificate.
$str = $cert.getSignatureType();
Table 4.542. Return Values for SSLCertificate::getSignatureType()
|
Return Type |
Description |
|---|---|
|
The signature type of the certificate. |
Returns a binary object representing the signature of the certificate.
$bin = $cert.getSignature();
Table 4.543. Return Values for SSLCertificate::getSignature()
|
Return Type |
Description |
|---|---|
|
The signature data for the certificate. |
Returns name of the public key algorithm of the certificate.
$str = $cert.getPublicKeyAlgorithm();
Table 4.544. Return Values for SSLCertificate::getPublicKeyAlgorithm()
|
Return Type |
Description |
|---|---|
|
The name of the public key algorithm of the certificate. |
Returns a binary object representing the public key of the certificate in DER (Distinguished Encoding Rules) format.
my *binary $bin = $cert.getPublicKey();
Table 4.545. Return Values for SSLCertificate::getPublicKey()
|
Return Type |
Description |
|---|---|
|
The public key of the certificate in DER format. |
Returns a hash of strings representing the subject information of the certificate.
$hash = $cert.getSubjectHash();
Table 4.546. Return Values for SSLCertificate::getSubjectHash()
|
Return Type |
Description |
|---|---|
|
Key-value pairs representing the subject information of the certificate. |
Returns a hash of strings representing the issuer information of the certificate.
$hash = $cert.getIssuerHash();
Table 4.547. Return Values for SSLCertificate::getIssuerHash()
|
Return Type |
Description |
|---|---|
|
Key-value pairs representing the issuer information of the certificate. |
Returns the integer serial number of the certificate.
$hash = $cert.getIssuerHash();
Table 4.548. Return Values for SSLCertificate::getSerialNumber()
|
Return Type |
Description |
|---|---|
|
The serial number of the certificate. |
Returns a hash of booleans representing the allowed purposes of the certificate.
$hash = $cert.getPurposeHash();
Table 4.549. Return Values for SSLCertificate::getPurposeHash()
|
Return Type |
Description |
|---|---|
|
Key-value pairs representing the allowed purposes of the certificate. |
Returns a date/time value representing the start date of the certificate.
$date = $cert.getNotBeforeDate();
Table 4.550. Return Values for SSLCertificate::getNotBeforeDate()
|
Return Type |
Description |
|---|---|
|
The start date of the certificate. |
Returns a date/time value representing the end date of the certificate.
$date = $cert.getNotAfterDate();
Table 4.551. Return Values for SSLCertificate::getNotAfterDate()
|
Return Type |
Description |
|---|---|
|
The end date of the certificate. |
Returns a hash of all information for the certificate.
$hash = $cert.getInfo();
Table 4.552. Return Values for SSLCertificate::getInfo()
|
Return Type |
Description |
|---|---|
|
Keys are 'version', 'serialNumber', 'subject', 'issuer', 'purposes', 'notBefore', 'notAfter', 'signatureType', 'signature', and 'publicKey' corresponding to the respective attributes of the certificate. |