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 1iHZ19-0003Y9-Bk for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 19:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHZ18-0003CZ-6F for pgsql-general@arkaria.postgresql.org; Mon, 07 Oct 2019 19:50:02 +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 1iHZ17-0003Bw-Oa for pgsql-general@lists.postgresql.org; Mon, 07 Oct 2019 19:50:01 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iHZ15-0007ns-3G for pgsql-general@postgresql.org; Mon, 07 Oct 2019 19:50:00 +0000 Received: by mail-wr1-x444.google.com with SMTP id y19so16735456wrd.3 for ; Mon, 07 Oct 2019 12:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VawtkzlEmemrht7FBQyrcQv2TZafUtozPLm6HfkLdtc=; b=nwG+Dh3nhjrlniOV56ZTm5Dl80XjM/y++dK2QFQyqLgA4nHHK1HGhHqffqnkop3cw4 +/cnD/ToQu410ZIS0VZ+btKyOGdisJWbumnmdCoyoQzkhik2z4ANzhMof/z66sWzfotJ 52C8dGYKn3P4H4zpl/97PdVmBFPxuRMzH3WH2g1QAeBAj2zIbaom1Fr0Q48MmkuBA9tN b3uXerK49ALibEIxxbTaqT9hh4OicYZKGPpmHp+XWABD70vKmrn0NuE/4RoGbkpUrx4S sf9qvDydivgxOtdVLpGhUpn3x83N7YfsSLhBgrNn8q+272DdhaEcMJaddGAco46l/nFX wr+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VawtkzlEmemrht7FBQyrcQv2TZafUtozPLm6HfkLdtc=; b=Xwc0jp6XE6cRlf0hedQmirb7sGnYJshXAkDSXTInMJDe0H+PvyskPxhXfVtvDhHL7J 52bj5X+4FWygC1lVAPjwnxUFf3tQSDHAFiclmmyBsgfJjyli6qkahZ3GqEhTATRquM8l 4QD1xGPj3PsI8wYiL8HJGuDgNHaX3zfbLiC/La7ffE0rPs5gtFs/oUddbxq3b0ymSXea xIPykWSG7iqfhoSmC+LIJ/IJ3IMKsG1fsjLbgRCaZ/Z2Ywqmhki3Cq6PMn3LBvgrIfk/ RfjGCyxxxbL/+Jkpd115vm9VUEDfOjpliH0+uqJetSPAGvf8qAALfT3qAFmAPCRrtzo+ EkSg== X-Gm-Message-State: APjAAAV6Y3PCAohXJ8Ewh2VHZpFG+9h0iPIOntaIEZoy2PmSva5D2F4h 6jbhUC9z6KBRCkgcvmptmcHea7Ygmmk= X-Google-Smtp-Source: APXvYqzvC0aBAEaFbHajCJsu2HG6+NTwWZbMAEpAO7VUYHlGkDyQxK5zZwVdg3DOKNpAuIjsOwhfvw== X-Received: by 2002:adf:ebce:: with SMTP id v14mr3443330wrn.368.1570477796679; Mon, 07 Oct 2019 12:49:56 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id r65sm862030wmr.9.2019.10.07.12.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 12:49:53 -0700 (PDT) Date: Mon, 7 Oct 2019 21:49:51 +0200 From: Tomas Vondra To: Erik Aronesty Cc: pgsql-general@postgresql.org Subject: Re: pgcrypto question Message-ID: <20191007194951.jxdmeiqobifx4ja4@development> References: <20191007180842.j6jqgcirhsnbqp2x@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Oct 07, 2019 at 02:51:30PM -0400, Erik Aronesty wrote: >Good idea for "psycopg". It would be easy for a POC, but I think the >only meaningful layer to operate at would be a libpq drop-in >replacement that intercepts PQgetvalue, PQprepare, PQexecParams, >PQexecPrepared ... etc. That way odbc, python, node, etc would "just >work".... as long as you used LD_PRELOAD appropriately. > It's not clear to me how would that know which columns are encrypted, with what key, etc. Because those encrypted columns are essentially just regular bytea columns, so there's no easy way to distinguish them. I'm no psycopg2 expert, but it does have some infrastructure for casting PostgreSQL types to Python types, and I guess that could be used for the encryption. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services