We have a postgresql database, as part of GDPR, we need to encrypt some of the column data, I tried searching on internet but couldn't get any concrete answer on how we can achieve this.
For example: let's suppose we have a table as below:
Table "public.demo"
Column | Type | Modifiers
------------+------+-----------
firstname | text |
secondname | text |
city | text |
and it already have data in it:
firstname | secondname | city
-----------+------------+------
john | doe | ban
hich | ke | can
val | nuti | syd
(3 rows)
Now, I need to encrypt only the firstname let's suppose, so basically I need to invoke a script which would encrypt the first name and while reading from java code, we can decrypt and read.
The above needs to work in case of insert queries as well.