Recently I have encountered the padding issue with AES 128 encryption.
Mobile app is connecting to the gateway (which is in C++) and communicating with each other.We have planned to encrypt the data. in C++ they have standard way of doing encryption and Android also have Cipher class to do encryption.
the problem here is ,
Gateway code, giving "00" as padding bytes.
In android, we have different variant that provides various padding bytes
Mobile app is connecting to the gateway (which is in C++) and communicating with each other.We have planned to encrypt the data. in C++ they have standard way of doing encryption and Android also have Cipher class to do encryption.
the problem here is ,
Gateway code, giving "00" as padding bytes.
In android, we have different variant that provides various padding bytes
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC");
This will give padding bytes as 0F
Cipher cipher = Cipher.getInstance("AES/ECB/ZeroBytePadding", "BC");
This will give padding bytes as 00
based on the padding bytes, you can choose the variant.
No comments:
Post a Comment