Ejemplo n.º 1
0
        public void RSAFunctions_ShouldEncryptAndDecryptBackToSame()
        {
            var sourceData          = "Hello crazy world";
            var sourceDataBinary    = Encoding.UTF8.GetBytes(sourceData);
            var encryptedData       = _crypto.EncryptRSA(sourceDataBinary, _publicKey);
            var decryptedData       = _crypto.DecryptRSA(encryptedData, _privateKey);
            var decryptedDataString = Encoding.UTF8.GetString(decryptedData);

            Assert.AreEqual(sourceData, decryptedDataString);
        }