Does anyone know what the default Java crypto behavior is for:
SecretKeySpec localSecretKeySpec = new SecretKeySpec(arrayOfByte, "AES"); Cipher localCipher = Cipher.getInstance("AES");
Specifically I am looking to understand how those classes generate the IV, as well as what is the default encryption mode when just specifying "AES". Thanks.
For Oracle JDK 7 (tested), the default cipher for AES is AES/ECB/PKCS5Padding.
The Java Cryptography Architecture (JCA) is a set of APIs to implement concepts of modern cryptography such as digital signatures, message digests, and certificates.
The transformation AES/ECB/PKCS5Padding tells the getInstance method to instantiate the Cipher object as an AES cipher with ECB mode of operation and PKCS5 padding scheme. We can also instantiate the Cipher object by specifying only the algorithm in the transformation: Cipher cipher = Cipher. getInstance("AES");
For Oracle JDK 7 (tested), the default cipher for AES is AES/ECB/PKCS5Padding. The Java Security documentation doesn't mention about this though (http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#algspec), have to do some JUnit testing to find out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With