Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2fLT-0001Jg-4y for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 17:33:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2fLR-0000aX-6T for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 17:33:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2fLQ-0000U0-Pd for pgsql-general@lists.postgresql.org; Tue, 27 Aug 2019 17:33:24 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1i2fLJ-0007Fq-TB for pgsql-general@postgresql.org; Tue, 27 Aug 2019 17:33:23 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1i2fLI-0002Vy-Vo for pgsql-general@postgresql.org; Tue, 27 Aug 2019 13:33:16 -0400 Date: Tue, 27 Aug 2019 13:33:16 -0400 From: Bruce Momjian To: PostgreSQL-general Subject: Matching pgp_sym_encrypt() and gpg2 output Message-ID: <20190827173316.GA29115@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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 +