How to encrypt a column using aes-256-gcm encryption in PostgreSQL?
5
votes
1
answer
2611
views
As a database point person, I am required to encrypt SSN numbers wherever they are in a table. We use PostgreSQL.
My application counterparts require that we use the AES-256-GCM encryption algorithm. However, I am not too sure how to apply that in postgresql.
After googling around, I am able to encrypt using either one of these two AES methods:
1\.
UPDATE ssnTable
SET encrypted_ssn = encrypt(encrypted_ssn::bytea, 'mykey', 'aes')`
2.
UPDATE ssnTable
SET encrypted_ssn = pgp_sym_encrypt(encrypted_ssn, 'mykey', 'compress-algo=1, cipher-algo=aes256')
None of the above specifically uses the 'aes-256-gcm' algorithm, which is what I'm being asked to use.
Any idea on how to use this algorithm on the column, in PostgreSQL?
Asked by user211921
(51 rep)
May 17, 2019, 09:22 PM
Last activity: Feb 15, 2025, 08:02 PM
Last activity: Feb 15, 2025, 08:02 PM