I have a table and I want to encrypt, few columns of it using pgcrypto functions of PostgreSQL. Lets say I want to use pgp_sym_encrypt( 'sample_name', 'someKey' , [options]).
I need suggestions on how and where to store the 'someKey'. I understand that KMS feature is not straight forward ( probably not yet fully implemented in PG- 12 ), but storing the 'someKey' in the code is not desirable, nor storing in some other database/servers.
I was hoping if I can generate a Random key to encrypt the data, but I also need to decrypt it while fetching - any suggestion on this please.
I am exploring options in learning phase, now.