Re: Matching pgp_sym_encrypt() and gpg2 output

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Matching pgp_sym_encrypt() and gpg2 output
Date: 2019-08-27 18:35:19
Message-ID: 20190827183519.GA29114@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 27, 2019 at 02:05:28PM -0400, Jeff Janes wrote:
> On Tue, Aug 27, 2019 at 1:33 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> I am trying to generate output from the command-line program gpg2 that
> matches the output of pgp_sym_encrypt().  gpg2 outputs:
>
>         $ echo 'my access password' | tr -d '\n' | gpg2 --symmetric --batch
>         > --cipher-algo AES256 --passphrase 'abc' | xxd -p | tr -d '\n'
>
>
> I don't even get the same output on repeated execution of this same command, so
> I think you are pursuing a lost cause.

Ah, very good point. I at least get the same first few bytes and same
length each time, so I never even looked at the trailing bytes, and you
are right that it isn't surprising they differ each time.

Anyway, I figured it out. I was originally trying to use openssl to
match pgp_sym_encrypt(), and that wasn't working, and then when I
couldn't get the gpg2 bytes to match, I asked here. Seems I got it
working with the attached SQL file. Thanks.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
key-pass-test.sql application/x-sql 510 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bikram Majumdar 2019-08-27 18:39:12 Re: Question on pgwatch
Previous Message Jeff Janes 2019-08-27 18:05:28 Re: Matching pgp_sym_encrypt() and gpg2 output