Encrypt in C# and decrypt in Java
843811Jul 25 2008 — edited Jul 30 2008Hi,
I'm trying to decrypt in Java a file which is encrypted thanks to Rijndael algorithm in C#.
The algorithm in Java runs without error but the file it produces isn't the initial file (before the encryption by the C# algorithm).
So I tried to do encryption and decryption in Java and it runs well. That's why I think this it is a parameters problem between the C# code and the Java code.
Parameters for C# are :
_iv = Encoding.GetEncoding("iso-8859-1").GetBytes(IV);
_key = Encoding.GetEncoding("iso-8859-1").GetBytes(KEY);
Rijndael rm = Rijndael.Create();
rm.KeySize = 128;
rm.FeedbackSize = 8;
rm.BlockSize = 128;
rm.Padding = PaddingMode.Zeros;
rm.Mode = CipherMode.CFB;
In java :
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(KEY.getBytes(), "AES");
IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
Is there any problem bewteen parameters in Java and parameters in C# ?
Thanks in advance !
ps : sorry for my english ;)