Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2GzQ-0007Ho-RL for pgsql-performance@arkaria.postgresql.org; Tue, 18 Sep 2018 14:28:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2GzO-0000vv-4n for pgsql-performance@arkaria.postgresql.org; Tue, 18 Sep 2018 14:28:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2GzN-0000uv-Nq for pgsql-performance@lists.postgresql.org; Tue, 18 Sep 2018 14:28:29 +0000 Received: from mout02.posteo.de ([185.67.36.66]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g2GzH-0003dG-Oh for pgsql-performance@lists.postgresql.org; Tue, 18 Sep 2018 14:28:28 +0000 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id D7C1221074 for ; Tue, 18 Sep 2018 16:28:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1537280899; bh=7N2AyRxLDuSZs+Vl9aTSfYQHPgh19Q8oxVs6TYeAf4Y=; h=Date:From:To:Subject:From; b=VpD10u8JKVS+K6Jgf7fW3lyEknkdDaKUHFckeK1q5iGBUwyVQiGl00Mu7yydXIVaU O9lTv219AR+ywzALUaP2zss8yH/s58wLMrqQtjziBv+3+4EenvOxux8U1ZJgtcGvhl kX6StuT1V1nJi012e4Ro1FMbLuFA6bXx4z7kuffD16KKay6Eg6vKclCquf3+ldpUtc QrDThqW8/9aY0YfX8n4bdaqDeeEre/sbcDLUdHTeNtIE/XRsRVWH3P/ONMAD6FsYe2 S9/VgGU9CGqOEwDSsRHasRj0xTo9E+YpH/DXM45Tn49RhSvboJ2I/kCcX2uly4NnqA owuaYIdE1ZCCQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 42F52B5lw6z9rxG for ; Tue, 18 Sep 2018 16:28:18 +0200 (CEST) Date: Tue, 18 Sep 2018 16:28:18 +0200 From: "Felix A. Kater" To: pgsql-performance@lists.postgresql.org Subject: pg_pub_decrypt: 10x performance hit with gpg v2 Message-ID: <20180918142818.GA24012@comppasch2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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 Hi, pg_pub_decrypt() is ~10x slower when the priv/pub keys have been generated with gnupg version 2.x instead of version 1.x. What I do is: - Create keys with gpg - Export priv/pub keys - Store keys in binary form in a bytea - Create 32 byte random data and encrypt it with pg_pub_encrypt() - \timing on - Decrypt with pg_pub_decrypt(). I see ~8ms with v1 keys vs. ~100ms with v2 keys. I am using defaults everywhere, when generating keys as well as encrypting with pg_pub_encrypt(). Outside postgresql, I've tested random file encryption/decryption with gpg 2.x and with both the v1 keys against the v2 keys (both in the gpg keyring) and cannot detect significant differences. What can I do to track that issue further down. Thanks