In our application third party tool is used to encrypt the file and we have to decrypt the file. we are responsible to supply keys and IVs. But we are unable to decrypt it back and getting below errors.
If I use openssl its working fine and I am able to decrypt the file successfully
All details are attached here, please help what I am missing.
public string Decrypt(string cipherText, string key, string IV)
{
var rm = new RijndaelManaged();
rm.BlockSize = 256;
rm.KeySize = 256;
rm.Mode = CipherMode.ECB;
rm.Padding = PaddingMode.None;
var encryptedValue = Encoding.ASCII.GetBytes(cipherText);
var byteKey = ConvertStringToByte(key);
var byteIV = ConvertStringToByte(IV);
var DecryptorTransform = rm.CreateDecryptor(byteKey, byteIV); <-- **error is here**
Sample Keys
Key (64 chars) : d3dda598fc93a90d3de733fd3de733fdc1bb863de733fdc1bb86fbdc1bb86fb IV (32 chars) : d3dda598fc93a90d3de733fdc1bb86fb
Error Details
"message": "Specified key is not a valid size for this algorithm.", "details": "CryptographicException: Specified key is not a valid size for this algorithm.\r\nSTACK TRACE: at
System.Security.Cryptography.RijndaelManagedTransform.GenerateKeyExpansion(Byte[] rgbKey)\r\n at System.Security.Cryptography.RijndaelManagedTransform..ctor(Byte[] rgbKey, CipherMode mode, Byte[] rgbIV, Int32 blockSize, Int32 feedbackSize, PaddingMode PaddingValue, RijndaelManagedTransformMode transformMode)\r\n at System.Security.Cryptography.RijndaelManaged.NewEncryptor(Byte[] rgbKey, CipherMode mode, Byte[] rgbIV, Int32 feedbackSize, RijndaelManagedTransformMode encryptMode)\r\n at System.Security.Cryptography.RijndaelManaged.CreateDecryptor(Byte[] rgbKey, Byte[] rgbIV)\r\n at Helix.Bdc.Services.AccessMaangement.SecretManager.Decrypt(String cipherText, String key, String IV)