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

Qore Programming Language Reference Manual 0.8.11

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
Qore::SSLCertificate Class Reference

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

## Public Member Functions
| 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 ()
| Copying objects of this class is not supported, an exception will be thrown. More...
hash | 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...

## Detailed Description

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

## Member Function Documentation

Qore::SSLCertificate::constructor | ( | string | pem | ) |

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

Parameters

  pem | the PEM representation of the X.509 certificate

Example:
  my SSLCertificate $cert($pem_cert_string);

Exceptions

  SSLCERTIFICATE-CONSTRUCTOR-ERROR | invalid 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

Qore::SSLCertificate::constructor | ( | binary | der | ) |

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

Parameters

  der | the DER-encoded representation of the X.509 certificate

Example:
  my SSLCertificate $cert($der_cert);

Exceptions

  SSLCERTIFICATE-CONSTRUCTOR-ERROR | invalid X.509 certificate data

Qore::SSLCertificate::copy | ( |  | ) |

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

Exceptions

  SSLCERTIFICATE-COPY-ERROR | SSLCertificate objects cannot be copied

hash 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:
  - `"version"`: The version of the X.509 certificate (see SSLCertificate::getVersion())
  - `"serialNumber"`: The serial number of the X.509 certificate (see SSLCertificate::getSerialNumber())
  - `"subject"`: The subject hash of the X.509 certificate (see SSLCertificate::getSubjectHash())
  - `"issuer"`: The issuer hash of the X.509 certificate (see SSLCertificate::getIssuerHash())
  - `"purposes"`: The purpose hash of the X.509 certificate (see SSLCertificate::getPurposeHash())
  - `"notBefore"`: The "not before date" of the X.509 certificate (see SSLCertificate::getNotBeforeDate())
  - `"notAfter"`: The "not after date" of the X.509 certificate (see SSLCertificate::getNotAfterDate())
  - `"signatureType"`: The signature type string of the X.509 certificate (see SSLCertificate::getSignatureType())
  - `"signature"`: The binary signature of the X.509 certificate (see SSLCertificate::getSignature())
  - `"publicKey"`: The binary public key of the X.509 certificate (see SSLCertificate::getPublicKey())

Code Flags:
  CONSTANT

Example:
  my hash $hash = $cert.getInfo();

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:
  my hash $h = $cert.getIssuerHash();

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:
  my date $end = $cert.getNotAfterDate();

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:
  my date $start = $cert.getNotBeforeDate();

string Qore::SSLCertificate::getPEM | ( |  | ) |

Returns a string in PEM format representing the certificate.

Returns
  a string in PEM format representing the certificate

Example:
  my string $pem_str = $cert.getPEM();

Exceptions

  X509-ERROR | could not create PEM string from X509 certificate data

*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:
  my *binary $bin = $cert.getPublicKey();

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:
  my string $str = $cert.getPublicKeyAlgorithm();

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:
  my hash $h = $cert.getPurposeHash();

int Qore::SSLCertificate::getSerialNumber | ( |  | ) |

Returns the integer serial number of the certificate.

Returns
  the integer serial number of the certificate

Code Flags:
  CONSTANT

Example:
  my int $sn = $cert.getSerialNumber();

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:
  my binary $bin = $cert.getSignature();

string Qore::SSLCertificate::getSignatureType | ( |  | ) |

Returns the signature type of the certificate.

Returns
  the signature type of the certificate

Code Flags:
  CONSTANT

Example:
  my string $str = $cert.getSignatureType();

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:
  my hash $h = $cert.getSubjectHash();

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:
  my int $ver = $cert.getVersion();