title: Invalid AES key length: 128 bytes?
body: <p>I am getting <code>java.security.InvalidKeyException: Invalid AES key length: 128 bytes</code> on my line </p>
  
  <pre><code>CIPHER.init(Cipher.ENCRYPT_MODE, keySpec);
  </code></pre>
  
  <p>with CIPHER being</p>
  
  <pre><code>Cipher CIPHER = Cipher.getInstance("AES");
  </code></pre>
  
  <p>and keySpec</p>
  
  <pre><code>SecretKeySpec keySpec = new SecretKeySpec(key, "AES");
  </code></pre>
  
  <p>that key is a <code>byte[]</code> of length 128 I got through a Diffie-Hellman key exchange (though it shouldn't matter where I got it, right?), <code>key</code> is completely filled with nonzero bytes</p>
  
  <p>Why is <code>Cipher.init(...)</code> complaining that the key is a wrong length? <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#Cipher">This webpage</a> clearly states that a key of length 128 is supported.</p>
  
  <p>What am I overlooking?</p>