【发布时间】:2015-03-18 12:55:15
【问题描述】:
我正在尝试使用“pgp_sym_encrypt”查询 postgres 中的加密字段。我正在通过将表中的所有名字设置为加密值来运行测试:
update person set first_name = pgp_sym_encrypt('test', 'password');
然后选择它:
select * from person where first_name = pgp_sym_encrypt('test', 'password');
这不会返回任何结果。
如果我将其更改为使用普通的 postgres 加密,它将返回表中的所有行:
update person set first_name = encrypt('test', 'password', 'aes');
select * from person where first_name = encrypt('test', 'password', 'aes');
我当前的 postgres 版本是:postgres (PostgreSQL) 9.4.0。 本例中的 first_name 字段是 bytea 字段。
有谁知道为什么使用“pgp_sym_encrypt”不起作用?
谢谢!
【问题讨论】:
标签: sql postgresql security encryption