hoy tengo un problema que creo que deben ser las referencias la cuestion es que me manda el siguiente error
yo tengo mi class AESCrypto.cs
y aqui esta la párte del codigo que marca error
namespace _TNS
{
class Program
{
static void Main(string[] args)
{
string originalString = "ejT+IvxeuvYw+sL++qrfuuqTZQp2sQKlfHVy26PoLb2+ZGThyUjj6imb/F2QCqsSJO6G0VriVAoDUPTzQhz4KYY5l/CUo0ssSuS6R95fFYs8PgXnqQubaOfv3tq0OZa1Ub51bAo0E3ivAJJA64P14UwiPhlAK/TgiqQe63VyVI/lyl1yJ4M7WTRajJBE9qIXLE8vuFfUk35yMpVa9Wtj3F8Od7skDSEhJYg/Gn15g5Msm6MfT0C2XTBpGNsOjJF1SwW/cGv1V2pBSu3q+J3vqGoD0j4z6xKUQkF923GXpvKfzzlCyTZheIWpMN2vmHOge0POo67qevB/XjCAv1z4ICkAgbIF/+6dVdVeHM43EyF6Q5E7YUoZ1LcHJBcXFazV8VXaI+VacECOWcYJBZKOu0ng++f6BRhvv2gRezLZ2wAt/p5B8ZXr8hC4+nemt0CW6M7m5trxSdP+dp1zVZ5PU0WF7uXSmbxgFS4JGAfyY9Cy0xDKOAxzcUuoDdg7hyfz31Z2sadfvTnANgciPvliwka/oPincgMZq/Bhp/XJ0kd70RX1H67nx6ZZj/5oBH8COyr4w9ZOriIXzOfHxCP+ge9jxKH8lw+LqIx/sgvdUW+lCBv1eVYj3v4uyqWkIVsDHr4vNse24g56mXC2Uz6GHF/1OLldn/EIS1uELP2u5brUbYyw/pVG4c8WdzQuKoMJkMq1SNrx5sFTur5DaNsJXsXHwuvhK/aVuyDE92qbXHmQPohDs8p+4o3lSp1RshnqRrGL1xs9BzhtksFVkcYU7g==";
string key = "5DCC67393750523CD165F17E1EFADD21";
string decryptedString = AESCrypto.decrypt(key, originalString);
Console.Write(decryptedString);
}
}
}
y asi es como se ve mi class AESCrypto.cs
METODO deSCRYPT agrego el codigo el cual permite ejecutar la desencriptacion del codigo para poder procesar sus demas argumentos
public string decrypt(string strKey, string strToDecrypt) { try { string original = strToDecrypt;
// Create a new instance of the Aes
// class. This generates a new key and initialization
// vector (IV).
using (Aes myAes = Aes.Create())
{
myAes.Mode = CipherMode.CBC;
myAes.KeySize = 128;
myAes.Padding = PaddingMode.PKCS7;
myAes.BlockSize = 128;
myAes.FeedbackSize = 128;
byte[] key = new byte[] { };
byte[] xmlByte = new byte[] { };
String result = "";
string str = strKey;
key = StringToByteArray(str);
var base64EncodedBytes = System.Convert.FromBase64String(strToDecrypt);
byte[] IVAES128 = new byte[16];
Array.Copy(base64EncodedBytes, 0, IVAES128, 0, 16);
myAes.IV = IVAES128;
base64EncodedBytes = System.Convert.FromBase64String(strToDecrypt);
xmlByte = new byte[base64EncodedBytes.Length - 16];
Array.Copy(base64EncodedBytes, 16, xmlByte, 0, base64EncodedBytes.Length - 16);
myAes.Key = key;
// Encrypt the string to an array of bytes.
result = DecryptStringFromBytes_Aes128(xmlByte, myAes.Key, myAes.IV);
return result;
}
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e.Message);
return "";
}
}