This question might've already asked several times, but I honestly have yet to discover an answer that solved my problem.
Scenario: I have an encrypted file from server, probably using Java. The goal is to decrypt this file in iPhone (Objective-C).
I tried to decrypt using FBEncryptorAES to no avail.
Here's my decryption in Objective-C:
NSData *returnData = [FBEncryptorAES decryptData:stream key:key iv:nil];
The stream
is encrypted NSData obtained from server, the key
is the AES.
I have also written the equivalent Java code, and I could decrypt the data correctly using it and therefore verify that the key
I'm using is identical byte-per-byte. Here's the said Java code:
SecretKeySpec key = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, key);
cipherIn = new CipherInputStream(new FileInputStream(<decrypted-file>, cipher);
Any suggestion?
Thanks.