title: node crypto decipher final fail
body: <p>So I am using <a href="http://nodejs.org/api/crypto.html#crypto_crypto_createdecipheriv_algorithm_key_iv" rel="nofollow noreferrer">node crypto library</a> to decipher a binary file that is encrypted by some other software which I have no control over. Using the following code, I am able to decrypt it successfully:</p>
  
  <pre><code>decipher = crypto.createDecipheriv('aes-128-ecb', password, iv);
  decrypted = decipher.update(body, 'binary', 'utf8');
  </code></pre>
  
  <p>This is great, however it appears there are about 11 characters truncated from the end of my decrypted text. Which is weird because it's over 11200 characters of plaintext. Now I suspect the reason is because I don't have this line:</p>
  
  <pre><code>decrypted += decipher.final('utf8');
  </code></pre>
  
  <p>However, if I add that line, I get the error <code>TypeError: DecipherFinal fail</code></p>
  
  <p>I have tried different output encodings and without the IV, but with no luck. I have also read this question: <a href="https://stackoverflow.com/questions/12219499/whats-wrong-with-nodejs-crypto-decipher">What&#39;s wrong with nodejs crypto decipher?</a> which seems like the same issue, however I don't understand the steps I am supposed to take on the openssl command line, or how that would affect my node program.</p>