public async Task Send(string message) { var decrypted = EncryptorRSA.DecryptText(message, KeyPairs[Context.ConnectionId].PrivateKey); var parts = decrypted.Split("_|_"); await Clients.All.SendAsync("Receive", parts.First(), parts.Last()); }
public static void AutoTest(string file) { StreamReader reader = new StreamReader(file); var content = reader.ReadToEnd(); var origin = EncryptorRSA.DecryptText(content, GenratedKeys.PrivateKey); Console.WriteLine(origin); }
static void Main(string[] args) { EncryptorRSAKeys key = EncryptorRSA.GenerateKeys(2048); string input = ""; input = Console.ReadLine(); string str = EncryptorRSA.EncryptText(input, key.PublicKey); Console.WriteLine("encrypt: " + str); Console.WriteLine("decrypt: " + EncryptorRSA.DecryptText(str, key.PrivateKey)); Console.WriteLine(EncryptorRSA.GetMaxDataLength(16384)); Console.ReadKey(); }