pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: PostgreSQL-general <pgsql-general@postgresql.org>
Subject: Matching pgp_sym_encrypt() and gpg2 output
Date: Tue, 27 Aug 2019 13:33:16 -0400
Message-ID: <20190827173316.GA29115@momjian.us> (raw)

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@momjian.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 +





view thread (3+ messages)  latest in thread

Message-ID: <20190827173316.GA29115@momjian.us>
Permalink:  ../20190827173316.GA29115@momjian.us/
Also on:    postgresql.org/message-id/20190827173316.GA29115@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bruce@momjian.us
  Subject: Re: Matching pgp_sym_encrypt() and gpg2 output
  In-Reply-To: <20190827173316.GA29115@momjian.us>
  References: <20190827173316.GA29115@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox