Thread: Pg 9.1.3 pg_crypto question
Hi, Finally upgrading from 8.2.5 to 9.1.3 (got the latest release as of 3/12/2012) OS: Ubuntu 11.10 The only issue I am encountering is in the pg_crypto/decrypt_iv/decode No errors in the log, but here's what I am seeing on both 8.2.5 and 9.1.3, I am hoping someone can help me out here: 8.2.5# 8.2.5=# select encode(encrypt_iv(text2bytea('Hello There'), decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', 'aes-cbc'), 'base64'); encode -------------------------- rkMRWpnnbjaFoHyLmCD/bg== (1 row) 8.2.5=# select decrypt_iv(decode('rkMRWpnnbjaFoHyLmCD/bg==', 'base64'), decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', 'aes-cbc'); decrypt_iv ------------- Hello There (1 row) So, the 8.2.5 is working as it always has. 9.1.3 is just not decrypting nor throwing errors. 9.1.3# 9.1.3# select encode(encrypt_iv(text2bytea('Hello There'), decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', 'aes-cbc'), 'base64'); encode -------------------------- rkMRWpnnbjaFoHyLmCD/bg== (1 row) 9.1.3# select decrypt_iv(decode('rkMRWpnnbjaFoHyLmCD/bg==', 'base64'), decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', 'aes-cbc'); decrypt_iv -------------------------- \x48656c6c6f205468657265 (1 row) Thanking you in advance, Aaron
Aaron Burnett <aburnett@bzzagent.com> writes: > 9.1.3 is just not decrypting nor throwing errors. > 9.1.3# select decrypt_iv(decode('rkMRWpnnbjaFoHyLmCD/bg==', 'base64'), > decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', > 'aes-cbc'); > decrypt_iv > -------------------------- > \x48656c6c6f205468657265 > (1 row) I think this is the same result, it's just being shown in hex. See the bytea_output configuration parameter. regards, tom lane
Thanks, Tom. That was exactly it. Best Regards On 4/10/12 2:50 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote: >Aaron Burnett <aburnett@bzzagent.com> writes: >> 9.1.3 is just not decrypting nor throwing errors. > >> 9.1.3# select decrypt_iv(decode('rkMRWpnnbjaFoHyLmCD/bg==', 'base64'), >> decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', >> 'aes-cbc'); >> decrypt_iv >> -------------------------- >> \x48656c6c6f205468657265 >> (1 row) > >I think this is the same result, it's just being shown in hex. >See the bytea_output configuration parameter. > > regards, tom lane
I had the same problem. I can confirm that changing to bytea_output = 'escape' restores the previous behavior. Regards, Dick Wieland On 04/10/2012 01:50 PM, Tom Lane wrote: > Aaron Burnett<aburnett@bzzagent.com> writes: >> 9.1.3 is just not decrypting nor throwing errors. >> 9.1.3# select decrypt_iv(decode('rkMRWpnnbjaFoHyLmCD/bg==', 'base64'), >> decode('bcRJvbqeWMPDXMtIP8pPOQ==', 'base64'), '0000000000000000', >> 'aes-cbc'); >> decrypt_iv >> -------------------------- >> \x48656c6c6f205468657265 >> (1 row) > I think this is the same result, it's just being shown in hex. > See the bytea_output configuration parameter. > > regards, tom lane >