I have read a link, and I can encode/decode data by C API correctly.
However, I have a file that is generated by openssl command line:
openssl aes-256-cbc -in plain.txt -out encrypted.txt
> enter password from stdin
Want to decode the output by using C API. The code is below:
unsigned char key[] = "password";
unsigned char iv[] = ""; // I don't know what is the default iv.
EVP_CipherInit(&ctx, EVP_aes_256_cbc(), key, iv, 0);
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.
Any advice is welcome. Thank you in advance.