SetTimeStampOptions
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
Sets the hash algorithm, certificate request, nonce use, timeout and requested policy for the time-stamp client
Syntax
Delphi
Function TPDFlib.SetTimeStampOptions(DigestAlgorithm, RequestCertificates, UseNonce, TimeoutMS: Integer; Const PolicyOID: WideString): Integer; Virtual;ActiveX
Function PDFlib::SetTimeStampOptions(DigestAlgorithm As Long, RequestCertificates As Long, UseNonce As Long, TimeoutMS As Long, PolicyOID As String) As LongDLL
int DLSetTimeStampOptions(int InstanceID, int DigestAlgorithm, int RequestCertificates, int UseNonce, int TimeoutMS, const wchar_t* PolicyOID);
int DLSetTimeStampOptionsA(int InstanceID, int DigestAlgorithm, int RequestCertificates, int UseNonce, int TimeoutMS, const char* PolicyOID);Parameters
| DigestAlgorithm | 0 = 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 |
|---|---|
| RequestCertificates | Non-zero asks the authority to embed its signing chain in the token, which long-term validation needs |
| UseNonce | Non-zero sends a fresh random nonce and rejects a token that does not echo it |
| TimeoutMS | Timeout for each network phase; 0 selects 30 seconds |
| PolicyOID | Dotted-decimal policy the authority should apply, or an empty string to let it choose |
Return values
| 1 | The settings were stored |
|---|---|
| 0 | DigestAlgorithm 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