FetchTimeStampToken

Digital signatures

Requires the Enterprise edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibEnterprise (unit PDFlibEnterprise); the Enterprise DLL and ActiveX builds provide it unchanged; other editions keep the method, which returns an empty string and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)

Description

Obtains an RFC 3161 TimeStampToken for a digest from the configured authority

Syntax

Delphi

Function TPDFlib.FetchTimeStampToken(Const MessageDigestHex: AnsiString): AnsiString; Virtual;

DLL

const char* DLFetchTimeStampToken(int InstanceID, const char* MessageDigestHex, int MessageDigestHexLength, int* ByteCount);

ActiveX

Function PDFlib::FetchTimeStampToken(MessageDigestHex As Variant) As Variant

Parameters

MessageDigestHexHex digest of the data being stamped. Its length must match the algorithm set by SetTimeStampOptions

Return values

TokenThe TimeStampToken as DER bytes
Empty stringThe exchange failed; GetTimeStampError carries the reason

Remarks

The token is returned exactly as the authority produced it, so it can be attached with SetPAdESSignatureTimeStampToken, used as a document time-stamp, or stored for an audit trail

For the common case of time-stamping a signature that was just written, ApplyPAdESSignatureTimeStamp does the hashing, the fetch and the attachment in one call

Example

Token:= PDF.FetchTimeStampToken(PDF.GetPAdESSignatureValueHashHex(ProcessID));
if Token= '' then
  ShowMessage(PDF.GetTimeStampError);

See also

SetTimeStampServer, SetTimeStampOptions, ApplyPAdESSignatureTimeStamp, GetTimeStampError