PDFium Delphi Component Docs

FPdfTsaFpc unit

Unit: FPdfTsaFpc
Free Pascal libcurl timestamp transport backend that posts an RFC 3161 request to a timestamp authority URL and returns the response bytes

Syntax

const
  TsaMaxResponseBytes = 4 * 1024 * 1024;
  TsaRequestTimeoutSeconds = 30;
  TsaConnectTimeoutSeconds = 30;

function TsaHttpAvailable: Boolean;
function TsaHttpBackendName: string;
function PostTimeStampQuery(const TsaUrl: string; const ReqDer: TBytes;
  out RespDer: TBytes): Boolean;

Description

FPdfTsaFpc is the non-Windows timestamp transport consumed by FPdfTsa, the counterpart of FPdfTsaWin. It POSTs an encoded TimeStampReq to a timestamp authority URL over HTTP or HTTPS and collects the TimeStampResp bytes; building and parsing the DER stays in FPdfTsa

The transport is libcurl, bound at run time rather than linked, so the library is not a build-time dependency and its absence is reported instead of failing the load. Going through libcurl also keeps the TLS stack out of this unit: libcurl selects its own backend and validates the server chain against the platform trust store

TsaHttpAvailable reports whether libcurl was found and the required entry points resolved; TsaHttpBackendName names the resolved backend; PostTimeStampQuery performs the HTTP exchange and returns False (rather than raising) on any transport failure, letting the caller add its own context and retry policy

The whole interface section is compiled under FPC only. Under Delphi the unit is empty, because Delphi targets Windows and FPdfTsaWin is the backend there. The unit still compiles on every FPC target including Windows, where FPdfTsa prefers the WinHttp backend and nothing calls into this one

The libcurl handle types, entry-point bindings and option constants live in the implementation section; the interface exposes only the availability check, the backend name, the post helper and the three transport limits

Functions

FunctionDescription
TsaHttpAvailableReturns True when libcurl was located and every required entry point resolved at run time
TsaHttpBackendNameReturns the name of the resolved backend, libcurl when the transport is usable and an empty string otherwise
PostTimeStampQueryPOSTs ReqDer to TsaUrl and fills RespDer with the raw TimeStampResp body; returns False on transport failure

Constants

ConstantValueDescription
TsaMaxResponseBytes4 * 1024 * 1024Upper bound on the accepted TimeStampResp body; a larger response aborts the transfer instead of growing the buffer without limit. Kept in sync with the same constant in FPdfTsaWin
TsaRequestTimeoutSeconds30Whole-request budget in seconds, matching the WinHttp timeouts so a dead TSA cannot hang a signing thread on either platform
TsaConnectTimeoutSeconds30Connect budget in seconds, applied before the request budget

Remarks

See Also

FPdfTsa, FPdfTsaWin, FPdfCms, TPdf.SignPades