0


pgsql数据库加密解密

1.安装外部模块 pgcrypto

create extension pgcrypto;

2.查看pgcrypto版本

select * from pg_available_extensions where name ='pgcrypto'

3.明文加密

select encode(encrypt('明文'::bytea,'account','aes'),'hex')

aes:加密算法,支持aes、aes-cbc等
hex:编码格式,支持hex、base64等
account:秘钥,任意字符串

4.密文解密

select convert_from(decrypt(decode('密文','hex'),'account','aes'),'SQL_ASCII');
标签: 安全

本文转载自: https://blog.csdn.net/qq_41172258/article/details/127296813
版权归原作者 qq_41172258 所有, 如有侵权,请联系我们删除。

“pgsql数据库加密解密”的评论:

还没有评论