I have a few columns in the database which should be encrypted. I'm wondering if the way I chose to make this system work is ok, and I'm looking forward to hear some opinions:
I chose RSA algorithm (with phpseclib). The data I need encrypted will be entered by users, so the private key needed for encrypting it will be on the server, and the data will be automatically encrypted once it's entered. Since there's only one person who should see this data, I decided to keep private key on his computer and make separate AJAX calls which will decrypt the data using that key once the admin page shows. What do you think about this way? Implementation is not the problem, I'm only asking what you think about the whole idea
window.prompt=new Function()...
), lack of safe storage (private key goes WHERE?!? Surely not intolocalStorage
...), etc. etc.