I want to encrypt a password on disk using 'openssl enc -e -des-ede3-cbc' and decrypt it using the openssl libcrypto in a C program. I can encrypt and decrypt the password in the file sucessfully using the command line utility but when decrypting with the C program EVP_DecryptFinal fails with 0. The documentation indicates that this will happen if the last block is not correct. My questions are:
1) des-ede3-cbc requires an IV and key. How does the openssl command obtain the IV and key that is required to decrypt the file? 2) If this is a padding issue, how do I correct the padding? 3) The encrypted file begins with 'salt__'. Do I start with an offset in the encrypted file other than 0 in the C program? 4) Are the key and IV stored in the encrypted file? How does the C program extract it? Thanks, Ron Braswell