i am trying to decrypt one string in c# encrypted in Delphi with Cipher1 3.0, Part I from Delphi Encryption Compendium. I use TCipher_Rijndael.
string that i encrypt is : this-is-a-test-example
password: pass
encrypted values is : iKBC8kX4ZEk4A1pCj6jwEegqjpxhqw==
When i try to decrypt this in c# i recive error: Length of the data to decrypt is invalid.
Did anyone have the same problem, and what is a solution?
Here is a decrypt method in c#:
public static byte[] Decrypt(byte[] cipherData,
byte[] Key, byte[] IV)
{
MemoryStream ms = new MemoryStream();
Rijndael alg = Rijndael.Create();
alg.Key = Key;
alg.IV = IV;
CryptoStream cs = new CryptoStream(ms,
alg.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(cipherData, 0, cipherData.Length);
cs.Close();
byte[] decryptedData = ms.ToArray();
return decryptedData;
}
and here is encrypt code in Delphi:
with TCipher_Rijndael.Create('pass', nil) do
begin
memo2.lines.add ( CodeString( 'this-is-a-test-example' , paEncode, fmtDEFAULT));
Free;
end;
Thanks.