Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzpIo-0006Ha-La for pgsql-jdbc@arkaria.postgresql.org; Mon, 28 Jan 2013 14:03:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TzpIn-0007w4-LP for pgsql-jdbc@arkaria.postgresql.org; Mon, 28 Jan 2013 14:03:13 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzpIn-0007vv-19 for pgsql-jdbc@postgresql.org; Mon, 28 Jan 2013 14:03:13 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TzpIk-0004tZ-6s for pgsql-jdbc@postgresql.org; Mon, 28 Jan 2013 14:03:12 +0000 Received: from 172.24.2.119 (EHLO szxeml210-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id AWU79283; Mon, 28 Jan 2013 22:03:03 +0800 (CST) Received: from SZXEML414-HUB.china.huawei.com (10.82.67.153) by szxeml210-edg.china.huawei.com (172.24.2.183) with Microsoft SMTP Server (TLS) id 14.1.323.7; Mon, 28 Jan 2013 22:03:01 +0800 Received: from blrprnc07ns (10.18.96.96) by SZXEML414-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.1.323.7; Mon, 28 Jan 2013 22:03:00 +0800 From: Hari Babu To: Subject: JDBC connection test with SSL on PG 9.2.1 server Date: Mon, 28 Jan 2013 19:33:00 +0530 Message-ID: <00f901cdfd60$2f17d070$8d477150$@kommi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac39YCybyIei7VmqT0aHNh9RBaEaOA== Content-Language: en-us x-cr-hashedpuzzle: C1w/ C+MN DR+T Djxn ERU5 Eczp FEqC F+oR F/g0 GyBl G0kg HBbv Iza6 J0eL KJIy KMZ5; 1; cABnAHMAcQBsAC0AagBkAGIAYwBAAHAAbwBzAHQAZwByAGUAcwBxAGwALgBvAHIAZwA=; Sosha1_v1; 7; {6BAE623C-6333-42E2-BEEE-2CE58825AE14}; aABhAHIAaQBiAGEAYgB1AC4AawBvAG0AbQBpAEAAaAB1AGEAdwBlAGkALgBjAG8AbQA=; Mon, 28 Jan 2013 14:02:57 GMT; SgBEAEIAQwAgAGMAbwBuAG4AZQBjAHQAaQBvAG4AIAB0AGUAcwB0ACAAdwBpAHQAaAAgAFMAUwBMACAAbwBuACAAUABHACAAOQAuADIALgAxACAAcwBlAHIAdgBlAHIA x-cr-puzzleid: {6BAE623C-6333-42E2-BEEE-2CE58825AE14} X-Originating-IP: [10.18.96.96] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -3.7 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org While testing PostgreSQL JDBC java client to connect to the PG 9.2.1 database server using SSL. we got the following behavior. The test steps as below: url = "jdbc:postgresql://" + "10.145.98.227" + ':' + "8707" + '/' + "POSTGRES"; Properties props = new Properties(); props.setProperty("user", "CLIENT"); props.setProperty("password", "1234@QWER"); props.setProperty("ssl", "true"); System.setProperty("javax.net.ssl.trustStore", "193store"); System.setProperty("javax.net.ssl.keyStore", "193client.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "qwerty"); System.setProperty("javax.net.ssl.keyStorePassword", "qwerty"); /*Begin the first ssl connection*/ conn1 = DriverManager.getConnection(url, props); System.out.println("Connection1 successful!"); System.setProperty("javax.net.ssl.trustStore", "193store"); System.setProperty("javax.net.ssl.keyStore", "193client.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "qwerty"); System.setProperty("javax.net.ssl.keyStorePassword", "wrongpassword"); /*Begin the second ssl connection*/ conn2 = DriverManager.getConnection(url, props); System.out.println("Connection2 successful!"); Before first connection we set "System.setProperty("javax.net.ssl.keyStorePassword", "qwerty");" qwerty is the right password and before second SSL connection we set "System.setProperty("javax.net.ssl.keyStorePassword", "wrongpassword");" wrongpassword is the wrong password. we expect the first SSL connection will be successful and second failed because of wrong password, but actually we get two successful SSL connections. We found that if the first SSL connections password set right, all the following SSL connections are fine ,even set wrong keystroke password. 1. Is this a defect about JDBC? 2. Is it SSL behavior to authenticate only once? 3. Is it system property behavior can be set only once. 4. Is it because of any other problems? please give your suggestions? Regards, Hari babu. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc