0

File is encrypted on linux machine using:

openssl aes-256-cbc -a -salt -in infile -out outfile -kfile passwordfile

Where the password file was just a 32 byte character string.

Now I need to decrypt in c++ app. I assume this is possible, but not sure exactly what calls to make - should something like this work?

AES_cbc_encrypt(data, outData, data_size, &dec_key, ivec, AES_DECRYPT);

But this takes a key, not a password file - how does one create key from password file or am I totally in left field here?

jww
  • 97,681
  • 90
  • 411
  • 885
Bad Roy
  • 1
  • 1
  • Why not look at the source code for openssl and see? – zindorsky Jul 15 '16 at 15:26
  • You should *not* use `AES_encrypt` and friends. That's a software-only implementation, so you will not enjoy hardware support, like AES-NI. You should be using `EVP_*` functions. See [EVP Symmetric Encryption and Decryption](http://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption) on the OpenSSL wiki. In fact, you should probably be using authenticated encryption because it provides *both* confidentiality and authenticity. See [EVP Authenticated Encryption and Decryption](http://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption) on the OpenSSL wiki. – jww Jul 15 '16 at 17:21

0 Answers0