I’m trying to encrypt some text using AES on .net and have it read on Java.
The sample code I got for the encryption looks like this:
byte[] key = ...
SecretKeySpec keySpec = new SecretKeySpec(key, "AES");
How does Java get the key and the IV from the SecretKey object? I need to provide them for .net and have found no information on it.
You may provide the IV to the cipher in Java using an instance of
IvParameterSpecpassed toCipher.init. If you don’t, a random IV will be generated and made available by thegetIVmethod ofCipher.