phpdftk API Documentation

LtvSigner
in package

FinalYes

Add LTV (Long-Term Validation) data to signed PDFs — PAdES B-LT profile.

Extracts certificates from existing signatures, fetches OCSP responses and CRLs, and embeds them in a DSS (Document Security Store) via an incremental update that preserves the original signatures.

Supports both online fetching (via OcspClient/CrlClient) and offline mode (pre-loaded OCSP/CRL data for testing).

Usage: LtvSigner::openString($signedPdfBytes) ->setOcspClient(new OcspClient()) ->setCrlClient(new CrlClient()) ->save('ltv-enabled.pdf');

// Offline / testing: LtvSigner::openString($signedPdfBytes) ->addOcspResponse($derOcspBytes) ->addCertificate($derCaCert) ->save('ltv-enabled.pdf');

Table of Contents

Methods

addCertificate()  : self
Add an extra DER-encoded certificate to include in the DSS.
addCrl()  : self
Pre-load a DER-encoded CRL (for offline/testing use).
addOcspResponse()  : self
Pre-load a DER-encoded OCSP response (for offline/testing use).
forSignature()  : self
Target a specific signature field by name. Can be called multiple times.
getPageCount()  : int
getReader()  : PdfReader
getVersionWarnings()  : array<int, string>
getWarnings()  : array<int, string>
Get non-fatal warnings from OCSP/CRL fetching.
open()  : self
openString()  : self
save()  : void
setCrlClient()  : self
Set the CRL client for online revocation checking.
setOcspClient()  : self
Set the OCSP client for online revocation checking.
toBytes()  : string

Methods

addCertificate()

Add an extra DER-encoded certificate to include in the DSS.

public addCertificate(string $derCert) : self
Parameters
$derCert : string
Return values
self

addCrl()

Pre-load a DER-encoded CRL (for offline/testing use).

public addCrl(string $derCrl) : self
Parameters
$derCrl : string
Return values
self

addOcspResponse()

Pre-load a DER-encoded OCSP response (for offline/testing use).

public addOcspResponse(string $derOcsp) : self
Parameters
$derOcsp : string
Return values
self

forSignature()

Target a specific signature field by name. Can be called multiple times.

public forSignature(string $fieldName) : self

If never called, all signatures are processed.

Parameters
$fieldName : string
Tags
throws
InvalidArgumentException

if the field does not exist

Return values
self

getPageCount()

public getPageCount() : int
Return values
int

getVersionWarnings()

public getVersionWarnings() : array<int, string>
Return values
array<int, string>

getWarnings()

Get non-fatal warnings from OCSP/CRL fetching.

public getWarnings() : array<int, string>
Return values
array<int, string>

open()

public static open(string $path[, string $password = '' ]) : self
Parameters
$path : string
$password : string = ''
Return values
self

openString()

public static openString(string $pdfBytes[, string $password = '' ]) : self
Parameters
$pdfBytes : string
$password : string = ''
Return values
self

save()

public save(string $path) : void
Parameters
$path : string

setCrlClient()

Set the CRL client for online revocation checking.

public setCrlClient(CrlClient $client) : self
Parameters
$client : CrlClient
Return values
self

setOcspClient()

Set the OCSP client for online revocation checking.

public setOcspClient(OcspClient $client) : self
Parameters
$client : OcspClient
Return values
self

toBytes()

public toBytes() : string
Return values
string

        
On this page

Search results