コード例 #1
0
        public void decrypt_should_ignore_value_that_doesnt_start_with_identifier()
        {
            // given
            string value     = "jcydwHTHkdPHlUZudXKhcw==";
            var    encryptor = new VariableEncryptor(new AesEncryption("my password"));

            // when
            string actualValue = encryptor.Decrypt(value);

            // then
            Assert.That(actualValue, Is.EqualTo(value));
        }
コード例 #2
0
        public void should_decrypt_value_when_value_starts_with_encryption_identifier()
        {
            // given
            string expectedValue = "shut the door";
            string plainText     = "enc:jcydwHTHkdPHlUZudXKhcw==";

            var encryptor = new VariableEncryptor(new AesEncryption("my password"));

            // when
            string actualValue = encryptor.Decrypt(plainText);

            // then
            Assert.That(actualValue, Is.EqualTo(expectedValue));
        }
コード例 #3
0
        public void should_encrypt_value_and_add_prefix()
        {
            // given
            string plainText     = "shut the door";
            string expectedValue = "enc:jcydwHTHkdPHlUZudXKhcw==";

            var encryptor = new VariableEncryptor(new AesEncryption("my password"));

            // when
            string actualValue = encryptor.Encrypt(plainText);

            // then
            Assert.That(actualValue, Is.EqualTo(expectedValue));
        }