1
我想使用aes 256加密來加密postgreSQL數據庫中的area_code列。 這是發生了什麼..我能夠輕鬆加密它,但我無法解密它。pgp_sym_encrypt解密postgresql中的整個列
這裏是加密的查詢工作正常:
update mytable t1 set area_code = t2.area_code from (select pgp_sym_encrypt(area_code,'Password', 'compress-algo=1, cipher-algo=aes256') as area_code,area_name from mytable) t2 where t1.area_name = t2.area_name;
解密查詢似乎但是並沒有,如果我看到這樣的信息
update mytable t1 set area_code = t2.area_code from (select pgp_sym_decrypt(area_code,'Password') as area_code,area_name from mytable) t2 where t1.area_name = t2.area_name;
或工作,即使我嘗試查看解密area_code
select pgp_sym_decrypt((select area_code from ci), 'Password') ;
唯一可行的是當我使用單個記錄和提要在加密文本中直接作爲輸入。
select pgp_sym_decrypt('aes.encrypted.string.given.as.input', 'Password') ;
有人可以給我一些關於如何解密表中的整個列的輸入!
謝謝:)
以下是錯誤:錯誤:函數pgp_sym_decrypt(字符改變,未知的)不存在 線路3:從(選擇pgp_sym_decrypt(AREA_CODE,「密碼」)作爲區域_... ^ 提示:無功能相匹配的給定名稱和參數類型您可能需要添加明確的類型轉換 **********錯誤********** – Fireworks2188 2014-10-30 15:30:15