PostgreSQL column-based encryption

Viewed 28

For GDPR purpose, I need to encrypt some columns in PostgreSQL from C# code. I did with pgcrypto extension and using PGP_SYM_ENCRYPT and pgp_sym_decrypt functions and it works fine. The only question I have is how to generate the AES key like a symmetric key in SQl. And where I can save the key?

PGP_SYM_ENCRYPT('value', 'AES_KEY')

pgp_sym_decrypt({column}::bytea, 'AES_KEY')

0 Answers
Related