SSL trust and client authentication support

From: Neil Macneale <mac4-pg(at)theory(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: SSL trust and client authentication support
Date: 2006-02-23 00:54:20
Message-ID: 43FD07BC.3040305@theory.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I've attached a few files which add more robust SSL behavior for pgjdbc.
The patch is against the current head of the CVS tree, and it contains
changes to MakeSSL, and provides a new SSLSocketFactory class called
ValidatingFactory.

Also attached are two classes which are examples of how to use the
validating factory. One example shows how you could verify the validity
of the server connection, while providing no client authentication. The
second verifies the identity of the server, and provides a client
certificate to the server for validation. Also in header comments of
those files are some examples of how to use the keytool command to
create client keystores.

Currently the ValidatingFactory throws an Exception for any error. This
in turn results in an invokation exception being thrown in MakeSSL. It's
not ideal, but the error messages are generally complete enough to
diagnose your problem.

There is one limitation worth mentioning. This code assumes that your
subkeys use the same password as your keystore. This is primarily
because the KeyManagerFactory does not provide a mechanism to supply a
password for each alias. I'm not sure that there is a work around for
this. More investigation is required.

Hopefully this will provide a decent starting point for SSL support for
pgjdbc. I'd be happy to answer any questions you may have.

Enjoy!
Neil

Attachment Content-Type Size
patch.txt text/plain 14.2 KB
ServerValidate.java text/x-java 2.6 KB
ServerAndClientValidate.java text/x-java 2.9 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Hugo Sacramento 2006-02-24 17:39:09 Retrieve Query
Previous Message Shah, Anuj R 2006-02-22 18:40:10 One more: Function does not exist error