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 D8BFAD1B4F9 for ; Sun, 21 Sep 2003 15:44:04 +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 96766-06 for ; Sun, 21 Sep 2003 12:43:54 -0300 (ADT) Received: from da7ec.unt0.etta.i-u.de (da7ec.unt0.etta.i-u.de [212.126.218.126]) by svr1.postgresql.org (Postfix) with ESMTP id 9147CD1B4F5 for ; Sun, 21 Sep 2003 12:43:53 -0300 (ADT) Received: from mailer.i-u.de ([212.126.209.130]) by da7ec.unt0.etta.i-u.de with esmtp (Exim 3.36 #2 (Debian)) id 1A16NM-00077t-00 for ; Sun, 21 Sep 2003 17:43:52 +0200 Received: from acm.org ([172.16.13.40]) by mailer.i-u.de with Microsoft SMTPSVC(5.0.2195.6713); Sun, 21 Sep 2003 17:43:50 +0200 Message-ID: <3F6DC71A.7050003@acm.org> Date: Sun, 21 Sep 2003 17:43:22 +0200 From: Angel Todorov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20030916 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: JDBC with SSL X-Enigmail-Version: 0.76.7.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 Sep 2003 15:43:50.0039 (UTC) FILETIME=[26F1B270:01C38057] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/218 X-Sequence-Number: 8359 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