I am currently creating a retirement home site. I have already developed a scheme for storing personal data in my database, but I would like to get your opinion on this.
Basically, I have a patient table that stores publicly available (= insensitive) patient information. Other information (e.g. name, address) is private and must be securely stored. I am using a public / private key pair generated by PHP OpenSSL and submitted by the website manager. The passphrase is known only to people who are allowed access to personal data (mainly health care providers). I would like to keep them in another table. The first question is , BLOB best type of column (with MySQL) for storing binary data. Or should I convert them (e.g. base64 ) and save them in a VARCHAR column?
My patient_secure_data table looks like this:
id INT AUTO_INCREMENT
patient_id INT (FOREIGN KEY to patient.id)
key VARCHAR (63)
data blob
env blob
This is the key value table where the value is sealed by openssl_seal . I need to save the third parameter ( $env_keys ) in order to be able to decrypt the data. So the second question is , why do I need env_keys if I have a private key openssl_open when I call openssl_open ?
The third (and last) question is is the database safe schema? I mean, can I guarantee that no one who does not have a passphrase can see private data?
Note. I will also use the same key pair to encrypt files stored on disk. But the database or files, I do not see the difference in security.
Hi,
Guillaume.
Sorry if my language is not perfect, I am not a native speaker of English ... I hope I have made it clear.
source share