コード例 #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);
        }
コード例 #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);
        }