SetTimeStampOptionsA

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 0, an empty string or False and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to SetTimeStampOptions and string arguments are interpreted using the current SetAnsiMode code page

Sets the hash algorithm, certificate request, nonce use, timeout and requested policy for the time-stamp client

Syntax

Delphi

Function DLSetTimeStampOptionsA(InstanceID: Integer; DigestAlgorithm: Integer; RequestCertificates: Integer; UseNonce: Integer; TimeoutMS: Integer; PolicyOID: PAnsiChar): Integer;

DLL

int DLSetTimeStampOptionsA(int InstanceID, int DigestAlgorithm, int RequestCertificates, int UseNonce, int TimeoutMS, const char* PolicyOID);

Parameters

DigestAlgorithm0 = auto (SHA-256), 1 = SHA-1, 2 = SHA-256 (the default), 3 = SHA-384, 4 = SHA-512, 5 = SHA3-256, 6 = SHA3-384, 7 = SHA3-512, 8 = SM3
RequestCertificatesNon-zero asks the authority to embed its signing chain in the token, which long-term validation needs
UseNonceNon-zero sends a fresh random nonce and rejects a token that does not echo it
TimeoutMSTimeout for each network phase; 0 selects 30 seconds
PolicyOIDDotted-decimal policy the authority should apply, or an empty string to let it choose

Return values

1The settings were stored
0DigestAlgorithm is outside 0..8

Remarks

The digest length is checked against the selected algorithm before anything is sent, so a 20-byte digest submitted with SHA-256 selected fails locally with a clear message instead of coming back as a generic authority rejection

Leaving the nonce enabled is what makes a replayed response detectable: RFC 3161 requires the token to carry the nonce back, and a mismatch aborts the exchange

See also

SetTimeStampServer, FetchTimeStampToken, GetTimeStampStatus