Ejemplo n.º 1
0
        public void CanDecryptSymmetricTripleDes()
        {
            string  encrypted = "OTrZQMzbEM2QTfH7vJyaDg==";
            ICrypto crypto    = new CryptoSym("commonlib.net", new TripleDESCryptoServiceProvider());
            string  decrypted = crypto.Decrypt(encrypted);

            Assert.AreEqual("horizonguy", decrypted);
        }
Ejemplo n.º 2
0
        public void CanEncryptWithSpecialCharsTripleDes()
        {
            string  plainText = "~`!@#$%^&*()_+{}|:\"<>?[]\\,./;'-=";
            ICrypto crypto    = new CryptoSym("commonlib.net", new TripleDESCryptoServiceProvider());
            string  encrypted = crypto.Encrypt(plainText);

            Assert.AreNotEqual(plainText, encrypted);

            // Now decrypt.
            string decrypted = crypto.Decrypt(encrypted);

            Assert.AreEqual("~`!@#$%^&*()_+{}|:\"<>?[]\\,./;'-=", decrypted);
        }