title: nodejs AES-128-GCM "invalid initialization vector length"
body: <p>I looked on Wikipedia and it says "Both GCM and GMAC can accept initialization vectors of arbitrary length."</p>
  
  <p>However, when I try to</p>
  
  <pre><code>crypto.createCipheriv(
    'aes-128-gcm',
    KEY,
    new Buffer(crypto.randomBytes(16))
  )
  </code></pre>
  
  <p>I get "Uncaught TypeError: invalid iv length 16" - I add a few breakpoints and find that the nodejs crypto iv length is set at 12? Is there a reason for the difference?</p>