setasign\SetaPDF2\Signer\ValidationRelatedInfo

Collector Class offering methods to collect validation related information.

File: /SetaPDF v2/Signer/ValidationRelatedInfo/Collector.php
Old class name (alias): \SetaPDF_Signer_ValidationRelatedInfo_Collector

Class hierarchy

Summary

Constants

SOURCE_CRL

public const int Collector::SOURCE_CRL = 4

Source constant.

SOURCE_OCSP

public const int Collector::SOURCE_OCSP = 2

Source constant.

SOURCE_OCSP_AND_CRL

public const int Collector::SOURCE_OCSP_AND_CRL = 7

Source constant.

SOURCE_OCSP_OR_CRL

public const int Collector::SOURCE_OCSP_OR_CRL = 6

Source constant.


Properties

$_crlCache

protected ?\Psr\SimpleCache\CacheInterface Collector::$_crlCache

A cache instance for CRLs.

$_crls

protected array Collector::$_crls

CRL list indexed by md5 hash of the issuers public key.

$_extraCertificates

A collection of extra certificates.

$_informationResolverManager

$_issuerCache

protected ?\Psr\SimpleCache\CacheInterface Collector::$_issuerCache

A cache instance for resolved issuer certificates.

$_leftCertificates

Certificate that needs to be processed.

$_logger

A logger instance.

$_ocspCache

protected ?\Psr\SimpleCache\CacheInterface Collector::$_ocspCache

A cache instance for resolved OCSP responses.

$_ocspClient

The OCSP client instance.

$_trustedCertificates

A collection of trusted certificates.


Static Methods


Methods

__construct()

The constructor.

Parameters
$trustedCertificates : ?\setasign\SetaPDF2\Signer\X509\CollectionInterface
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

_buildPath()

Build a certificate path by a certificate, date and time.

Internally the method tries to gather issuer certificates through the AIA extension of the certificates if the path couldn't be created.

Parameters
$certificate : \setasign\SetaPDF2\Signer\X509\Certificate
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
Exceptions

Throws \Psr\SimpleCache\InvalidArgumentException

Throws Exception

Throws \setasign\SetaPDF2\Signer\Exception

_getAllCertificates()

Get a collection with all certificates (trusted + extra).

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

_getByLeftCertificates()

protected Collector::_getByLeftCertificates (
Result $result,
\setasign\SetaPDF2\Signer\X509\Certificate[] $certificates,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null
): Result

Get validation related information by left certificates.

Parameters
$result : Result
 
$certificates : \setasign\SetaPDF2\Signer\X509\Certificate[]
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \Psr\SimpleCache\InvalidArgumentException

Throws Exception

_getOcspResponse()

Get an OCSP response by a certificate.

Parameters
$certificate : \setasign\SetaPDF2\Signer\X509\Certificate
 
Exceptions

Throws Exception

Throws \Psr\SimpleCache\InvalidArgumentException

Throws \setasign\SetaPDF2\Signer\Exception

_processCertificate()

protected Collector::_processCertificate (
Result $result,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null
): void

Processes a certificate popped from the leftCertificates array.

Parameters
$result : Result
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

Throws Exception

Throws \Psr\SimpleCache\InvalidArgumentException

getByCertificate()

public Collector::getByCertificate (
\setasign\SetaPDF2\Signer\X509\Certificate $certificate,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null,
?Result $result = null
): Result

Get validation related information by a certificate.

Parameters
$certificate : \setasign\SetaPDF2\Signer\X509\Certificate
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
$result : ?Result
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \Psr\SimpleCache\InvalidArgumentException

Throws Exception

getByFieldName()

public Collector::getByFieldName (
\setasign\SetaPDF2\Core\Document $document,
string $fieldName,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null,
?Result $result = null
): ResultByField

Get validation related information by a signature field name.

Parameters
$document : \setasign\SetaPDF2\Core\Document
 
$fieldName : string
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
$result : ?Result
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

Throws Exception

Throws \Psr\SimpleCache\InvalidArgumentException

getByIntegrityResult()

public Collector::getByIntegrityResult (
IntegrityResult $integrityResult,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null,
?Result $result = null
): ResultByField

Get validation related information by an integrity result.

Parameters
$integrityResult : IntegrityResult
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
$result : ?Result
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

Throws Exception

Throws \Psr\SimpleCache\InvalidArgumentException

getBySignedData()

public Collector::getBySignedData (
\setasign\SetaPDF2\Signer\Cms\SignedData $signedData,
int $sources = Collector::SOURCE_OCSP_OR_CRL,
?\DateTimeInterface $dateTime = null,
?\DateTimeZone $timeZone = null,
?Result $result = null
): ResultBySignedData

Get validation related information by a SignedData object.

Parameters
$signedData : \setasign\SetaPDF2\Signer\Cms\SignedData
 
$sources : int
 
$dateTime : ?\DateTimeInterface
 
$timeZone : ?\DateTimeZone
 
$result : ?Result
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

Throws Exception

Throws \Psr\SimpleCache\InvalidArgumentException

getCrlCache()

public Collector::getCrlCache (
void
): ?\Psr\SimpleCache\CacheInterface

Get the cache instance for CRLs.

getExtraCertificates()

Get the extra certificates collection.

getInformationResolverManager()

Get the information resolver manager instance.

If none was explicity was passed before it will create a standard instance with an HTTP resolver that uses cURL.

getIssuerCache()

public Collector::getIssuerCache (
void
): ?\Psr\SimpleCache\CacheInterface

Get the cache instance for resolved issuer certificates.

getLogger()

Get the logger instance.

If no logger instance was passed before a new instance of Logger is returned.

getOcspCache()

public Collector::getOcspCache (
void
): ?\Psr\SimpleCache\CacheInterface

Get the cache instance for OCSP responses.

getOcspClient()

Get the OCSP client instance.

getTrustedCertificates()

Get the trusted certificates collection.

setCrlCache()

public Collector::setCrlCache (
?\Psr\SimpleCache\CacheInterface $crlCache = null
): void

Set a cache instance for CRLs.

Parameters
$crlCache : ?\Psr\SimpleCache\CacheInterface
 

setInformationResolverManager()

Set an information resolver manager instance.

Parameters
$manager : \setasign\SetaPDF2\Signer\InformationResolver\Manager
 

setIssuerCache()

public Collector::setIssuerCache (
?\Psr\SimpleCache\CacheInterface $issuerCache = null
): void

Set a cache instance for resolved issuer certificates.

Parameters
$issuerCache : ?\Psr\SimpleCache\CacheInterface
 

setLogger()

public Collector::setLogger (
LoggerInterface $logger
): void

Set a logger instance.

Parameters
$logger : LoggerInterface
 

setOcspCache()

public Collector::setOcspCache (
?\Psr\SimpleCache\CacheInterface $ocspCache = null
): void

Set a cache instance for OCSP responses.

Parameters
$ocspCache : ?\Psr\SimpleCache\CacheInterface
 

setOcspClient()

Set an OCSP client instance.

Parameters
$ocspClient : \setasign\SetaPDF2\Signer\Ocsp\Client