X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E59BAD1B8BC for ; Mon, 22 Sep 2003 04:06:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 25694-10 for ; Mon, 22 Sep 2003 01:06:27 -0300 (ADT) Received: from mail.xythos.com (unknown [206.14.210.116]) by svr1.postgresql.org (Postfix) with ESMTP id 35940D1B576 for ; Mon, 22 Sep 2003 01:06:26 -0300 (ADT) Received: from ravms by mail.xythos.com with mail-ok (Exim 3.36 #3) id 1A1Hxx-0006kS-00; Mon, 22 Sep 2003 04:06:25 +0000 Received: from h-66-166-17-184.snvacaid.covad.net ([66.166.17.184] helo=xythos.com) by mail.xythos.com with asmtp (Exim 3.36 #3) id 1A1Hxx-0006kB-00; Mon, 22 Sep 2003 04:06:25 +0000 Message-ID: <3F6E7540.8080400@xythos.com> Date: Sun, 21 Sep 2003 21:06:24 -0700 From: Barry Lind User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Angel Todorov Cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC with SSL References: <3F6DC71A.7050003@acm.org> In-Reply-To: <3F6DC71A.7050003@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Envelope-To: atodorov@acm.org, pgsql-jdbc@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/219 X-Sequence-Number: 8360 Can you provide the steps you used to create and import your cert? thanks, --Barry Angel Todorov wrote: > Hello, > I have a question regarding the SSL support of the development JDBC3 > driver. I want to connect securely to a postgresql database . My > environment is the following: > > PostgreSQL server version: PostgreSQL 7.3.2 > OS on which the server is running: OpenBSD 3.3 > > --- from postgresql.conf --- > > ssl = true > > ---------------------------- > > I have also generated the needed certificates for the SSL support as > described in the PostgreSQL manual under" 3.7. Secure TCP/IP Connections > with SSL". > > The client enviroment is the following: > OS: Windows XP > JDK : j2sdk1.4.2_01 > jdbc driver: JDBC3, development version > IDE: Eclipse > > Normally, without SSL, the connectivity is O.K > > When enabled, the following exception is thrown: > > org.postgresql.util.PSQLException: An I/O error has occured while > flushing the output - Exception: javax.net.ssl.SSLHandshakeException: > sun.security.validator.ValidatorException: No trusted certificate found > > Here is also a small part of the stack trace: > -------------------------------------------------- > Caused by: sun.security.validator.ValidatorException: No trusted > certificate found > at sun.security.validator.SimpleValidator.buildTrustedChain(Unknown > Source) > at sun.security.validator.SimpleValidator.engineValidate(Unknown Source) > at sun.security.validator.Validator.validate(Unknown Source) > at > com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown > Source) > at > com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown > Source) > ... 16 more > End of Stack Trace > > at org.postgresql.core.PGStream.flush(PGStream.java:416) > at > org.postgresql.jdbc1.AbstractJdbc1Connection.openConnectionV3(AbstractJdbc1Connection.java:284) > > at > org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:213) > > at org.postgresql.Driver.connect(Driver.java:138) > at java.sql.DriverManager.getConnection(Unknown Source) > at java.sql.DriverManager.getConnection(Unknown Source) > at PostgreSQLSSL.main(PostgreSQLSSL.java:33) > java.lang.NullPointerException > at PostgreSQLSSL.main(PostgreSQLSSL.java:39) > Exception in thread "main" > ----------------------------------------------------- > > The code that generates the above Exception is : > > --- START ------ > > public static void main(String[] args) throws SQLException { > > Properties opt = new Properties(); > opt.setProperty("ssl", "true"); > opt.setProperty("user", username); > opt.setProperty("password", password); > > Connection db=null; > try { > Class driver=Class.forName("org.postgresql.Driver"); > db = DriverManager.getConnection(url, opt); > } catch (Exception e) { > e.printStackTrace(); > } > ------- END ------------ > > I have imported the server's certificate using the keytool successfully > , though the exception states that no *trusted* certificate is found. My > certificate is self-signed. Could it be the problem that the certificate > is not accepted (i.e i have to create it differently either on the > server side, or import it differently on the client side) ? Or maybe > there is a conflict between the PostgreSQL and JDBC3 versions? > > Thanks a lot in advance for your help. > > Regards, > > Angel > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html >