setasign\SetaPDF2\Signer\X509

Collection Class representing a collection of X509 certificates.

File: /SetaPDF v2/Signer/X509/Collection.php
Old class name (alias): \SetaPDF_Signer_X509_Collection

Class hierarchy

Implements

Summary

Properties

$_items

All items.


Methods

__construct()

public Collection::__construct (
null|string|Certificate|Certificate[]|CollectionInterface $certificates = null
)

The constructor.

Parameters
$certificates: null|string|Certificate|Certificate[]|CollectionInterface
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

_getCollectionItems()

Get all items which are not direct certificates but implement the CollectionInterface.

add()

public Collection::add (
string|string[]|Certificate|Certificate[]|CollectionInterface $certificates
): $this

Add a certificate, certificates or collections.

Parameters
$certificates: string|string[]|Certificate|Certificate[]|CollectionInterface
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

addFromFile()

public Collection::addFromFile (
string $path
): $this

Add a certificate from a path.

Parameters
$path: string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

contains()

public Collection::contains (
Certificate $certificate
): bool
Parameters
$certificate: Certificate
 

count()

public Collection::count (
void
): int

Count all items.

Notice: that this method collects ALL items to count only unique elements.

findByCallback()

public Collection::findByCallback (
callable $callback
): self

Find all certificates by a callback.

Parameters
$callback: callable
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

findByIssuer()

public Collection::findByIssuer (
string $issuer,
bool $fullMatch = false
): self
Parameters
$issuer: string
 
$fullMatch: bool

Whether only a substring matched or the whole subject should be compared.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

findByKeyHash()

public Collection::findByKeyHash (
string $keyHash
): CollectionInterface

Get all certificates with the matching key hash (sha-1 hash of the public key).

Parameters
$keyHash: string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

findBySubject()

public Collection::findBySubject (
string $subject,
bool $fullMatch = false
): self
Parameters
$subject: string
 
$fullMatch: bool

Whether only a substring matched or the whole subject should be compared.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

findBySubjectKeyIdentifier()

public Collection::findBySubjectKeyIdentifier (
string $subjectKeyIdentifier
): CollectionInterface

Get all certificates with the subject key identifier.

Parameters
$subjectKeyIdentifier: string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

findByValidAt()

getAll()

public Collection::getAll (
void
): Certificate[]

Get all certificates.

Exceptions

Throws \setasign\SetaPDF2\Signer\Exception

getBySerialNumber()

public Collection::getBySerialNumber (
string $serialNumber
): false|Certificate
Parameters
$serialNumber: string

The hex encoded serial number.

Exceptions

Throws \setasign\SetaPDF2\Signer\Exception

getBySubjectKeyIdentifier()

public Collection::getBySubjectKeyIdentifier (
string $subjectKeyIdentifier
): false|Certificate
Parameters
$subjectKeyIdentifier: string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception