語言

RSACng.VerifyHash 方法

定義

驗證已簽署且已依指定演算法與填充模式雜湊的資料。

多載

名稱 Description
VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

驗證已簽署且已依指定演算法與填充模式雜湊的資料。

VerifyHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充,確定簽章中的雜湊值,並與提供的雜湊值比較,驗證數位簽章的有效性。

VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

驗證已簽署且已依指定演算法與填充模式雜湊的資料。

public:
 override bool VerifyHash(cli::array <System::Byte> ^ hash, cli::array <System::Byte> ^ signature, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public override bool VerifyHash(byte[] hash, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
override this.VerifyHash : byte[] * byte[] * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> bool
Public Overrides Function VerifyHash (hash As Byte(), signature As Byte(), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Boolean

參數

hash
Byte[]

用雜湊值來驗證。

signature
Byte[]

資料的簽名。

hashAlgorithm
HashAlgorithmName

雜湊演算法名稱。

padding
RSASignaturePadding

填充模式。

傳回

true如果簽名能驗證雜湊值;否則,。 false

例外狀況

hash 是 null。

-或-

signature 是 null。

-或-

padding 是 null。

Name的hashAlgorithm屬性值為nullEmpty或。

padding 不等於 Pkcs1 或 Pss。

-或-

簽名格式很糟糕。 (僅在.NET Framework 4.6 和 4.6.1 中;從 .NET Framework 4.6.2 開始,若簽章格式不當,方法會回傳 false。

適用於

VerifyHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

透過使用指定的雜湊演算法與填充,確定簽章中的雜湊值,並與提供的雜湊值比較,驗證數位簽章的有效性。

public:
 override bool VerifyHash(ReadOnlySpan<System::Byte> hash, ReadOnlySpan<System::Byte> signature, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::Security::Cryptography::RSASignaturePadding ^ padding);
public override bool VerifyHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding);
override this.VerifyHash : ReadOnlySpan<byte> * ReadOnlySpan<byte> * System.Security.Cryptography.HashAlgorithmName * System.Security.Cryptography.RSASignaturePadding -> bool
Public Overrides Function VerifyHash (hash As ReadOnlySpan(Of Byte), signature As ReadOnlySpan(Of Byte), hashAlgorithm As HashAlgorithmName, padding As RSASignaturePadding) As Boolean

參數

hash
ReadOnlySpan<Byte>

簽名資料的雜湊值。

signature
ReadOnlySpan<Byte>

簽名資料待驗證。

hashAlgorithm
HashAlgorithmName

用來產生雜湊值的雜湊演算法。

padding
RSASignaturePadding

填充模式。

傳回

true如果簽名有效;否則,。 false

適用於