public void printKey() { var rsa = RSATools.GetRSAKey(); Console.WriteLine(rsa.Item1); Console.WriteLine(rsa.Item2); }
public void encrypt() { //加密字符串 string data = "zzl"; Console.WriteLine("加密前字符串内容:" + data); //加密 string encrypteddata = RSATools.EncryptData(ASCIIEncoding.UTF8.GetBytes(data), publickey); Console.WriteLine("加密后的字符串为:" + encrypteddata); Console.WriteLine(privatekey1 == privatekey);//左面第一个是空格 Console.WriteLine("解密后的字符串内容:" + RSATools.DecryptData(encrypteddata, privatekey)); }
public void verify() { var result = RSATools.Verify(content, RSATools.Sign(content, privatekey, "utf-8"), publickey, "utf-8"); Console.WriteLine("verify=" + result); }
public void sign() { Console.WriteLine("sign=" + RSATools.Sign(content, privatekey)); }