Edit

Share via


Rfc3161TimestampRequest.CreateFromData Method

Definition

Creates a timestamp request by hashing the provided data with a specified algorithm.

public static System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest CreateFromData (ReadOnlySpan<byte> data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.Oid? requestedPolicyId = default, ReadOnlyMemory<byte>? nonce = default, bool requestSignerCertificates = false, System.Security.Cryptography.X509Certificates.X509ExtensionCollection? extensions = default);
public static System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest CreateFromData (ReadOnlySpan<byte> data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.Oid requestedPolicyId = default, ReadOnlyMemory<byte>? nonce = default, bool requestSignerCertificates = false, System.Security.Cryptography.X509Certificates.X509ExtensionCollection extensions = default);
static member CreateFromData : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.Oid * Nullable<ReadOnlyMemory<byte>> * bool * System.Security.Cryptography.X509Certificates.X509ExtensionCollection -> System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest
Public Shared Function CreateFromData (data As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, Optional requestedPolicyId As Oid = Nothing, Optional nonce As Nullable(Of ReadOnlyMemory(Of Byte)) = Nothing, Optional requestSignerCertificates As Boolean = false, Optional extensions As X509ExtensionCollection = Nothing) As Rfc3161TimestampRequest

Parameters

data
ReadOnlySpan<Byte>

The data to timestamp, which will be hashed by this method.

hashAlgorithm
HashAlgorithmName

The hash algorithm to use with this timestamp request.

requestedPolicyId
Oid

The Object Identifier (OID) for a timestamp policy the Timestamp Authority (TSA) should use, or null to express no preference.

nonce
Nullable<ReadOnlyMemory<Byte>>

An optional nonce (number used once) to uniquely identify this request to pair it with the response. The value is interpreted as an unsigned big-endian integer and may be normalized to the encoding format.

requestSignerCertificates
Boolean

true to indicate the Timestamp Authority (TSA) must include the signing certificate in the issued timestamp token; otherwise, false.

extensions
X509ExtensionCollection

An optional collection of extensions to include in the request.

Returns

An Rfc3161TimestampRequest representing the chosen values.

Exceptions

hashAlgorithm.Name is null or Empty.

hashAlgorithm is not a known hash algorithm.

Remarks

Cryptographic timestamps are always applied to a combination of the hash of data and the algorithm identifier for the hash algorithm used to hash the data. This method is a convenient alternative to CreateFromHash(ReadOnlyMemory<Byte>, HashAlgorithmName, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection) when the data has not already been hashed.

The nonce value in this method is treated as an unsigned, big-endian integer. This method normalizes the input to a BER INTEGER encoding before assigning the nonce value. The normalized value is returned by the GetNonce() method.

Applies to

See also