Re: BUG #16476: pgp_sym_encrypt_bytea with compress-level=6 : Wrong key or corrupt data

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: frank(dot)gagnepain(at)intm(dot)fr, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16476: pgp_sym_encrypt_bytea with compress-level=6 : Wrong key or corrupt data
Date: 2020-06-03 12:35:02
Message-ID: CAMkU=1wJQyYj14SXTwp0msnk=ShA0zizYeOB_biWf5F45JiWEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> select
>
> pgp_sym_decrypt_bytea(pgp_sym_encrypt_bytea(bytea_import(DATA),'password','compress-algo=1,
> cipher-algo=aes256, compress-level=6'),'password','compress-algo=1,
> cipher-algo=aes256');
>
>
decryption reads the settings from the encrypted message header, there is
no need to specify them again.

I can reproduce this at any compression level if the data is random (not
compressible) and exactly 16365 bytes long. If the data is compressible,
then you need a longer length of message to reproduce it and it depends on
the random content and compression level.

I'm attaching the reproducer as a Perl script. I have not investigated the
C code of pgcrypto itself.

Cheers,

Jeff

Attachment Content-Type Size
pgcrypto_zip.pl application/octet-stream 824 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyle Kingsbury 2020-06-03 12:48:56 Re: Potential G2-item cycles under serializable isolation
Previous Message Daniel Verite 2020-06-03 11:51:19 Re: Potential G2-item cycles under serializable isolation