-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
22 lines (21 loc) · 870 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RSATest
{
class Program
{
static void Main(string[] args)
{
string str = "{\"sc\":\"his51\",\"no\":\"1\",\"na\":\"管理员\"}{\"sc\":\"@his51\",\"no\":\"1\",\"na\":\"管理员\"}{\"sc\":\"his51\",\"no\":\"1\",\"na\":\"管员\"}{\"sc\":\"his522";
RSAHelper.RSAKey keyPair = RSAHelper.GetRASKey();
Console.WriteLine("公钥:" + keyPair.PublicKey + "\r\n");
Console.WriteLine("私钥:" + keyPair.PrivateKey + "\r\n");
string en = RSAHelper.EncryptString(str, keyPair.PrivateKey);
Console.WriteLine("加密后:"+en + "\r\n");
Console.WriteLine("解密:"+RSAHelper.DecryptString(en, keyPair.PublicKey) + "\r\n");
Console.ReadKey();
}
}
}