TPDFlibEntSignLTV

Editions

Description

TPDFlibEntSignLTV (unit PDFlibEntSignLTV) descends from TPDFlibEntSignVerify and implements the Enterprise methods for PAdES long-term validation: the Document Security Store (DSS) processes for B-LT and the archive validation for B-LTA, signature and document time-stamps, and the retrieval of OCSP responses, CRLs and certificates over HTTP and LDAP.

It belongs to the Enterprise edition, which includes every Small Business class as well. TPDFlibEntPubSec descends from it and adds the next feature group.

Syntax

Delphi

TPDFlibEntSignLTV = Class(TPDFlibEntSignVerify);

Key members

SetSignProcessDocTimeStampSwitches the sign process into document time-stamp mode (/DocTimeStamp with /ETSI.RFC3161) and reserves SignatureLength bytes for the token, 8192 when 0 is passed
AddSignProcessRevocationCRLAdds the CRL to the revocation info the sign process carries in its signature
AddSignProcessRevocationOCSPAdds the OCSP response to the revocation info the sign process carries in its signature
ClearSignProcessRevocationInfoRemoves every CRL and OCSP response from the sign process
NewPAdESDSSProcessFromFileCreates a DSS process over the signed PDF in InputFile and returns its process ID
NewPAdESDSSProcessFromStreamCreates a DSS process over the stream InputStream and returns its process ID
NewPAdESDSSProcessFromStringCreates a DSS process over the PDF bytes Source and returns its process ID
AddPAdESDSSCertificateAdds the DER certificate to the DSS process; the bytes have to be exactly one DER sequence
AddPAdESDSSCRLAdds the DER CRL to the DSS process; the bytes have to be exactly one DER sequence
AddPAdESDSSOCSPAdds the DER OCSP response to the DSS process; the bytes have to be exactly one DER sequence
AddPAdESDSSVRIAdds a VRI entry for the signature whose /Contents hash is SigContentsHashHex, pointing at the listed certificate, CRL and OCSP indexes
FetchRevocationMaterialDownloads the bytes at URL with an HTTP GET, or over LDAP for an ldap:// address; returns an empty string when the download fails
AddPAdESDSSCRLFromURLDownloads a CRL from URL and adds it to the DSS process
AddPAdESDSSCertificateFromURLDownloads a certificate from URL, accepting a bare DER certificate or a certs-only PKCS#7 answer, and adds it to the DSS process
FetchOCSPResponsePosts an OCSP request for the certificate pair to ResponderURL, or to an OCSP address the subject certificate names; returns the DER response only when the responder reports the certificate as good
AddPAdESDSSOCSPFromCertificatesFetches the OCSP response for the certificate pair and adds it to the DSS process
ApplyPAdESLongTermValidationPromotes the signed PDF in InputFile to B-LT: collects the validation material of every signature, or of the field FieldName only, writes it as a DSS through an incremental update and writes the result to OutputFile
ApplyPAdESLongTermValidationToStreamPromotes the signed PDF in InputFile to B-LT and writes the result to the stream OutputStream instead of a file
ApplyPAdESLongTermArchiveValidationRuns the B-LT promotion and appends a document time-stamp whose token comes from the configured time-stamp server (B-LTA); writes the result to OutputFile
ApplyPAdESLongTermArchiveValidationToStreamRuns the B-LTA promotion and writes the result to the stream OutputStream instead of a file
RenewPAdESArchiveVerifiedRenews the archive of the signed PDF in InputFile only after a checked run: verifies the signature field FieldName against the explicit trust anchors TrustAnchorsDER, applies the B-LTA promotion on a private copy, reopens the result and validates it historically at ValidationTimeUTC; publishes OutputFile and fills Report with the historical validation report
GetPAdESLTVCertificateCountReturns how many certificates the last long-term validation call staged
GetPAdESLTVCRLCountReturns how many CRLs the last long-term validation call staged
GetPAdESLTVOCSPCountReturns how many OCSP responses the last long-term validation call staged
GetPAdESLTVErrorReturns the first reason why the last long-term validation call did not complete
EndPAdESDSSProcessToFileRuns the DSS process and writes the augmented PDF to OutputFile
EndPAdESDSSProcessToStreamRuns the DSS process and writes the augmented PDF to the stream OutputStream
EndPAdESDSSProcessToStringRuns the DSS process and returns the augmented PDF as bytes
GetPAdESDSSProcessResultReturns the result code the DSS process recorded
ReleasePAdESDSSProcessRemoves the DSS process from the instance and invalidates its ID; returns 1
SetTimeStampServerStores the time-stamp authority URL with the credentials UserName and Password for the built-in time-stamp client; returns 1
SetTimeStampOptionsSets the digest algorithm, the certificate request, the nonce use, the timeout TimeoutMS and the policy OID of the time-stamp client; returns 1, or 0 for a digest algorithm outside 0 to 8
SetTimeStampRetryCountSets the number of retries of the time-stamp client, clamped to 0 to 10; returns 1
FetchTimeStampTokenSends the digest MessageDigestHex to the configured time-stamp authority and returns the token DER; records the status and the error of the exchange
GetTimeStampStatusReturns the RFC 3161 status the authority reported for the last exchange
GetTimeStampErrorReturns the reason why the last time-stamp exchange failed
ApplyPAdESSignatureTimeStampHashes the signature value of signer SignerIndex in the field of the process, fetches a time-stamp token for the hash and attaches it; returns the result of attaching the token
NewPAdESSignatureTimeStampProcessFromFileCreates a signature time-stamp process over the PDF in InputFile and returns its process ID
NewPAdESSignatureTimeStampProcessFromStreamCreates a signature time-stamp process over the stream InputStream and returns its process ID
NewPAdESSignatureTimeStampProcessFromStringCreates a signature time-stamp process over the PDF bytes Source and returns its process ID
SetPAdESSignatureTimeStampFieldSelects the signature field SignatureFieldName whose signature the process time-stamps
SetPAdESSignatureTimeStampDigestAlgorithmSelects the digest algorithm used to hash the signature value; 0 to 8, where 5 to 7 select SHA-3 and 8 selects SM3
GetPAdESSignatureValueHashHexPrepares the process and returns the hash of the selected signature value
GetPAdESSignatureCMSBytesPrepares the process when needed and returns the current CMS bytes of the signature
SetPAdESSignatureTimeStampTokenPasses the token TimeStampTokenDER to the process, which validates it and attaches it to signer SignerIndex; returns the result of the process
SetPAdESSignatureCMSBytesReplaces the CMS bytes the process writes back with NewCMSBytes; returns 1
BuildPAdESSignatureTimeStampAttributeWraps the token TimeStampTokenDER in a CMS id-aa-signatureTimeStampToken attribute and returns its DER bytes
EndPAdESSignatureTimeStampProcessToFileApplies the process and writes the time-stamped PDF to OutputFile
EndPAdESSignatureTimeStampProcessToStreamApplies the process and writes the time-stamped PDF to the stream OutputStream
EndPAdESSignatureTimeStampProcessToStringApplies the process and returns the time-stamped PDF as bytes
GetPAdESSignatureTimeStampProcessResultReturns the result code the process recorded
ReleasePAdESSignatureTimeStampProcessRemoves the process from the instance and invalidates its ID; returns 1

