I am using EncryptByPassPhrase to encrypting some columns.

If I want to change the passphrase in the future, how can I change it?

2 Answers 2


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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