I have a requirement to store at-rest, symmetrically encrypted customer data in a database. What's the latest recommended way to do this? My research has led me to this:
- Generate 8 random bytes for a salt
- Generate PBKDF2-HMAC-SHA1 using OpenSSL with the salt from step #1, customer password, 2^16 iterations, and a key size of 32
- Encrypt the data with AES-256-CBC using OpenSSL using key from #2
- Create an HMAC/SHA1 digest using OpenSSL of the encrypted data from step #3 and the key from #2
- Store the encrypted data and the digest in the database either as two separate fields or a single blob with the two items concatenated together by a delimiter
- Execute the above in reverse to decrypt