title: How to use C API to decode the aes-256-cbc file generated by openssl command line?
body: <p>I have read <a href="https://stackoverflow.com/questions/24856303/openssl-aes-256-cbc-via-evp-api-in-c">a link</a>, and I can encode/decode data by C API correctly.</p>
  
  <p>However, I have a file that is generated by openssl command line:</p>
  
  <pre><code>openssl aes-256-cbc -in plain.txt -out encrypted.txt
  &gt; enter password from stdin
  </code></pre>
  
  <p>Want to decode the output by using C API. The code is below:</p>
  
  <pre><code>unsigned char key[] = "password";
  unsigned char iv[] = "";  // I don't know what is the default iv.
  EVP_CipherInit(&amp;ctx, EVP_aes_256_cbc(), key, iv, 0);
  </code></pre>
  
  <p>The output is wrong. Is there anyone know how to fix it? Maybe I called the wrong function? eg: EVP_PBE_CipherInit? I'm totally lost in the document and source code of openssl.</p>
  
  <p>Any advice is welcome. Thank you in advance.</p>