Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooQ1S-0006Us-FX for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Oct 2022 14:07:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ooQ1P-0007Yr-Dj for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Oct 2022 14:07:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooQ1P-0007Yi-3a for pgsql-hackers@lists.postgresql.org; Fri, 28 Oct 2022 14:07:43 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooQ1M-0005a4-60 for pgsql-hackers@postgresql.org; Fri, 28 Oct 2022 14:07:42 +0000 Received: from [192.168.1.16] (apoitiers-652-1-379-234.w109-223.abo.wanadoo.fr [109.223.79.234]) by mail.dalibo.com (Postfix) with ESMTPSA id EB1681FB56; Fri, 28 Oct 2022 16:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1666966041; bh=/LwsKBP6tGD1eonEzw/x0LBYJB+Uf9RCvilkpskRke4=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=XITBTum6uHNNEzMwQlejLlt5L0MUXcs3xNfZ8fYfbLnG1/T1xDkA2459dggZNJ2KA q/H4ndm2J/MrrRdZGEhE61bR6Z9ANYthIBSD7icSXxyYb7ZnloMOYMkbiUrZoL3Ucc AI9sZNhE//DYDkBiGrAgI5oqmQp3fekjY2M2QiV8= Message-ID: <0ec3a98a-6347-4a40-c135-3b9cf3847d25@dalibo.com> Date: Fri, 28 Oct 2022 16:07:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 To: Jehan-Guillaume de Rorthais , Peter Eisentraut Cc: pgsql-hackers References: <89157929-c2b6-817b-6025-8e4b2d89d88f@enterprisedb.com> <48a9f2c2-4a57-27d8-7c53-16a23a01014e@enterprisedb.com> <79f08a39-a7da-5157-cef4-378fb60c18f8@enterprisedb.com> <258c5064-437e-f41e-7537-5e8c343c33cc@enterprisedb.com> <6bd99fea-3298-854d-d37f-554151342f36@enterprisedb.com> <963aa100-7e78-3463-0645-700eaaa325f2@enterprisedb.com> <06830254-6d87-86b2-0280-bf2eee7736a5@enterprisedb.com> <20221028121629.6467d8f9@karst> Content-Language: fr, en-US From: =?UTF-8?Q?Fr=c3=a9d=c3=a9ric_Yhuel?= Subject: Re: Transparent column encryption In-Reply-To: <20221028121629.6467d8f9@karst> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Here are a few more things I noticed : If a CEK is encrypted with cmk1 and cmk2, but cmk1 isn't found on the client,the following error is printed twice for the very first SELECT statement: could not open file "/path/to/cmk1.pem": No such file or directory ...and nothing is returned. The next queries in the same session would work correctly (cmk2 is used for the decryption of the CEK). An INSERT statement si handled properly, though : one (and only one) error message, and line actually inserted in all cases). For example : postgres=# SELECT * FROM customers ; could not open file "/path/to/cmk1.pem": No such file or directory could not open file "/path/to/cmk1.pem": No such file or directory postgres=# SELECT * FROM customers ; id | name | creditcard_num ----+-------+----------------- 1 | toto | 546843351354245 2 | babar | 546843351354245 postgres=# INSERT INTO customers (id, name, creditcard_num) VALUES ($1, $2, $3) \gencr '3' 'toto' '546888351354245'; could not open file "/path/to/cmk1.pem": No such file or directory INSERT 0 1 postgres=# SELECT * FROM customers ; id | name | creditcard_num ----+-------+----------------- 1 | toto | 546843351354245 2 | babar | 546843351354245 3 | toto | 546888351354245 From the documentation of CREATE COLUMN MASTER KEY, it looks like the REALM is optional, but both CREATE COLUMN MASTER KEY cmk1; and CREATE COLUMN MASTER KEY cmk1 WITH (); returns a syntax error. About AEAD, the documentation says : > The “associated data” in these algorithms consists of 4 bytes: The ASCII letters P and G (byte values 80 and 71), followed by the algorithm ID as a 16-bit unsigned integer in network byte order. My guess is that it serves no real purpose, did I misunderstand ?