X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9A5832A921 for ; Tue, 12 Oct 2004 06:44:13 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96219-07 for ; Tue, 12 Oct 2004 05:44:03 +0000 (GMT) Received: from ms-dienst.rz.rwth-aachen.de (ms-1.rz.RWTH-Aachen.DE [134.130.3.130]) by svr1.postgresql.org (Postfix) with ESMTP id 76DDA329F0D for ; Tue, 12 Oct 2004 06:44:03 +0100 (BST) Received: from r220-1 (r220-1.rz.RWTH-Aachen.DE [134.130.3.31]) by ms-dienst.rz.rwth-aachen.de (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0I5G0083XIJ9TN@ms-dienst.rz.rwth-aachen.de> for pgsql-jdbc@postgresql.org; Tue, 12 Oct 2004 07:42:45 +0200 (MEST) Received: from relay.rwth-aachen.de ([134.130.3.1]) by r220-1 (MailMonitor for SMTP v1.2.2 ) ; Tue, 12 Oct 2004 07:42:44 +0200 (MEST) Received: from post.halifax.rwth-aachen.de (post.halifax.RWTH-Aachen.DE [134.130.49.251]) by relay.rwth-aachen.de (8.13.0/8.13.0/1) with ESMTP id i9C5giRD026325 for ; Tue, 12 Oct 2004 07:42:44 +0200 (MEST) Received: (qmail 4503 invoked from network); Tue, 12 Oct 2004 05:42:46 +0000 Received: from darkenemy.halifax.rwth-aachen.de ([134.130.48.36]) (envelope-sender ) by mail.halifax.rwth-aachen.de (qmail-ldap-1.03) with SMTP for ; Tue, 12 Oct 2004 05:42:46 +0000 Date: Tue, 12 Oct 2004 07:42:30 +0200 From: Ulrich Meis Subject: Re: A solution to the SSL customizing problem In-reply-to: <416B5EBC.6060507@opencloud.com> To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Message-id: <200410120742.30677.kenobi@halifax.rwth-aachen.de> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Content-disposition: inline User-Agent: KMail/1.7 References: <200410111752.33375.kenobi@halifax.rwth-aachen.de> <200410120620.04002.kenobi@halifax.rwth-aachen.de> <416B5EBC.6060507@opencloud.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/103 X-Sequence-Number: 11208 On Tuesday 12 October 2004 06:34, Oliver Jowett wrote: > Ulrich Meis wrote: > > On Tuesday 12 October 2004 04:57, Oliver Jowett wrote: > >>So I suggest you look at solving the "how do I give the driver an > >>appropriate SSLSocketFactory" problem first. Once that is solved, the > >>particular configurable behaviour you want can be easily implemented. > > > > How about my suggestions with the abstract handler class? > > I know it was a long post ;-) > > Namely: > > In the Driver class you offer a method(make it empty if compiled without > > SSL): > > > > setPGSSLHandler(PGSSLHandler handler) { > > pgsslhandler=handler;} > > > > > > abstract class PGSSLHandler { > > > > public static final int STANDARD=0; > > public static final int CUSTOMFACTORY=1; > > public static final int CUSTOMSTORE=2; > > > > abstract public int getHandleType(int conid); > > abstract public boolean getTrustAndSave(int conid); > > > > abstract public KeyStore getKeyStore(int conid); > > abstract public SSLSocketFactory getSSLSocketFactory(int conid); > > > > } > > How do you arrange for setPGSSLHandler to be called if you are in a > managed environment that does not know anything about the postgresql > driver beyond the standard JDBC interfaces? How about making it a static method? You could only provide one handler per JVM but that will probably do in most cases. > > The "conid" stuff looks really grotty. How do you coordinate the > URL-level configuration with the PGSSLHandler implementation? That coordination is up to the user. He provides the conid in the URL and the driver just forwards it to the handler method. I don't see a problem here. > Why is anything but getSSLSocketFactory() needed? You can implement > whatever keystore/truststore policy you want via a SSLSocketFactory. I just thought it would be a nice feature because it spares people a lot of work, nothing else ;-) > The only new thing there is really the conid stuff, and I'd rather deal > with classloader issues (specify the class by name, loaded by the > driver) than have to deal with managing magic opaque unique > configuration keys and a postgresql-specific interface. The way I thought about it was that the connection just forwards the conid to makeSSL. Then there is no need for the driver to manage it. I thought - after reading previous posts about this - loading a user class would not be an option because some environments might not allow the driver to do so? Uli