API reference › Digital Signatures
tsaRequestTimeStamp
The raw, low-level RFC-3161 primitive underlying
int32_t __stdcall tsaRequestTimeStamp(const char* UrlPtr, uint8_t* HashPtr, uint32_t HashLen, uint8_t* OutBuf, uint32_t OutCap, uint32_t* OutLen);
function tsaRequestTimeStamp(UrlPtr: PAnsiChar; HashPtr: PByte; HashLen: Cardinal; OutBuf: PByte; OutCap: Cardinal; var OutLen: Cardinal): Integer; stdcall;
Purpose. The raw, low-level RFC-3161 primitive underlying pdfAddDocTimeStamp — takes a caller-supplied hash directly (not a whole document) and returns the raw TSA response bytes, with no document/PDF involvement at all. Useful for timestamping arbitrary data or building a custom PAdES/CAdES pipeline outside this SDK's own document model.
Description. Builds the same BuildTimeStampReq/TSAFetch request as pdfAddDocTimeStamp, but over the caller's own HashPtr/HashLen bytes directly (no digest computed here — the caller must supply an already-hashed value, always treated as SHA-256 per the hardcoded OID). OutLen is always written with the true response length (even if OutBuf is nil or OutCap is too small — a query-length-first pattern), while the response bytes themselves are only copied into OutBuf if it's non-nil and OutCap is sufficient.
Parameters.
| Parameter | Description |
|---|---|
UrlPtr | TSA URL. |
HashPtr, HashLen | The pre-computed message-imprint hash (SHA-256 assumed). |
OutBuf, OutCap | Output buffer and its capacity; may be nil/0 to query the required length only. |
OutLen | Output: the true response length, always written regardless of whether it was copied. |
Return value. 0 if a response was received (regardless of its TSA status code — the caller must parse it, e.g. via tsaParseResponse); -1 if UrlPtr/HashPtr/HashLen are invalid; -2 on a network/transport failure.
C# (P/Invoke)
public static extern int tsaRequestTimeStamp(IntPtr UrlPtr, byte[] HashPtr, uint HashLen, byte[] OutBuf, uint OutCap, ref uint OutLen);
Misc
tsaRequestTimeStamp
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.