예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
파일: Program.cs 프로젝트: khanhlive/NDK
        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();
        }