Exemple #1
0
        public byte[] Decrypt(EncryptionResult encrypted)
        {
            var key         = _keyring.GetOrThrow(encrypted.Kid);
            var cipherBytes = Convert.FromBase64String(encrypted.Ciphertext);
            var plainBytes  = _cipher.Decrypt(key.Bytes, cipherBytes, encrypted.Iv);

            return(plainBytes);
        }
        public void DecryptTest()
        {
            //Arrange
            string plain  = "hidethegoldinthetrexestump";
            string cypher = "bmodzbxdnabekudmuixmmouvif";

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
Exemple #3
0
        public void DecryptTest()
        {
            //Arrange
            string plain  = "paymoremoney";
            string cypher = "lnshdlewmtrw";

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
Exemple #4
0
        public void DecryptTest()
        {
            //Arrange
            string plain  = "meetmeafterthegraduationparty*";
            string cypher = "mematrhgautopryetefeterdainat*";

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
Exemple #5
0
        public void DecryptTest()
        {
            //Arrange
            string plain  = "attackpostponeduntiltwoam";
            string cypher = "ttna aptm tsuo aodw coi* knl* pet* ";

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
Exemple #6
0
        public void DecryptTest()
        {
            //Arrange
            string plain  = "meetmeafterthetogaparty";
            string cypher = "phhwphdiwhuwkhwrjdsduwb";

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
 private void btnDecrypt_Click(object sender, EventArgs e)
 {
     //InputText = txtEncryptInputContent.Text;
     Key = txtKey.Text;
     if (string.IsNullOrEmpty(InputText) || string.IsNullOrEmpty(Key))
     {
         MessageBox.Show("Şifrelemek için metin ve anahtar girmek zorunludur.");
         return;
     }
     algorithm = new VigenereCipher(InputText, Key);
     txtDecryptOutContent.Text = algorithm.Encrypt();
     txtDecryptOutContent.Text = algorithm.Decrypt();
 }
Exemple #8
0
        public object ParseString(string value)
        {
            string plainTextValue;

            try
            {
                plainTextValue = _encryptionAlgorithm.Decrypt(value);
            }
            catch
            {
                plainTextValue = value;
            }

            return(_decoratedValueConverter.ParseString(plainTextValue));
        }
Exemple #9
0
        public void EncryptTest()
        {
            //Arrange
            string plain = "abcd";

            //Act
            string cypher = _target.Encrypt(plain);

            //Assert
            Assert.NotEqual(cypher, plain);

            //Act
            string actual = _target.Decrypt(cypher);

            //Assert
            Assert.Equal(plain, actual);
        }
Exemple #10
0
 public string Decrypt(string input)
 {
     return(encryptor.Decrypt(input));
 }