I need to encrypt the data on iOS and Android and decrypt the data in Node using Crypto.
I'm trying to encrypt the data in Android and iOS and decrypt the same in NodeJs. The algorithm's, Key Length, Padding are not compatable on Android and iOS.
I'm using the following method in NodeJS to decrypt:
const algorithm = 'aes-128-ecb';
const appSecret = '1234567890123456';
decrypt(text) {
var decipher = crypto.createDecipher(algorithm, appSecret);
var dec = decipher.update(text, 'hex', 'utf8');
dec += decipher.final('utf8');
return dec;
}
Android is using the same algorithm and appSecret and pkcs5 padding and are using MD5 to hash the key. I'm able to decrypt successfully when android encrypts the data. But I'm unable to decrypt the data coming from iOS after encryption even though they use the same algorithm and appSecret.