RSACng.VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding) 方法

定義

驗證已簽署且已使用指定演算法和填補模式雜湊處理的資料。Verifies data that was signed and already hashed with the specified algorithm and padding mode.

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[]

要驗證的雜湊。The hash to verify.

signature
Byte[]

資料的簽章。The signature of the data.

hashAlgorithm
HashAlgorithmName

雜湊演算法名稱。The hash algorithm name.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果雜湊的簽章驗證無誤,則為 true;否則為 falsetrue if the signature verifies for the hash; otherwise, false.

例外狀況

hashnullhash is null.

-或--or- signaturenullsignature is null.

-或--or- paddingnullpadding is null.

hashAlgorithmName 屬性值為 nullEmptyThe value of the Name property of hashAlgorithm is null or Empty.

padding 不等於 Pkcs1Psspadding does not equal Pkcs1 or Pss.

-或--or- 簽章的格式不正確。The signature is badly formatted. 僅限 .NET Framework 4.6 和4.6.1 中的 (;從 .NET Framework 4.6.2 開始,如果簽章的 false 格式不正確,此方法會傳回。(In the .NET Framework 4.6 and 4.6.1 only; starting with the .NET Framework 4.6.2, the method returns false if a signature is badly formatted.

適用於