Class TimestampClient
- Namespace
- SimpleSign.Core.Crypto
- Assembly
- SimpleSign.Core.dll
RFC 3161 client for timestamp authority (TSA). Async-first, compatible with ITI-BR TSA and other PAdES providers.
public sealed class TimestampClient
- Inheritance
-
TimestampClient
- Inherited Members
Constructors
TimestampClient(HttpClient, string, ILogger?)
Initializes with the TSA URL and a configured HttpClient (dependency injection).
public TimestampClient(HttpClient httpClient, string tsaUrl, ILogger? logger = null)
Parameters
httpClientHttpClienttsaUrlstringloggerILogger
Methods
EmbedTimestampInCms(byte[], byte[])
Embeds a timestamp token in the CMS as an unsigned attribute
id-aa-signatureTimeStampToken (RFC 3161 / PAdES).
public static byte[] EmbedTimestampInCms(byte[] cms, byte[] timestampToken)
Parameters
Returns
- byte[]
ExtractSignatureValue(byte[])
Extracts the raw signature value bytes from a DER-encoded CMS/SignedData structure. Per RFC 3161 §3.1 and PAdES, the id-aa-signatureTimeStampToken must timestamp the value of SignerInfo.signature (the raw octets, not the DER OCTET STRING wrapper).
public static byte[] ExtractSignatureValue(byte[] cms)
Parameters
cmsbyte[]
Returns
- byte[]
GetTimestampAsync(ReadOnlyMemory<byte>, HashAlgorithmName, CancellationToken)
Requests a timestamp token for the provided bytes.
public Task<byte[]> GetTimestampAsync(ReadOnlyMemory<byte> dataToTimestamp, HashAlgorithmName hashAlgorithm, CancellationToken cancellationToken = default)
Parameters
dataToTimestampReadOnlyMemory<byte>The bytes to be timestamped (usually the CMS signature).
hashAlgorithmHashAlgorithmNameHash algorithm for the timestamp (SHA-256 recommended).
cancellationTokenCancellationTokenCancellation token.