From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: erik@q32.com
Cc: pgsql-general@postgresql.org
Subject: Re: pgcrypto question
Date: Mon, 7 Oct 2019 20:08:42 +0200
Message-ID: <20191007180842.j6jqgcirhsnbqp2x@development> (raw)
In-Reply-To: <CAJowKgKYktmF2kJVeL2YRbC62+92tFgucCJ1HD4rM05ntFW30Q@mail.gmail.com>
References: <CAJowKgKYktmF2kJVeL2YRbC62+92tFgucCJ1HD4rM05ntFW30Q@mail.gmail.com>
On Mon, Oct 07, 2019 at 12:05:16PM -0400, Erik Aronesty wrote:
>Currently, it is my understanding that the pgcrypto library requires
>the user to send a password or private key up to the server for
>decryption.
>
Correct. In the naive case the key is included in each SQL query, which
does have various issues. Bruce Momjian has a nice extension that allows
you to fix that by loading the key into backend memory:
http://momjian.us/download/pgcryptokey/>Is there a notion of a client-side encrypt/decrypt plugin when doing a
>postgres query?
>
>For example, a user could query postgres, get back data of type
>"encrypted", and a "libpq" plugin could decode/decrypt those columns
>that are of data type "encrypted".... in a manner transparent to the
>user of the client....
>
>Obviously I could write this by intercepting the relevant libpq calls
>using LD_PRELOAD or Microsoft's "Detours" ... but it there a better
>way to do that?
>
AFAIk that's usually done at the application level, i.e. the application
is sending/receiving encrypted data, and the database simply sees bytea
columns. I'm not aware of a driver doing that transparently, but it
seems like an interesting idea - I wonder if it could be done e.g. in
psycopg as an extension, or something like that.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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: tomas.vondra@2ndquadrant.com, erik@q32.com
Subject: Re: pgcrypto question
In-Reply-To: <20191007180842.j6jqgcirhsnbqp2x@development>
References: <CAJowKgKYktmF2kJVeL2YRbC62+92tFgucCJ1HD4rM05ntFW30Q@mail.gmail.com> <20191007180842.j6jqgcirhsnbqp2x@development>
* 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