SetaPDF_Signer_DocumentSecurityStore Class representing a "Document Security Store" in a PDF document.

File: /SetaPDF v2/Signer/DocumentSecurityStore.php

Class hierarchy

Summary

Properties

$_document

$_optimizeOcspResponses

Defines whether OCSP responses should be embedded including their optional certificates (false) or not (true).


Methods

__construct()

The constructor.

Parameters
$document : SetaPDF_Core_Document
 

_addStream()

Adds a stream to the DSS data.

Parameters
$type : string

The type/key to which the data should be added.

$data : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

_getStreams()

protected SetaPDF_Signer_DocumentSecurityStore::_getStreams (
string $type
): array

Get a stream by its type from the DSS dictionary.

Parameters
$type : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

addCRL()

addCRLs()

Add CRLs to the CRLs entry in the DSS dictionary.

Parameters
$crls : string[]|SetaPDF_Signer_X509_Crl[]
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

addCertificate()

addCertificates()

Add certificates to the Certs entry in the DSS dictionary.

Parameters
$certificates : string[]|SetaPDF_Signer_X509_Certificate[]
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

addOCSP()

addOCSPs()

Add OCSP responses to the OCSPs entry in the DSS dictionary.

Parameters
$ocsps : string[]|SetaPDF_Signer_Ocsp_Response
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

addValidationRelatedInfo()

public SetaPDF_Signer_DocumentSecurityStore::addValidationRelatedInfo (
string $key [, array $crls = array ( ) [, array $ocsps = array ( ) [, array $certs = array ( ) [, null|SetaPDF_Core_DataStructure_Date|DateTime|string $timestamp = null ]]]]
): void

Add validation related information to the VRI dictionary of the DSS dictionary.

Parameters
$key : string

The sha1 digest of the signature.

$crls : array

An array of strings, SetaPDF_Signer_X509_Crl instances or SetaPDF_Core_Type_IndirectObjectInterface to streams of the CRLs.

$ocsps : array

An array of strings, SetaPDF_Signer_Ocsp_Response instances or SetaPDF_Core_Type_IndirectObjectInterface to streams of the OCSPs.

$certs : array

An array of strings, SetaPDF_Signer_X509_Certificate instances or SetaPDF_Core_Type_IndirectObjectInterface to streams of the certs.

$timestamp : null|SetaPDF_Core_DataStructure_Date|DateTime|string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

Throws Exception

addValidationRelatedInfoByField()

WARNING: This method is marked as deprecated!

Use SetaPDF_Signer_DocumentSecurityStore::addValidationRelatedInfoByFieldName() instead.

public SetaPDF_Signer_DocumentSecurityStore::addValidationRelatedInfoByField (
string $fieldName [, array $crls = array ( ) [, array $ocsps = array ( ) [, array $certs = array ( ) [, null|SetaPDF_Core_DataStructure_Date|DateTime|string $timestamp = null ]]]]
): void
Parameters
$fieldName : string

The signature field name.

$crls : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the CRLs.

$ocsps : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the OCSPs.

$certs : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the certs.

$timestamp : null|SetaPDF_Core_DataStructure_Date|DateTime|string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

See

addValidationRelatedInfoByFieldName()

public SetaPDF_Signer_DocumentSecurityStore::addValidationRelatedInfoByFieldName (
string $fieldName [, array $crls = array ( ) [, array $ocsps = array ( ) [, array $certs = array ( ) [, null|SetaPDF_Core_DataStructure_Date|DateTime|string $timestamp = null ]]]]
): void

Add validation related information to the VRI dictionary of the DSS dictionary by a specific signature field.

Parameters
$fieldName : string

The signature field name.

$crls : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the CRLs.

$ocsps : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the OCSPs.

$certs : array

An array of strings or SetaPDF_Core_Type_IndirectObjectInterface to streams of the certs.

$timestamp : null|SetaPDF_Core_DataStructure_Date|DateTime|string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

cleanUp()

Release cycled references.

getCRLs()

Get all CRLs the OCSPs entry in the DSS dictionary.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

getCertificates()

Get all certificates from the Certs entry in the DSS dictionary.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

getDictionary()

Get and/or creates the DSS dictionary.

Parameters
$create : bool
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getOCSPs()

Get all OCSP responses from the OCSPs entry in the DSS dictionary.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

getOptimizeOcspResponses()

getValidationRelatedInfo()

public SetaPDF_Signer_DocumentSecurityStore::getValidationRelatedInfo (
[ null|string $vriKey = null ]
): array|array[]|bool

Get validation related information.

Parameters
$vriKey : null|string

The sha1 digest of the signature to get a specific information. Otherwise all found validation data is returned.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

getValidationRelatedInfoByField()

getValidationRelatedInfoByFieldName()

public SetaPDF_Signer_DocumentSecurityStore::getValidationRelatedInfoByFieldName (
string $fieldName
): array|array[]|bool

Get validation related information by a signature field name.

Parameters
$fieldName : string

The signature field name.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Signer_Asn1_Exception

getVriName()

Get the signature digest of a CRL or OCSP response which can be used as an index in the VRI dictionary.

Parameters
$object : SetaPDF_Signer_Asn1_Signed
 

getVriNameByFieldName()

public SetaPDF_Signer_DocumentSecurityStore::getVriNameByFieldName (
string $fieldName
): string

Get the signature digest of a signature field, which can be used as an index in the VRI dictionary.

For a document signature the bytes that are hashed are those of the signature's DER-encoded PKCS#7 (and its derivatives) binary data object (base-16 decoded byte string in the Contents entry in the signature dictionary).

For the signatures of the CRL and OCSP response, it is the respective signature object represented as a BER-encoded OCTET STRING encoded with primitive encoding.

For a Time-stamp's signature it is the bytes of the Time-stamp itself since the Time-stamp token is a signed data object.
Parameters
$fieldName : string
 
Exceptions

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Signer_Asn1_Exception

Throws SetaPDF_Signer_Exception

setOptimizeOcspResponses()

public SetaPDF_Signer_DocumentSecurityStore::setOptimizeOcspResponses (
bool $optimizeOcspResponses
): void

Define whether OCSP responses should be optimized or not.

By optimizing (default = true) the OCSP responses the certificates are removed as they are normally embedded via self::addCertificates(), too. By doing this the certificates are not embedded twice.

Anyhow, there are validation enginges on the road which EXPECTS this optional field to be available.

Parameters
$optimizeOcspResponses : bool