'AES Algorithm Encrypte decrypte
return System.Text.ASCIIEncoding.ASCII.GetString(ence); - the name 'ence' does not exist in the current context. I am trying to decrypt text from a file that I am already encrypt.
public static string Decrypte(string encrypted)
{
var Check = Form1.verify;
string password = Form1.password;
if (Check == password)
{
byte[] textBytes = Convert.FromBase64String(encrypted);
AesCryptoServiceProvider endec = new AesCryptoServiceProvider();
endec.BlockSize = 128;
endec.KeySize = 256;
endec.IV = ASCIIEncoding.ASCII.GetBytes(IV);
endec.Key = ASCIIEncoding.ASCII.GetBytes(Key);
endec.Mode = CipherMode.CBC;
ICryptoTransform icrypt = endec.CreateDecryptor(endec.Key, endec.IV);
byte[] ence = icrypt.TransformFinalBlock(textBytes, 0, textBytes.Length);
icrypt.Dispose();
return Convert.ToString(ence);
}
if (Form1.verify == password)
{
return System.Text.ASCIIEncoding.ASCII.GetString(ence);
}
else if (Form1.verify != password)
{
MessageBox.Show("Use originas key file");
}
return encrypted;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
