Avatar of mazzzzz
mazzzzz
Flag for United States of America asked on

Encrypt/decrypt text php/Mysql

I need a way to store sensitive data in a database, and be able to decrypt it later.  I can't think of a solution, nothing like base64 would do it, even with a salt, I can't use a one-way hash, because I need to view the data later.
The site is designed so the user to logs in, then they have access to the data, but with symmetric encryption, the user would need to input a password every time he/she wanted to view data, or have the password stored in a session/cookie, but that seems a little too insecure.  Something like RSA might work, but where would I store the private key?
Any ideas on how to store this data would be great,
Thanks,
Max
PHPEncryption

Avatar of undefined
Last Comment
mazzzzz

8/22/2022 - Mon
Loganathan Natarajan

did you see mcrypt() ref. http://in3.php.net/mcrypt
ASKER CERTIFIED SOLUTION
marktudor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
pg-expert

Two Way Encryption With PHP Mcrypt. Look at the sample below
http://www.phpro.org/classes/Two-Way-Encryption-With-PHP-Mcrypt.html

For a simple encrypt / decrypt solution
http://www.webmasterworld.com/php/3086138.htm
mazzzzz

ASKER
Thank you for the much needed advice!
Your help has saved me hundreds of hours of internet surfing.
fblack61