Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 64D9619CDE14 for ; Mon, 5 Dec 2011 15:21:22 -0400 (AST) Received: from mag.webhome.hu ([212.52.168.15]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RXe6K-00086V-D7 for pgsql-jdbc@postgresql.org; Mon, 05 Dec 2011 19:21:22 +0000 Received: from [IPv6:::1] (mag.webhome.hu [127.0.0.1]) by mag.webhome.hu (Postfix) with ESMTPS id BDF371466 for ; Mon, 5 Dec 2011 19:21:04 +0000 (UTC) Message-ID: <4EDD199F.7030709@magwas.rulez.org> Date: Mon, 05 Dec 2011 20:21:03 +0100 From: =?UTF-8?B?TWFnb3PDoW55aSDDgXJww6Fk?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: JDBC with SSL References: <4EDC1031.2010607@ringerc.id.au> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/16 X-Sequence-Number: 22470 Maybe a take in the wrong direction, but have you checked that all certs are existing and valid throughout the certificate chain? I am talking about both the server and the client side. (Yes, you have already said that it does work with psql, so the question is whether all certs and the key are imported correctly into the keystore.) BTW I have found more convenient to use the same keystore for both the client cert/key and the trust anchors. On 12/05/2011 07:46 PM, Walter Hurry wrote: > On Mon, 05 Dec 2011 08:28:33 +0800, Craig Ringer wrote: > >> You don't need the SecurityManager enabled. You need the java.net.ssl >> properties for keyStore, keyStorePassword and keyStoreType set to point >> to your JECKS keystore, and need trustStore, trustStorePassword and >> trustStoreType set to point to the keystore you imported the database's >> certificate into, which is probably the same store in your case. > > > > Thanks for the guidance, Craig. I'm trying to use javax.net.ssl but I'm > still stuck. Sample below: > ------------------------------------------------------------- > $ java -Djavax.net.ssl.keyStore=$HOME/.postgresql/clientstore \ > -Djavax.net.ssl.keyStorePassword=changeit \ > -Djavax.net.ssl.keyStoreType="jks" \ > -Djavax.net.ssl.trustStore=$JAVA_HOME/lib/security/cacerts \ > -Djavax.net.ssl.trustStorePassword=changeit \ > -Djavax.net.ssl.trustStoreType="jks" \ > JDBCExample neptune misc > -------- PostgreSQL JDBC Connection Testing ------------ > PostgreSQL JDBC driver registered > Getting connection to jdbc:postgresql://neptune/misc > Connect failed: FATAL: connection requires a valid client certificate > ------------------------------------------------------------- > > Any idea what I am doing wrong? > > Thanks. > > >