I get java.security.InvalidKeyException: Invalid AES key length: 128 bytes on my line
CIPHER.init(Cipher.ENCRYPT_MODE, keySpec);
with CIPHER
Cipher CIPHER = Cipher.getInstance("AES");
and keySpec
SecretKeySpec keySpec = new SecretKeySpec(key, "AES");
this key is 128 byte[] , I went through the Diffie-Hellman key exchange (although it doesn't matter where I got it, right?), the key completely filled with non-zero bytes
Why Cipher.init(...) complain that the key is the wrong length? This web page clearly indicates that a key of length 128 is supported.
What am I missing?
java encryption aes
vrwim
source share