我正在尝试对prostrgres DB中的列进行加密.列名是"test".类型为"bytea".
I am trying to encrypt a column in my prostrgres DB. The column name is "test" of type "bytea".
我的实体代码在下面,
@ColumnTransformer(read = "pgp_sym_decrypt(" + " test, " + " current_setting('encrypt.key')" + ")", write = "pgp_sym_encrypt( " + " ?, " + " current_setting('encrypt.key')" + ") ") @Column(columnDefinition = "bytea") private String test;postgresql.conf配置文件: crypto.key ='哇!非常安全.
postgresql.conf configuration file: encrypt.key = 'Wow! So much security.
将postgresql.conf配置文件放置在spring boot appln的src/main/resources中.但是没有选择encryption.key值.有没有一种方法可以使用application.properties传递密钥?
Placed the postgresql.conf configuration file in src/main/resources of spring boot appln. But the encryption.key value is not being picked up. And is there a way to pass the key using application.properties?
推荐答案postgresql.conf是服务器的nofollow noreferrer>配置文件.它存储在数据目录(也称为集群")中服务器.
postgresql.conf is the configuration file for the Postgres server. It's stored inside the data directory (aka "cluster") on the server.
您不能将其放在客户端(您的应用程序运行所在的位置)上.那里没有意义.
You can't put it on the client side (where your application runs). It has no meaning there.
要在其中更改值,您需要编辑文件(在服务器上)或使用 ALTER SYSTEM .
To change values in there, you need to edit the file (on the server) or use ALTER SYSTEM.
如果要更改当前会话的配置设置,请使用 SET 或 set_config()
If you want to change a configuration setting for the current session, use SET or set_config()
后两个可能是您要为加密/解密功能初始化自定义属性的对象.
The latter two are probably the ones you are looking for to initialize the custom property for your encryption/decryption functions.
更多推荐
我们将这个postgresql.conf配置文件放在Spring Boot应用程序中的确切位置?
发布评论