AES Encryption in Java: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 2: | Line 2: | ||
* [[Symmetric Cryptography#AES|Symmetric Cryptography]] | * [[Symmetric Cryptography#AES|Symmetric Cryptography]] | ||
* [[Java Cryptography Concepts]] | |||
=Overview= | =Overview= |
Latest revision as of 06:36, 24 November 2018
Internal
Overview
AES supports key sizes of 16, 24 and 32 bytes (128, 192 and 256 bits).
Always use a fully qualified Cipher name. AES is not appropriate in such a case, because different JVMs/JCE providers may use different defaults for mode of operation and padding. Use AES/CBC/PKCS5Padding. Don't use ECB mode, because it is not semantically secure.
If you don't use ECB mode then you need to send the IV along with the ciphertext. This is usually done by prefixing the IV to the ciphertext byte array. The IV is automatically created for you and you can get it through cipherInstance.getIV()