RSACng::VerifyHash Method (array<Byte>^, array<Byte>^, HashAlgorithmName, RSASignaturePadding^)

 

Verifies data that was signed and already hashed with the specified algorithm and padding mode.

Namespace:   System.Security.Cryptography
Assembly:  System.Core (in System.Core.dll)

public:
virtual bool VerifyHash(
	array<unsigned char>^ hash,
	array<unsigned char>^ signature,
	HashAlgorithmName hashAlgorithm,
	RSASignaturePadding^ padding
) override

Parameters

hash
Type: array<System::Byte>^

The hash to verify.

signature
Type: array<System::Byte>^

The signature of the data.

hashAlgorithm
Type: System.Security.Cryptography::HashAlgorithmName

The hash algorithm name.

padding
Type: System.Security.Cryptography::RSASignaturePadding^

The padding mode.

Return Value

Type: System::Boolean

true if the signature verifies for the hash; otherwise, false.

Exception Condition
ArgumentNullException

hash is null.

-or-

signature is null.

-or-

padding is null.

ArgumentException

The value of the HashAlgorithmName::Name property of hashAlgorithm is null or String::Empty.

CryptographicException

padding does not equal RSASignaturePadding::Pkcs1 or RSASignaturePadding::Pss.

-or-

The signature is badly formatted. (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.

.NET Framework
Available since 4.6
Return to top
Show: