I'm working on a Spring Boot project using PostgresSQL DB. I need to encrypt/decrypt data then I follow this solution How to encrypt a column in Postgres using Hibernate @ColumnTransformer
As the example,
@ColumnTransformer(
read = "pgp_sym_decrypt(" +
" test, " +
" current_setting('encrypt.key')" +
")",
write = "pgp_sym_encrypt( " +
" ?, " +
" current_setting('encrypt.key')" +
") "
)
@Column(columnDefinition = "bytea")
private String test;
He said that
encrypt.key is stored in the postgresql.conf configuration file
But I host the DB on AWS RDS and have no postgresql.conf . I want to read the key from variable from application.properties I try to directly inject it like,
read = "pgp_sym_decrypt(" +
" test, " +
" '${psql.key}'"
But the it will consider '${psql.key}' as a string. How can I inject the variable inside it ?
Thanks for helps.