I am using EncryptByPassPhrase
to encrypting some columns.
If I want to change the passphrase in the future, how can I change it?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityI am using EncryptByPassPhrase
to encrypting some columns.
If I want to change the passphrase in the future, how can I change it?
You'll need to decrypt the data using the existing password then encrypt the value using the new password.
The question of key management is a tough one. While the question regards PostgreSQL, the conceptual overview may apply to you. You may want to read Craig's answer to Database encryption and key management with pg_crypto as the concepts should apply anywhere.
The basic overview is you want to keep passphrases separate from user access, using public/private key pairs (private keys encrypted with user-provided passphrases). Then you can decrypt the passphrase, change it globally for the sensitive information at issue. This can be done so that users can still access the data they have access to because the passphrase is encrpyted with their public keys.