コード例 #1
0
        public void IsEncryptSymmetricTripleDesDifferentByInput()
        {
            ICrypto crypto     = new CryptoSym("commonlib.net", new TripleDESCryptoServiceProvider());
            string  encrypted  = crypto.Encrypt("horizonguy");
            string  encrypted2 = crypto.Encrypt("bourneIdentity");

            Assert.AreNotEqual("horizonguy", encrypted);
            Assert.AreNotEqual(encrypted, encrypted2);
        }
コード例 #2
0
        public void CanEncryptSymmetricTripleDes()
        {
            ICrypto crypto    = new CryptoSym("commonlib.net", new TripleDESCryptoServiceProvider());
            string  encrypted = crypto.Encrypt("horizonguy");

            Assert.AreNotEqual("horizonguy", encrypted);
        }
コード例 #3
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);
        }