RSA.VerifyHash 方法

定義

多載

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

使用指定的雜湊演算法和填補,並和提供的雜湊值比較,來為簽章判斷雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by determining the hash value in the signature using the specified hash algorithm and padding, and comparing it to the provided hash value.

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

使用指定的雜湊演算法和填補,並和提供的雜湊值比較,來為簽章判斷雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by determining the hash value in the signature using the specified hash algorithm and padding, and comparing it to the provided hash value.

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

使用指定的雜湊演算法和填補,並和提供的雜湊值比較,來為簽章判斷雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by determining the hash value in the signature using the specified hash algorithm and padding, and comparing it to the provided hash value.

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

參數

hash
Byte[]

已簽署資料的雜湊值。The hash value of the signed data.

signature
Byte[]

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該雜湊值的雜湊演算法。The hash algorithm used to create the hash value.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

衍生的類別必須覆寫這個方法。A derived class must override this method.

hashpaddingnullhash or padding is null.

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

適用於

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

使用指定的雜湊演算法和填補,並和提供的雜湊值比較,來為簽章判斷雜湊值,藉此驗證數位簽章是否有效。Verifies that a digital signature is valid by determining the hash value in the signature using the specified hash algorithm and padding, and comparing it to the provided hash value.

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

參數

hash
ReadOnlySpan<Byte>

已簽署資料的雜湊值。The hash value of the signed data.

signature
ReadOnlySpan<Byte>

要驗證的簽章資料。The signature data to be verified.

hashAlgorithm
HashAlgorithmName

用來建立該雜湊值的雜湊演算法。The hash algorithm used to create the hash value.

padding
RSASignaturePadding

填補模式。The padding mode.

傳回

Boolean

如果簽章有效則為 true,否則為 falsetrue if the signature is valid; otherwise, false.

例外狀況

hashpaddingnullhash or padding is null.

hashAlgorithm.NamehashAlgorithm.Name nullEmptyis null or Empty.

padding 未知,或不支援此實作。padding is unknown, or not supported by this implementation.

備註

這個方法的預設執行是將和複製 hash signature 到新的陣列,然後呼叫 VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)The default implementation of this method is to copy hash and signature to new arrays and call VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding). 衍生類型應覆寫這個方法,以避免建立中繼陣列。Derived types should override this method to avoid the intermediate array creation.

適用於