I need to store the customers' driver license # (most of the time) (or personal ID) so when they come to pick their product they can identified themselves based on their id. This is usually the way it is handled everywhere in my country (unfortunately). However, I would like to store this #'s encrypted in mysql. I now I can make use of AES_ENCRYPT
, but, my question is, if I hard code the $key
, then an attacker who gains access to the server can easily decrypt all of the fields having the key. How can I deal with this?
What I had in mind was to use perhaps openssl_public_encrypt
and have a public and private key, but not sure how to implement it. (any good links for explanation?) maybe Asymmetric Key RSA?
I have several physical servers available that I can make use of, if needed.
Any help will be appreciated.