// (c) 2006 Richard Grimes // www.grimes.demon.co.uk using System; using System.Security.Cryptography; using System.Text; class App { static void Main() { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); string clearText = "the quick brown fox..."; byte[] data = Encoding.ASCII.GetBytes(clearText); SHA1 sha1 = SHA1.Create(); byte[] hash = sha1.ComputeHash(data); byte[] sign = rsa.SignHash(hash, CryptoConfig.MapNameToOID("SHA1")); Console.WriteLine(BitConverter.ToString(sign)); bool bVerify = rsa.VerifyHash(hash, CryptoConfig.MapNameToOID("SHA1"), sign); Console.WriteLine("signature is verified: {0}", bVerify); } }