I didn't down vote, but there isn't a lot to go on in your question (e.g. source) which may explain it. However I've just got this working with this code to do the encryption:
public string SagePayEncryptAndEncode(string inputText, string key)
{
using (var AES = new RijndaelManaged())
{
// Set the mode, padding and block size for the key
AES.Padding = PaddingMode.PKCS7;
AES.Mode = CipherMode.CBC;
AES.KeySize = 128;
AES.BlockSize = 128;
// Convert key and input text into byte arrays
Byte[] keyAndIvBytes = UTF8Encoding.UTF8.GetBytes(key);
Byte[] inputBytes = UTF8Encoding.UTF8.GetBytes(inputText);
// Create streams and encryptor object
using (var memoryStream = new MemoryStream())
using (var cryptoStream = new CryptoStream(memoryStream, AES.CreateEncryptor(keyAndIvBytes, keyAndIvBytes), CryptoStreamMode.Write))
{
// Perform encryption
cryptoStream.Write(inputBytes, 0, inputBytes.Length);
cryptoStream.FlushFinalBlock();
// Get encrypted stream into byte array
var outBytes = memoryStream.ToArray();
// Manually close streams
memoryStream.Close();
cryptoStream.Close();
AES.Clear();
//return Convert.ToBase64String(outBytes);
return BitConverter.ToString(outBytes).Replace("-", String.Empty);
}
}
}
You then need to store the resulting value in the hidden 'Crypt' field and prepend '@'.
<input name='Crypt' type='hidden' value='@<InsertResultHere>' />
One thing to note, it appears to only work using Hex encoding, and not Base64 encoding as the documentation implies.
Hope this helps!