PdfTimestampClient class
Namespace: PdfNetStack.Signing
Assembly: PdfNetStack.dll
Package: PdfNetStack
An RFC 3161 time stamp authority. The library builds the request and checks the reply; the application supplies the transport, usually an HTTP POST of the request with content type application/timestamp-query that returns the application/timestamp-reply body. The library itself never opens a connection.
public sealed class PdfTimestampClientInheritance
Examples
Section titled “Examples”var http = new HttpClient();
var tsa = new PdfTimestampClient(request =>
{
using var content = new ByteArrayContent(request);
content.Headers.ContentType = new MediaTypeHeaderValue("application/timestamp-query");
using HttpResponseMessage reply = http.PostAsync("https://tsa.example/", content).GetAwaiter().GetResult();
reply.EnsureSuccessStatusCode();
return reply.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult();
});
Constructors
Section titled “Constructors”PdfTimestampClient(Func<byte[], byte[]>)
Section titled “ PdfTimestampClient(Func<byte[], byte[]>)”Creates a client that sends each DER encoded TimeStampReq through send and reads the DER TimeStampResp it returns.
public PdfTimestampClient(Func<byte[], byte[]> send)Parameters
Section titled “Parameters”Properties
Section titled “Properties”Digest
Section titled “ Digest”The hash sent to the authority. Default SHA-256.
public PdfDigestAlgorithm Digest { get; init; }Property Value
Section titled “Property Value”PolicyOid
Section titled “ PolicyOid”The policy to request, as an object identifier; null for the authority’s default.
public string? PolicyOid { get; init; }Property Value
Section titled “Property Value”ReservedSize
Section titled “ ReservedSize”Bytes reserved in the PDF for a token. Default 12288, enough for a token that carries the authority’s certificate chain. Signing fails, after the request, when a token is larger.
public int ReservedSize { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”GetToken(byte[])
Section titled “ GetToken(byte[])”Timestamps data: sends its hash with a random nonce and returns the
DER encoded token after checking the reply. The reply must grant the request, echo the
hash and the nonce, and be signed by a certificate in the token that is marked for time
stamping only (a critical extended key usage).
public byte[] GetToken(byte[] data)Parameters
Section titled “Parameters”data byte[]
Returns
Section titled “Returns”byte[]
Exceptions
Section titled “Exceptions”The authority refused the request or its reply is invalid.