测试签名和验证签名
static void Main(string[] args) { System.Security.Cryptography.CspParameters para = new System.Security.Cryptography.CspParameters(); para.KeyContainerName = "g"; para.KeyNumber = 2; System.Security.Cryptography.RSACryptoServiceProvider rs = new System.Security.Cryptography.RSACryptoServiceProvider(para); string data = "123456"; byte[] old = Encoding.UTF8.GetBytes(data); byte[] singData = rs.SignData(old, new System.Security.Cryptography.SHA1CryptoServiceProvider()); bool res = rs.VerifyData(Encoding.UTF8.GetBytes("123456"), new System.Security.Cryptography.SHA1CryptoServiceProvider(), singData); string sss = rs.ToXmlString(true); }