In this function:
- datatoverify - is data before signed ?
- signeddata - is data after signed
- key - is the public or private key
Function VerifySignedHash(ByVal DataToVerify() As Byte, ByVal SignedData() As Byte, ByVal Key As RSAParameters) As Boolean
Try
' Create a new instance of RSACryptoServiceProvider using the
' key from RSAParameters.
Dim RSAalg As New RSACryptoServiceProvider
RSAalg.ImportParameters(Key)
' Verify the data using the signature. Pass a new instance of SHA1CryptoServiceProvider
' to specify the use of SHA1 for hashing.
Return RSAalg.VerifyData(DataToVerify, New SHA1CryptoServiceProvider, SignedData)
Catch e As CryptographicException
Console.WriteLine(e.Message)
Return False
End Try
End Function
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.signdata(VS.71).aspx