ApplyPAdESSignatureTimeStamp

Digital signatures

Description

Completes a PAdES-B-T signature time-stamp in one call.

Syntax

Delphi

Function TPDFlib.ApplyPAdESSignatureTimeStamp(STSProcessID, SignerIndex: Integer): Integer;

Parameters

STSProcessIDA signature time-stamp process created by one of the NewPAdESSignatureTimeStampProcess functions.
SignerIndexZero-based signer whose signature value is stamped.

Return values

1The token was obtained and attached.
0The exchange or the attachment failed; GetTimeStampError carries the reason.

Remarks

This hashes the signature value of the process target field, requests a token from the authority set by SetTimeStampServer, and attaches it as the signature time-stamp unsigned attribute. Call one of the End functions afterwards to write the output.

The individual steps remain available for a caller that obtains tokens from elsewhere: GetPAdESSignatureValueHashHex then SetPAdESSignatureTimeStampToken.

Example

PDF.SetTimeStampServer('https://tsa.example.com/tsa', '', '');
ProcessID:= PDF.NewPAdESSignatureTimeStampProcessFromFile('signed.pdf', '');
PDF.SetPAdESSignatureTimeStampField(ProcessID, 'Signature1');
if PDF.ApplyPAdESSignatureTimeStamp(ProcessID, 0)= 1 then
  PDF.EndPAdESSignatureTimeStampProcessToFile(ProcessID, 'signed-bt.pdf');
PDF.ReleasePAdESSignatureTimeStampProcess(ProcessID);

See also

FetchTimeStampToken, SetTimeStampServer, SetPAdESSignatureTimeStampToken