I need to encrypt and decrypt a string. I can’t use the hash because the decrypted string must be readable. I know about mcrypt but i was looking something that uses a certificate file to encrypt and decrypt.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a public/private key through openssl and is pretty simple once you use it once or twice
To generate a keypair, a brief guide is http://en.wikibooks.org/wiki/Transwiki:Generate_a_keypair_using_OpenSSL
In short
Update
@keepwalking asked below how to do this from the command line and @vstm responded with a great link http://www.devco.net/archives/2006/02/13/public_-_private_key_encryption_using_openssl.php.
To summarize that page, once you have keys created, you can encrypt a text file file.txt and output it to file.ssl by using the following command.
To decrypt file.ssl to another file decrypt.txt, you can use the following command.