Rfc3161TimestampRequest.CreateFromData 方法

定义

通过使用指定的算法对提供的数据进行哈希处理,创建时间戳请求。

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

参数

data
ReadOnlySpan<Byte>

数据到时间戳,将通过此方法进行哈希处理。

hashAlgorithm
HashAlgorithmName

要与此时间戳请求一起使用的哈希算法。

requestedPolicyId
Oid

时间戳颁发机构 (TSA) 应使用的时间戳策略的对象标识符 (OID),或用来表示无首选项的 null

nonce
Nullable<ReadOnlyMemory<Byte>>

一个可选的 nonce(使用一次的数字),用于唯一标识此请求以将其与响应配对。 该值被解释为无符号大端的整数,并且可以规范化为编码格式。

requestSignerCertificates
Boolean

指示时间戳颁发机构 (TSA) 的 true 必须在已颁发的时间戳令牌中包含签名证书;否则为 false

extensions
X509ExtensionCollection

要包含在请求中的可选扩展集合。

返回

一个 Rfc3161TimestampRequest,它表示所选值。

例外

hashAlgorithm.NamenullEmpty

hashAlgorithm 不是已知的哈希算法。

注解

加密时间戳始终应用于数据哈希和用于对数据进行哈希的哈希算法的算法标识符的组合。 在尚未对数据进行哈希处理时,此方法是一种便捷的替代方法 CreateFromHash(ReadOnlyMemory<Byte>, HashAlgorithmName, Oid, Nullable<ReadOnlyMemory<Byte>>, Boolean, X509ExtensionCollection)

此方法中的 nonce 值被视为无符号 big-endian 整数。 此方法在分配 nonce 值之前将输入规范化为 BER INTEGER 编码。 规范化值由 GetNonce() 方法返回。

适用于

另请参阅