Ejemplo n.º 1
0
        public void EncryptAndDecryptAGeneratedPassword()
        {
            string randomPassword = new Password(1024).PlainText;
            string randomKey      = new Password(1024).PlainText;

            byte[] encrypted = SimpleXorEncrypter.Encrypt(randomPassword, randomKey);
            string plainText = SimpleXorEncrypter.Decrypt(encrypted, randomKey);

            Assert.AreEqual(randomPassword, plainText);
        }
Ejemplo n.º 2
0
        public void DecryptWithoutKey()
        {
            string result = SimpleXorEncrypter.Decrypt(this.encryptedMessage, string.Empty);

            Assert.IsNull(result);
        }
Ejemplo n.º 3
0
        public void DecryptToPlainText()
        {
            string result = SimpleXorEncrypter.Decrypt(this.encryptedMessage, SimpleXorEncrypterTest.Key);

            Assert.AreEqual(result, this.plainTextMessage);
        }