4 Replies Latest reply: Aug 11, 2012 8:48 PM by EJP RSS

    SSL connection between aplication and database

    923096

      Hi

      I try to connect aplication and database using ssl. OK I try do :

      listener.ora

      *# listener.ora Network Configuration File: C:\app\Marian\product\11.2.0\dbhome_1\network\admin\listener.ora*
      *# Generated by Oracle configuration tools.*

      SID_LIST_LISTENER =
      *(SID_LIST =*
      *(SID_DESC =*
      *(SID_NAME = CLRExtProc)*
      *(ORACLE_HOME = C:\app\Marian\product\11.2.0\dbhome_1)*
      *(PROGRAM = extproc)*
      *(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Marian\product\11.2.0\dbhome_1\bin\oraclr11.dll")*
      *)*
      *)*

      LISTENER =
      *(DESCRIPTION_LIST =*
      *(DESCRIPTION =*
      *(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))*
      *(ADDRESS = (PROTOCOL = TCPS)(HOST = localhost)(PORT = 1521))*
      *)*
      *)*

      WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/server/wallet/path/)))
      SSL_CLIENT_AUTHENTICATION=FALSE

      ADR_BASE_LISTENER = C:\app\Marian

      sqlnet.ora

      **# sqlnet.ora Network Configuration File: C:\app\Marian\product\11.2.0\dbhome_1\network\admin\sqlnet.ora**
      **# Generated by Oracle configuration tools.**

      **# This file is actually generated by netca. But if customers choose to**
      **# install "Software Only", this file wont exist and without the native**
      **# authentication, they will not be able to connect to the database on NT.**

      **SQLNET.AUTHENTICATION_SERVICES= (NTS)**

      **NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)**

      **WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/server/wallet/path/)))**
      **SSL_CLIENT_AUTHENTICATION=FALSE**

      and my client code

      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.SQLException;
      import java.util.Properties;


      *public class SSL {*
      * public static void main (String []args)*
      * {*
      * String url =*
      * "jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCPS)(HOST = localhost)(PORT = 1521)))";*
      * Properties props = new Properties();*
      * props.setProperty("user", "marian");*
      * props.setProperty("password", "marian");*
      * props.setProperty("oracle.net.ssl_cipher_suites","(SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5,SSL_DH_anon_WITH_DES_CBC_SHA)");*
      * try {*
      * Connection conn=DriverManager.getConnection(url,props);*
      * } catch (SQLException e) {*
      * // TODO Auto-generated catch block*
      * e.printStackTrace();*
      * }*
      * }*

      *}*

      And I get error

      java.sql.SQLException: Wyjątek we-wy: Remote host closed connection during handshake
      * at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)*
      * at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)*
      * at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)*
      * at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)*
      * at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:494)*
      * at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)*
      * at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)*
      * at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)*
      * at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)*
      * at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:465)*
      * at java.sql.DriverManager.getConnection(Unknown Source)*
      * at java.sql.DriverManager.getConnection(Unknown Source)*
      * at SSL.main(SSL.java:17)*

      Edited by: user8894354 on 2012-08-09 14:27