public void GetAndEncryptInput() { // Get input string input = Console.ReadLine().ToUpper(); // "Encrypt" it string output = encryptionAlgorithm.Encrypt(input); // Write output Console.WriteLine(output); }
public EncryptionResult Encrypt(byte[] plaintext) { var encrypted = _cipher.Encrypt(_key.Bytes, plaintext, AssociatedData); return(new EncryptionResult { Alg = _cipher.Algorithm, Ciphertext = Convert.ToBase64String(encrypted), Kid = _key.Id }); }
public string GetString(object value, ISerializeOptions options) { var returnValue = _decoratedValueConverter.GetString(value, options); if (options.ShouldEncrypt) { returnValue = _encryptionAlgorithm.Encrypt(returnValue); } return(returnValue); }
public void EncryptTest() { //Arrange string plain = "hidethegoldinthetreestump"; string cypher = "bmodzbxdnabekudmuixmmouvif"; //Act string actual = _target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
public void EncryptTest() { //Arrange string plain = "paymoremoney"; string cypher = "lnshdlewmtrw"; //Act string actual = _target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
private void btnEncrypt_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); txtEncryptOutContent.Text = algorithm.Encrypt(); }
public void EncryptTest() { //Arrange string plain = "meetmeafterthegraduationparty"; string cypher = "mematrhgautopryetefeterdainat*"; //Act string actual = _target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
public void EncryptTest() { //Arrange string plain = "attackpostponeduntiltwoam"; string cypher = "ttna aptm tsuo aodw coi* knl* pet* "; //Act string actual = _target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
public void EncryptTest() { //Arrange string plain = "meetmeafterthetogaparty"; string cypher = "phhwphdiwhuwkhwrjdsduwb"; //Act string actual = _target.Encrypt(plain); //Assert Assert.Equal(cypher, actual); }
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); }
public string Encrypt(string input) { return(encryptor.Encrypt(input)); }