public void DecryptECB()
        {
            string expected = File.ReadAllText(@"TestFiles\AESDecrypted.txt");
            Base64 data     = new Base64(new FileInfo(@"TestFiles\AESEncrypted.txt"));

            AESCipherECB aes    = new AESCipherECB();
            string       result = aes.Decrypt("YELLOW SUBMARINE", data);

            Assert.AreEqual(expected, result);
        }
Exemplo n.º 2
0
        public void AddProfile(string email, string encoded)
        {
            string decoded = cipher.Decrypt(key, encoded);

            if (profiles.ContainsKey(email))
            {
                profiles[email] = new ValuePairParser(decoded);
            }
            else
            {
                profiles.Add(email, new ValuePairParser(decoded));
            }
        }
        public void EncryptAndDecryptECB()
        {
            Random r = new Random();

            byte[] bytes = new byte[r.Next(100)];
            r.NextBytes(bytes);

            string data = new Bytes(bytes).ToString();
            string key  = "YELLOW SUBMARINE";

            AESCipherECB aes       = new AESCipherECB();
            Base64       encrypted = aes.Encrypt(key, data);
            string       decrypted = aes.Decrypt(key, encrypted);

            Assert.AreEqual(data, decrypted);
        }