Remarks

The class holds the DSS processes and the signature time-stamp processes it created. Every NewPAdES* method returns a process ID; the AddPAdESDSS*, SetPAdESSignature*, GetPAdESSignature* and EndPAdES* methods take it, and ReleasePAdES* removes the process and invalidates the ID. AddSignProcessRevocationCRL, AddSignProcessRevocationOCSP, ClearSignProcessRevocationInfo and SetSignProcessDocTimeStamp take the ID of a sign process instead.

The time-stamp client is configured with SetTimeStampServer, SetTimeStampOptions and SetTimeStampRetryCount. FetchTimeStampToken, the signature time-stamp and the B-LTA promotion use that configuration, and GetTimeStampStatus and GetTimeStampError report the last exchange. A B-LTA promotion returns 4 when no time-stamp server is configured.

The offline half of the revocation work, reading the addresses out of a certificate and parsing a response the caller holds, is implemented by the Small Business class TPDFlibSBCertificate; this class holds the methods that reach the network.

RenewPAdESArchiveVerified is the only public method of the class that TPDFlib does not declare. It needs 1 to 32 explicit trust anchors and a time-stamp server with SHA-256, SHA-384 or SHA-512, and it does not overwrite an existing OutputFile. When a check fails, nothing is published, the method returns 0 and GetPAdESLTVError returns the reason.

Applications normally create TPDFlibEnterprise and get the methods of this class through them. The same methods on a plain TPDFlib return 0, an empty string or False and set LastErrorCode to PDFLIB_ERROR_ENTERPRISE_REQUIRED. An Enterprise method called on TPDFlibSmallBusiness is rejected the same way, because that edition does not carry it.

See also

TPDFlibEntSignVerify, TPDFlibEntPubSec, TPDFlibEnterprise, TPDFlibSmallBusiness, TPDFlibSBCertificate