According to documentation for app developers AES_128 and AES_256 are supported from api 26. https://developer.android.com/reference/javax/crypto/Cipher. For example now I'm using AES(GCM mode) with 128 bit key. What is the difference between AES with 128 bit key and AES_128 ?
There is no difference between AES
with a 128-bit
key and AES_128
.
As you can see in the docs you linked, previous to API 26
there existed one primitive for AES, with various padding options/modes of operation.
To make things simpler, in API 26+
there is now two primitives to disambiguate the usage of AES
with either a definitive 128-bit
or 256-bit
key.
If you are using AES
, you should opt for AES-256 GCM
as it provides a authenticated encryption, ensuring that the ciphertext cannot be tampered with, without the recipients knowledge.
AES-GCM
operates with a 32-bit counter, so unfortunately with the same key, nonce (IV
) pair you can only safely encrypt ~ 64GB
of data (2^39-256 bits
).
If you want to move to an even safer cipher, I recommend XSalsa20
or XChaCha20
, which provide a 192-bit
nonce size, effectively allowing a practically "unlimited" amount of data to be encrypted with the same key, nonce pair.