SetaPDF_Signer_X509_Certificate Class representing a X509 Certificate.

File: /SetaPDF v2/Signer/X509/Certificate.php

Class hierarchy

Summary

Static Properties

$usePhpseclibForRsaPss

Flag defining whether usage of phpseclib or default OpenSSL methods for RSA_PSS validation.

$verifyCallback

static public null|callable SetaPDF_Signer_Asn1_Signed::$verifyCallback

A callable that can be used to implement individual verification logic.


Properties

$_certificate

The ASN.1 element holding the X509 certificate.

$_digestCache

A digest cache.

$_extensions

$_subjectName

A cache for the subject name.


Static Methods

fromFile()

Create an instance by a path.

Parameters
$path : string
 
Exceptions

Throws SetaPDF_Signer_Asn1_Exception

fromFileOrString()

Create an instance by a path or a string.

Parameters
$pathOrString : string
 
Exceptions

Throws SetaPDF_Signer_Asn1_Exception


Methods

__construct()

public SetaPDF_Signer_X509_Certificate::__construct (
string $certificate
)

The constructor.

Parameters
$certificate : string

PEM or DER encoded string of the certificate.

Exceptions

Throws SetaPDF_Signer_Asn1_Exception

_getTBSCertificate()

_getValidity()

Get the validity field.

Exceptions

Throws SetaPDF_Signer_Exception

get()

Get the certificate encoded as DER or PEM.

Parameters
$format : string
 

getAsn1()

Get the ASN.1 instance of the certificate.

getDigest()

public SetaPDF_Signer_X509_Certificate::getDigest (
[ string $algo = 'sha1' [, bool $raw = false ]]
): string

Get the digest of the certificate.

Parameters
$algo : string
 
$raw : bool
 

getExtensions()

getIssuer()

Returns the first issuer found in the given Collection.

Parameters
$collection : SetaPDF_Signer_X509_Collection
 
Exceptions

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

getIssuerName()

Get the issuer name.

Exceptions

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

getIssuerNameRaw()

getIssuers()

Get all found issuers found in the given collection.

Parameters
$collection : SetaPDF_Signer_X509_Collection
 
Exceptions

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

getSerialNumber()

Get the serial number (hex encoded).

Exceptions

Throws SetaPDF_Signer_Exception

getSerialNumberRaw()

Get the serial number as a raw ASN.1 element.

Exceptions

Throws SetaPDF_Signer_Exception

getSignatureAlgorithm()

Return Values

The first value holds the OID of the algorithm. The second value is the ASN.1 structure of the parameters.

getSignatureValue()

public SetaPDF_Signer_X509_Certificate::getSignatureValue (
[ bool $hex = true ]
): string

Parameters
$hex : bool
 

getSubjectName()

Get the subject name.

Exceptions

Throws SetaPDF_Signer_Asn1_Exception

getSubjectPublicKeyInfoAlgorithmIdentifier()

Get the subject public key info algorithm identifier.

Return Values

First entry is the OID of the identifier. The second entry are the raw parameters as ASN.1 structures.

Exceptions

Throws SetaPDF_Signer_Exception

getSubjectPublicKeyInfoRaw()

Get the data of the Subject Public Key Info field.

Exceptions

Throws SetaPDF_Signer_Exception

getValidFrom()

public SetaPDF_Signer_X509_Certificate::getValidFrom (
[ DateTimeZone|null $timeZone = null ]
): DateTime

Get the "valid from" value.

Parameters
$timeZone : DateTimeZone|null

Default timezone is UTC.

Exceptions

Throws Exception

getValidTo()

public SetaPDF_Signer_X509_Certificate::getValidTo (
[ DateTimeZone|null $timeZone = null ]
): DateTime

Get the "valid to" value.

Parameters
$timeZone : DateTimeZone|null

Default timezone is UTC.

Exceptions

Throws Exception

isValidAt()

public SetaPDF_Signer_X509_Certificate::isValidAt (
DateTimeInterface $dateTime [, DateTimeZone|null $timeZone = null ]
): bool

Checks whether the certificate was valid at a given date and time.

Parameters
$dateTime : DateTimeInterface
 
$timeZone : DateTimeZone|null
 
Exceptions

Throws Exception

verify()

public SetaPDF_Signer_X509_Certificate::verify (
[ SetaPDF_Signer_X509_Certificate|null $issuerCertifcate = null ]
): bool

Verify the signed object.

Parameters
$issuerCertifcate : SetaPDF_Signer_X509_Certificate|null

If omitted the certificate instance is used as the issuer (self-signed).

Exceptions

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception