Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XJm3j-0002YB-4F for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2014 16:14:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XJm3i-0006dB-KW for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2014 16:14:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XJm3h-0006d3-Ef for pgsql-hackers@postgreSQL.org; Tue, 19 Aug 2014 16:14:53 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XJm3Z-0000N2-86 for pgsql-hackers@postgreSQL.org; Tue, 19 Aug 2014 16:14:51 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 72CC729DDE; Tue, 19 Aug 2014 09:14:43 -0700 (PDT) Received: from EX13-CAS-004.vmware.com (EX13-CAS-004.vmware.com [10.113.191.54]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 69D0C19713; Tue, 19 Aug 2014 09:14:43 -0700 (PDT) Received: from EX13-MBX-024.vmware.com (10.113.191.44) by EX13-MBX-008.vmware.com (10.113.191.28) with Microsoft SMTP Server (TLS) id 15.0.775.38; Tue, 19 Aug 2014 09:14:43 -0700 Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.775.38; Tue, 19 Aug 2014 09:14:42 -0700 Message-ID: <53F377EE.4090006@vmware.com> Date: Tue, 19 Aug 2014 19:14:38 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Stephen Frost CC: PostgreSQL-development Subject: Re: PQgetssl() and alternative SSL implementations References: <53F1E989.8020609@vmware.com> <20140819144841.GA16422@tamriel.snowman.net> <53F36B6E.6040105@vmware.com> <20140819154436.GD16422@tamriel.snowman.net> In-Reply-To: <20140819154436.GD16422@tamriel.snowman.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/19/2014 06:44 PM, Stephen Frost wrote: >> >Hmm. That seems a bit too much. Perhaps provide just the certificate >> >itself in DER/PEM format, and have the client parse it (using >> >OpenSSL or something else) if it wants more details. > I really don't care for that approach. Our SSL support has always been > horrible- I was hoping we'd actually improve that situation. Adding > things in piecemeal over time will just be painful for our users and I > don't see why we should wait. What would you like to do with the certificates? I'm imagining that a GUI tool like pgAdmin might want to extract all information from the certificate, display it in a window, and let the user look at the whole chain and all the fields. Like a browser does when you click the little lock icon in the address bar. That would be a nice feature, but it's a huge effort to expose *all* certificate information through attributes, especially if you want to support multiple SSL libraries. If there was a generic "get attribute X" interface in OpenSSL and all the other SSL libraries we wish to support, we could provide a pass-through mechanism for that, so that e.g all attributes that OpenSSL exposes were mapped to "server_cert_*". But I don't think that exists in OpenSSL, let alone in other libraries, and the attribute names would be all different anyway. So that's not really feasible. But if we provide an interface to grab the whole certificate chain, then you can use any library you want to parse and present it to the user. You could use OpenSSL, but you could also use a more light-weight parser like libtasn1, or if you're writing a python app for example, whatever x509 certificate handling library they have. You wouldn't be *verifying* the certificates - that's handled by libpq (or rather, the SSL library that libpq uses) - so no cryptography required. Or you could just pass the whole cert to a 3rd party program specifically written to display x509 certificates, and let it do the parsing. I'll mention that the Windows Crypto API has a built-in function called CryptUIDlgViewCertificate that pops up a dialog for viewing the certificate. Very handy. I think it's the same dialog that Internet Explorer uses. If you want to write such a GUI from scratch, anyway, I think you would be better off to *not* rely on libpq functions, so that you could use the same GUI in other contexts too. Like to view an arbitrary certificate file on the filesystem. That said, if there's a need to extract some specific fields for some other purpose than displaying the whole certificate to the user, let's hear it. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers