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
| SetSignProcessDocTimeStamp | Switches the sign process into document time-stamp mode (/DocTimeStamp with /ETSI.RFC3161) and reserves SignatureLength bytes for the token, 8192 when 0 is passed |
|---|---|
| AddSignProcessRevocationCRL | Adds the CRL to the revocation info the sign process carries in its signature |
| AddSignProcessRevocationOCSP | Adds the OCSP response to the revocation info the sign process carries in its signature |
| ClearSignProcessRevocationInfo | Removes every CRL and OCSP response from the sign process |
| NewPAdESDSSProcessFromFile | Creates a DSS process over the signed PDF in InputFile and returns its process ID |
| NewPAdESDSSProcessFromStream | Creates a DSS process over the stream InputStream and returns its process ID |
| NewPAdESDSSProcessFromString | Creates a DSS process over the PDF bytes Source and returns its process ID |
| AddPAdESDSSCertificate | Adds the DER certificate to the DSS process; the bytes have to be exactly one DER sequence |
| AddPAdESDSSCRL | Adds the DER CRL to the DSS process; the bytes have to be exactly one DER sequence |
| AddPAdESDSSOCSP | Adds the DER OCSP response to the DSS process; the bytes have to be exactly one DER sequence |
| AddPAdESDSSVRI | Adds a VRI entry for the signature whose /Contents hash is SigContentsHashHex, pointing at the listed certificate, CRL and OCSP indexes |
| FetchRevocationMaterial | Downloads the bytes at URL with an HTTP GET, or over LDAP for an ldap:// address; returns an empty string when the download fails |
| AddPAdESDSSCRLFromURL | Downloads a CRL from URL and adds it to the DSS process |
| AddPAdESDSSCertificateFromURL | Downloads a certificate from URL, accepting a bare DER certificate or a certs-only PKCS#7 answer, and adds it to the DSS process |
| FetchOCSPResponse | Posts 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 |
| AddPAdESDSSOCSPFromCertificates | Fetches the OCSP response for the certificate pair and adds it to the DSS process |
| ApplyPAdESLongTermValidation | Promotes 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 |
| ApplyPAdESLongTermValidationToStream | Promotes the signed PDF in InputFile to B-LT and writes the result to the stream OutputStream instead of a file |
| ApplyPAdESLongTermArchiveValidation | Runs 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 |
| ApplyPAdESLongTermArchiveValidationToStream | Runs the B-LTA promotion and writes the result to the stream OutputStream instead of a file |
| RenewPAdESArchiveVerified | Renews 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 |
| GetPAdESLTVCertificateCount | Returns how many certificates the last long-term validation call staged |
| GetPAdESLTVCRLCount | Returns how many CRLs the last long-term validation call staged |
| GetPAdESLTVOCSPCount | Returns how many OCSP responses the last long-term validation call staged |
| GetPAdESLTVError | Returns the first reason why the last long-term validation call did not complete |
| EndPAdESDSSProcessToFile | Runs the DSS process and writes the augmented PDF to OutputFile |
| EndPAdESDSSProcessToStream | Runs the DSS process and writes the augmented PDF to the stream OutputStream |
| EndPAdESDSSProcessToString | Runs the DSS process and returns the augmented PDF as bytes |
| GetPAdESDSSProcessResult | Returns the result code the DSS process recorded |
| ReleasePAdESDSSProcess | Removes the DSS process from the instance and invalidates its ID; returns 1 |
| SetTimeStampServer | Stores the time-stamp authority URL with the credentials UserName and Password for the built-in time-stamp client; returns 1 |
| SetTimeStampOptions | Sets 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 |
| SetTimeStampRetryCount | Sets the number of retries of the time-stamp client, clamped to 0 to 10; returns 1 |
| FetchTimeStampToken | Sends the digest MessageDigestHex to the configured time-stamp authority and returns the token DER; records the status and the error of the exchange |
| GetTimeStampStatus | Returns the RFC 3161 status the authority reported for the last exchange |
| GetTimeStampError | Returns the reason why the last time-stamp exchange failed |
| ApplyPAdESSignatureTimeStamp | Hashes 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 |
| NewPAdESSignatureTimeStampProcessFromFile | Creates a signature time-stamp process over the PDF in InputFile and returns its process ID |
| NewPAdESSignatureTimeStampProcessFromStream | Creates a signature time-stamp process over the stream InputStream and returns its process ID |
| NewPAdESSignatureTimeStampProcessFromString | Creates a signature time-stamp process over the PDF bytes Source and returns its process ID |
| SetPAdESSignatureTimeStampField | Selects the signature field SignatureFieldName whose signature the process time-stamps |
| SetPAdESSignatureTimeStampDigestAlgorithm | Selects the digest algorithm used to hash the signature value; 0 to 8, where 5 to 7 select SHA-3 and 8 selects SM3 |
| GetPAdESSignatureValueHashHex | Prepares the process and returns the hash of the selected signature value |
| GetPAdESSignatureCMSBytes | Prepares the process when needed and returns the current CMS bytes of the signature |
| SetPAdESSignatureTimeStampToken | Passes the token TimeStampTokenDER to the process, which validates it and attaches it to signer SignerIndex; returns the result of the process |
| SetPAdESSignatureCMSBytes | Replaces the CMS bytes the process writes back with NewCMSBytes; returns 1 |
| BuildPAdESSignatureTimeStampAttribute | Wraps the token TimeStampTokenDER in a CMS id-aa-signatureTimeStampToken attribute and returns its DER bytes |
| EndPAdESSignatureTimeStampProcessToFile | Applies the process and writes the time-stamped PDF to OutputFile |
| EndPAdESSignatureTimeStampProcessToStream | Applies the process and writes the time-stamped PDF to the stream OutputStream |
| EndPAdESSignatureTimeStampProcessToString | Applies the process and returns the time-stamped PDF as bytes |
| GetPAdESSignatureTimeStampProcessResult | Returns the result code the process recorded |
| ReleasePAdESSignatureTimeStampProcess | Removes 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