Matching pgp_sym_encrypt() and gpg2 output

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Matching pgp_sym_encrypt() and gpg2 output
Date: 2019-08-27 17:33:16
Message-ID: 20190827173316.GA29115@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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'

8c0d0409030248b24f9d2bc91287f5d24701...

while pgp_sym_encrypt() outputs:

SELECT pgp_sym_encrypt('my access password', 'abc', 'cipher-algo=aes256');

pgp_sym_encrypt
----------------------------------------
\xc30d0409030282dbcc61c149fd4b67d24...

I realize the \x is from the bytea output function, but the hex digits
don't match, and the gpg2 output is slightly longer than the
pgp_sym_encrypt() output. What gpg2 options will allow it to match?
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 +

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2019-08-27 17:56:35 No warning/error trying to vacuum other session's temp table
Previous Message Jeremy Thomason 2019-08-27 17:08:18 Re: import job not working