Trying to encrypt sample data using AES128 algorithm with CBC and PKCS7 padding in Android and iOS, but results are different :(
Android code:
private s
The Android code uses explicitly CBC mode. But the iOS code does not specify this. At least I don't see it there.
Also when you use CBC mode, you must also specify Initialization Vector:
byte[] iv = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; // use different random value
AlgorithmParameterSpec algorithmSpec = new IvParameterSpec(iv);
Cipher ecipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
ecipher.init(Cipher.ENCRYPT_MODE, skeySpec, algorithmSpec);
You should use the same initialization vector on iOS and also specify you are using CBC mode.