Rfc3161TimestampRequest.CreateFromHash Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateFromHash(ReadOnlyMemory<Byte>, HashAlgorithmName, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection) |
Create a timestamp request using a pre-computed hash value and the name of the hash algorithm. |
CreateFromHash(ReadOnlyMemory<Byte>, Oid, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection) |
Create a timestamp request using a pre-computed hash value and the Object Identifier for the hash algorithm. |
CreateFromHash(ReadOnlyMemory<Byte>, HashAlgorithmName, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection)
- Source:
- Rfc3161TimestampRequest.cs
- Source:
- Rfc3161TimestampRequest.cs
Create a timestamp request using a pre-computed hash value and the name of the hash algorithm.
public static System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory<byte> hash, 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 CreateFromHash (ReadOnlyMemory<byte> hash, 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 CreateFromHash : ReadOnlyMemory<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 CreateFromHash (hash As ReadOnlyMemory(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
- hash
- ReadOnlyMemory<Byte>
The pre-computed hash value to be timestamped.
- hashAlgorithm
- HashAlgorithmName
The hash algorithm used to produce hash
.
- requestedPolicyId
- Oid
The Object Identifier (OID) for the timestamp policy that the Timestamp Authority (TSA) should use, or null
to express no preference.
- nonce
- Nullable<ReadOnlyMemory<Byte>>
An optional value used to uniquely match a request to a response, or null
to not include a nonce in the request.
- 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
is not a known hash algorithm.
Remarks
This method uses the hashAlgorithm
parameter to determine the Object Identifier (OID) to include in the timestamp request.
When building a request for a timestamp based on a hash algorithm that this method does not support, use the
CreateFromHash(ReadOnlyMemory<Byte>, Oid, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection) overload.
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.
See also
- CreateFromData(ReadOnlySpan<Byte>, HashAlgorithmName, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection)
- CreateFromHash(ReadOnlyMemory<Byte>, Oid, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection)
Applies to
CreateFromHash(ReadOnlyMemory<Byte>, Oid, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection)
- Source:
- Rfc3161TimestampRequest.cs
- Source:
- Rfc3161TimestampRequest.cs
Create a timestamp request using a pre-computed hash value and the Object Identifier for the hash algorithm.
public static System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest CreateFromHash (ReadOnlyMemory<byte> hash, System.Security.Cryptography.Oid hashAlgorithmId, 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 CreateFromHash (ReadOnlyMemory<byte> hash, System.Security.Cryptography.Oid hashAlgorithmId, System.Security.Cryptography.Oid requestedPolicyId = default, ReadOnlyMemory<byte>? nonce = default, bool requestSignerCertificates = false, System.Security.Cryptography.X509Certificates.X509ExtensionCollection extensions = default);
static member CreateFromHash : ReadOnlyMemory<byte> * System.Security.Cryptography.Oid * System.Security.Cryptography.Oid * Nullable<ReadOnlyMemory<byte>> * bool * System.Security.Cryptography.X509Certificates.X509ExtensionCollection -> System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest
Public Shared Function CreateFromHash (hash As ReadOnlyMemory(Of Byte), hashAlgorithmId As Oid, 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
- hash
- ReadOnlyMemory<Byte>
The pre-computed hash value to be timestamped.
- hashAlgorithmId
- Oid
The Object Identifier (OID) for the hash algorithm that produced hash
.
- 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
hashAlgorithmId
is null
.
hashAlgorithmId
.Value is not a valid OID.
Remarks
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.