Testing RSA to encrypt an AES key, I realized that RSA has only 1 block with a limited size (settable by the programmer) do store the encrypted key. The question is, when I use:
KeyGenerator.getInstance("AES").generateKey()
the AES keys will have a constant size in every computer and jvm implementation?
There is an init method in the KeyGenerator that allows you to specify the number of bits.
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
keyGenerator.init(128);
SecretKey key = keyGenerator.generateKey();
Will that do what you need?
The default appears to be 128 bits, but I would not assume that all JVM's use the same default, or that it will always be the default.
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