Verify a signature value over data in a byte array.
public static int VerifyData( string sigStr, byte[] data, string certOrKeyFile, SigAlgorithm sigAlg, Sig.VerifyOpts opts = Sig.VerifyOpts.Default )
Public Shared Function VerifyData ( sigStr As String, data As Byte(), certOrKeyFile As String, sigAlg As SigAlgorithm, Optional opts As Sig.VerifyOpts = Sig.VerifyOpts.Default ) As Integer
string certFile = "AliceRSASignByCarl.cer"; // Used to verify signature // Signed data: a byte array with ASCII string "abc" byte[] b = System.Text.Encoding.Default.GetBytes("abc"); string sig = // Alice/'abc'/SHA-1 "YK1aePtKQDDsVCyJdM0V9VOE6DZVTO3ZoyLV9BNcYmep0glwxU5mUQcLAUTUOETImTIN2Pp4Gffr" + "xqdxUoczLshnXBNhg7P4ofge+WlBgmcTCnVv27LHHZpmdEbjTg6tnPMb+2b4FvMZ0LfkMKXyiRVTmG4A" + "NyAmHH6QIsDZ8R8="; int n = Sig.VerifyData(sig, b, certFile, SigAlgorithm.Default); Console.WriteLine("Sig.VerifyData returns " + n + " (expecting 0)"); Debug.Assert(0 == n, "Sig.VerifyData failed");
VB6/C equivalent: SIG_VerifyData