- Master key is entered upon login then encrypted with
- Master key is now stored as
$_COOKIE['encrypted_key']variable for persistence (so user doesn't have to enter it every page load)
$server_keyis stored inside a config file in the app server
- Data is decrypted by first decrypting
$server_key), therefore revealing Master key
$_COOKIE['encrypted_key']is destroyed upon browser exit
Attacker gaining access to user device/cookie and encrypted data (but not the app server config files).
Does it make sense to encrypt the Master key with
$server_key and then store
$server_key inside a config file in the app server?
Gaining just the
$server_key or just the
$_COOKIE['encrypted_key'] will not compromise anything. The attacker must get both.
- This is under HTTPS
- Session hijacking would be hard as we check session fingerprint per request