简体   繁体   中英

Encrypt a string using OpenSSL in C

I have a problem with encrypting a string. I have the command to encrypt a file using OpenSSL. But I wanted to know the encrypt the string not the File. The command for encrypting a file is:

system("openssl des3 -e -nosalt -in %s -out  %s -k %s > /tmp/sys; cat /tmp/sys", src, dest, key);

where src and dest are the two file names. what are the options available with OPEN SSL. In above in and out are options for encrypting a text file. I need the option to encrypting character array variable.

As pointed out on another question (by someone who dug through the code more than I did):

https://opensource.conformal.com/viewgit/?a=viewblob&p=cyphertite&h=899259f8ba145c11087088ec83153db524031800&hb=6782c6839d847fbed0aed8c55917e78b5684110f&f=cyphertite/ct_crypto.c

has the code you need to use OpenSSL natively to perform encryption/decryption in your app.

Happy hacking!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM