Partager via


RSACryptoServiceProvider.VerifyHash Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the provided hash value.

Namespace:  System.Security.Cryptography
Assembly:  mscorlib.Extensions (in mscorlib.Extensions.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function VerifyHash ( _
    rgbHash As Byte(), _
    str As String, _
    rgbSignature As Byte() _
) As Boolean
[SecuritySafeCriticalAttribute]
public bool VerifyHash(
    byte[] rgbHash,
    string str,
    byte[] rgbSignature
)

Parameters

  • rgbHash
    Type: array<System.Byte[]
    The hash value of the signed data.
  • str
    Type: System.String
    The hash algorithm identifier (OID) used to create the hash value of the data.
  • rgbSignature
    Type: array<System.Byte[]
    The signature data to be verified.

Return Value

Type: System.Boolean
true if the signature is valid; otherwise, false.

Exceptions

Exception Condition
ArgumentNullException

The rgbHash parameter is nulla null reference (Nothing in Visual Basic).

-or-

The rgbSignature parameter is nulla null reference (Nothing in Visual Basic).

CryptographicException

The cryptographic service provider (CSP) cannot be acquired.

-or-

The signature cannot be verified.

Remarks

This method verifies the RSA digital signature produced by the SignHash method. The signature is verified by obtaining the hash value from the signature using the public key it was signed with, and comparing that value to the hash value of the provided data.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.