예제 #1
0
        public void DecryptV1NullTest()
        {
            var secretKey = new EncryptionSecret(0, Encoding.UTF8.GetBytes("password"));
            var cipher    = new AesGcmPbkdf10KHexCipher(Encoding.UTF8);
            var exception = Assert.Throws <StorageCryptoException>(() => cipher.Decrypt(null, secretKey));

            Assert.AreEqual("Encrypted text is incorrect", exception.Message);
        }
예제 #2
0
        public void AesGcm10KHexCipherTest()
        {
            var secretKey        = new EncryptionSecret(0, Encoding.UTF8.GetBytes("password"));
            var cipher           = new AesGcmPbkdf10KHexCipher(Encoding.UTF8);
            var decryptedMessage = cipher.Decrypt(CipherMessageV1, secretKey);

            Assert.AreEqual("InCountry", decryptedMessage);
            Assert.Throws <NotImplementedException>(() => cipher.Encrypt("text"));
        }