Rfc3161TimestampToken.VerifySignatureForHash 方法

定义

重载

VerifySignatureForHash(ReadOnlySpan<Byte>, HashAlgorithmName, X509Certificate2, X509Certificate2Collection)

验证当前令牌是否为提供的数据哈希和算法标识符的有效时间戳令牌。

VerifySignatureForHash(ReadOnlySpan<Byte>, Oid, X509Certificate2, X509Certificate2Collection)

验证当前令牌是否为提供的数据哈希和算法标识符的有效时间戳令牌。

VerifySignatureForHash(ReadOnlySpan<Byte>, HashAlgorithmName, X509Certificate2, X509Certificate2Collection)

Source:
Rfc3161TimestampToken.cs
Source:
Rfc3161TimestampToken.cs
Source:
Rfc3161TimestampToken.cs

验证当前令牌是否为提供的数据哈希和算法标识符的有效时间戳令牌。

public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out System.Security.Cryptography.X509Certificates.X509Certificate2 signerCertificate, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraCandidates = default);
public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out System.Security.Cryptography.X509Certificates.X509Certificate2? signerCertificate, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? extraCandidates = default);
member this.VerifySignatureForHash : ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * X509Certificate2 * System.Security.Cryptography.X509Certificates.X509Certificate2Collection -> bool
Public Function VerifySignatureForHash (hash As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, ByRef signerCertificate As X509Certificate2, Optional extraCandidates As X509Certificate2Collection = Nothing) As Boolean

参数

hash
ReadOnlySpan<Byte>

要根据此时间戳令牌验证的加密哈希。

hashAlgorithm
HashAlgorithmName

生成 hash 的算法。

signerCertificate
X509Certificate2

此方法返回结果时,从签署此令牌的时间戳颁发机构 (TSA) 返回证书,如果无法确定签名者证书,则返回 null。 该参数未经初始化即被处理。

extraCandidates
X509Certificate2Collection

除了令牌中可能包含的任何证书之外,还可以考虑作为时间戳颁发机构 (TSA) 证书的可选证书集合。

返回

如果找到了时间戳颁发机构(TSA)证书,证书公钥对令牌签名进行了验证,并且该令牌与提供的数据的哈希和算法匹配,则为 true否则,为 false

注解

此方法要求时间戳颁发机构 (TSA) 证书具有所需的扩展密钥使用值 (1.3.6.1.5.5.7.3.8) , 匹配令牌的嵌入 ESSCertID 或 ESSCertID2 标识符,具有包含令牌时间戳值的有效性范围,并且具有成功验证令牌签名的公钥。

确定适当的 TSA 证书后,此方法会将提供的摘要和算法标识符与令牌中的相应值进行比较。 如果摘要和算法都与令牌的值匹配,则通过 signerCertificate 报告证书,并且 方法返回 true

如果摘要不匹配、算法不匹配或无法确定 TSA 证书,该方法将报告 signerCertificatenull 并返回 false

另请参阅

适用于

VerifySignatureForHash(ReadOnlySpan<Byte>, Oid, X509Certificate2, X509Certificate2Collection)

Source:
Rfc3161TimestampToken.cs
Source:
Rfc3161TimestampToken.cs
Source:
Rfc3161TimestampToken.cs

验证当前令牌是否为提供的数据哈希和算法标识符的有效时间戳令牌。

public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, System.Security.Cryptography.Oid hashAlgorithmId, out System.Security.Cryptography.X509Certificates.X509Certificate2 signerCertificate, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraCandidates = default);
public bool VerifySignatureForHash (ReadOnlySpan<byte> hash, System.Security.Cryptography.Oid hashAlgorithmId, out System.Security.Cryptography.X509Certificates.X509Certificate2? signerCertificate, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? extraCandidates = default);
member this.VerifySignatureForHash : ReadOnlySpan<byte> * System.Security.Cryptography.Oid * X509Certificate2 * System.Security.Cryptography.X509Certificates.X509Certificate2Collection -> bool
Public Function VerifySignatureForHash (hash As ReadOnlySpan(Of Byte), hashAlgorithmId As Oid, ByRef signerCertificate As X509Certificate2, Optional extraCandidates As X509Certificate2Collection = Nothing) As Boolean

参数

hash
ReadOnlySpan<Byte>

要根据此时间戳令牌验证的加密哈希。

hashAlgorithmId
Oid

哈希算法的 OID。

signerCertificate
X509Certificate2

此方法返回结果时,从签署此令牌的时间戳颁发机构 (TSA) 返回证书,如果无法确定签名者证书,则返回 null。 该参数未经初始化即被处理。

extraCandidates
X509Certificate2Collection

除了令牌中可能包含的任何证书之外,还可以考虑作为时间戳颁发机构 (TSA) 证书的可选证书集合。

返回

如果找到了时间戳颁发机构(TSA)证书,证书公钥对令牌签名进行了验证,并且该令牌与提供的数据的哈希和算法匹配,则为 true否则,为 false

注解

此方法要求 TSA 证书具有所需的扩展密钥使用值 (1.3.6.1.5.5.7.3.8) ,匹配令牌的嵌入 ESSCertID 或 ESSCertID2 标识符,具有包含令牌时间戳值的有效范围,并且具有成功验证令牌签名的公钥。

确定适当的 TSA 证书后,此方法会将提供的摘要和算法标识符与令牌中的相应值进行比较。 如果摘要和算法都与令牌的值匹配,则通过 signerCertificate 报告证书,并且 方法返回 true

如果摘要不匹配、算法不匹配或无法确定 TSA 证书,该方法将报告 signerCertificatenull 并返回 false

另请参阅

适用于