I am trying to secure user's profile in database (data at rest). This user's profile is downloaded only after successful authentication at server (based on user's entered password and user name).
The user's profile is encrypted using AES-GCM
- PBKDF2 derived symmetric key (derived from entered password)
- A random salt
- The nonce
The operation returns me the encrypted data and a MAC (Message authentication code)
I need to decrypt the data without authenticating from server using the same entered password
- New PBKDF2 derived symmetric key
- Same salt as used for encryption
- Same nonce as used for encryption
- Same MAC as generated from encryption
My question is where (along with encrypted data? somewhere else?) and how (encrypted? hashed?) should I store the MAC in database?