Re: pgp_sym_decrypt() - error 39000: wrong key or corrupt data

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgp_sym_decrypt() - error 39000: wrong key or corrupt data
Date: 2018-06-27 22:29:29
Message-ID: 473f6e87-4bc9-63d2-f13a-1b092987f19a@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/27/2018 09:55 AM, Moreno Andreo wrote:
> Il 22/06/2018 19:56, Adrian Klaver ha scritto:
>> On 06/22/2018 09:50 AM, Moreno Andreo wrote:
>>> Il 22/06/2018 15:18, Adrian Klaver ha scritto:
>>

>>
>> I am at a loss now. The only thing I can think of is that data itself
>> is actually corrupted. Maybe some sort of language encoding/collation
>> issue. Just not sure how to test that at the moment.
>
> Actually, I tried it in a bunch of other fields with varying data types
> and everything went fine.
> I don't know if it's as you say and I mismatched keys (and I need
> another pair of glasses) or something else. Just hoping (but being
> confident) it won't happen again.

You might try emailing the pgcrypto author
https://www.postgresql.org/docs/10/static/pgcrypto.html#id-1.11.7.35.11

In the source code I noticed that there are many:

px_debug('Some text')

that map to:

{PXE_PGP_CORRUPT_DATA, "Wrong key or corrupt data"}.

I tried running with messages set to DEBUG to see if I could get at the
more specific messages. That did not work, so you might ask the author
if there is a way to get at them.

>
> Now trying to speed up a little some queries involving SELECTing among
> these encrypted fields, if I'm stuck I'll open a new thread.
>
> Thanks,
> Moreno.-
>
>>
>>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2018-06-27 23:08:48 Re: Space Stalker in SQL Output
Previous Message Adrian Klaver 2018-06-27 22:16:23 Re: Database name with semicolon