I\'m helping someone that needs to send an encrypted value with AES to a customer. The customer has not specified the block cipher mode, padding or how to generate the key. They
There's no constructor for or method in any of the Aes classes in .net that takes in a string as a key. Keys are specified as an array of bytes, such that the length of the array is equal to the key size / 8.
One would hope that they would use a common hash algorithm to generate the key from the 19 character string. Best bet would probably be a Sha256 hash of the string.
Just to give you an idea of what that would look like in .net ...
public void InitializeCrypto()
{
var utf8 = new UTF8Encoding();
var hash = new SHA256CryptoServiceProvider();
var aes = new AesCryptoServiceProvider();
var iv = new byte[16];
Array.Clear(iv, 0, iv.Length);
string key = "Some19CharacterString";
var utf8Bytes = utf8.GetBytes(key);
aes.IV = iv;
aes.KeySize = 256;
aes.Key = hash.ComputeHash(utf8Bytes);
//Do crypto work
}