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
will be entered by users, so the private key needed for encrypting it will be on the server
This doesn't make any sense. Surely you mean the data is encrypted using the public key (and decrypted using the private key). Assuming this is the case:
Implementation is not the problem
window.prompt=new Function()...), lack of safe storage (private key goes WHERE?!? Surely not into
localStorage...), etc. etc.