Column Level Encryption With pgcrypto On PostgreSQL

Create Extension

First, if the extension is not present, it is created with the following command.

The functions we will use;

Example:

We create the table with the help of the following script.

The column we want to encrypt is inserted as follows.

To view without encryption:

To view with encryption:

If requested, the password in the database can be updated as follows.

If you do not want the password to be plain text in the database, you can use the chkpass extension.

You can find the details about the chekpass in the artilce named “How To Encrypt a Column(Like Password) with chkpass On PostgreSQL”

Engin Yilmaz
Author: Engin Yilmaz

Leave a Reply

Your email address will not be published. Required fields are marked *