0

We have an application that uses cookies to transmit employee personal data over from the front end to the server. We have planned to use TLS 1.2 for the encryption in transit. However once the java code receives this and stores it in the database, we are planning to encrypt the personal data fields and then store it on the Database. For enabling quicker computing, we have planned to use AES-128.

Now what do I consider to use as the key to encrypt and decrypt the personal data. Can I use the employee's password itself as the key? Would this be sufficient, or should I consider using something else, such as a random set of characters? What would be better? Also help would be appreciated if there is advice regarding managing the encryption keys.

The application resides on a private IP address, and also has the protection of a firewall.

  • Who needs to access this information? Is it just the employee him or herself? If so, why do you need to store the information at all? If not just the employee, you will need to use something other than the users password. – user52472 Apr 3 at 18:46
  • @user52472 as per the current setup, only the employee and his boss will be accessing the personal information. That is why we have planned to use AES 128. – Vikas Apr 4 at 1:00
2

Can I use the employee's password itself as the key?

No. They won't be able to change their password without reencrypting all data and a password is usually a weak encryption key.

First derive a secure hash from the password (e.g. using PBKDF2, Argon2 or a similar Key derivation function), then generate a secure encryption key from a good random source. Use this key to encrypt the data and encrypt this key with the KDF-Hash of the user password. When the user changes the password, you just need to reencrypt the encryption key, but not all the data.

  • I have a few concerns with this method: 1) The only person who will be able to access this data will be the user. Presumably some other party will need to access the data. 2) In the event that the key which is encrypted by the KDF is some how compromised, how can they keys be rotated? – user52472 Apr 3 at 18:44
  • 1
    1) you can encrypt the master key several times with different hashed passphrases. 2) Of course. But this is true for any scheme. When the actual encryption key is leaked, you need to reencrypt everything. – allo Apr 4 at 9:37
0

I would suggest to use RSA. Generate public and private keys for each user on successful login and store the private key in Database.

Use the public key to encrypt your employee personal data and send the data to the server.

At server side take the private key mapped to the user from database then do decryption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.