title: Configuring SSL connection for Oracle 12
body: <p>I am trying to configure an Oracle 12 instance to allow (and later force) SSL-encrypted connections (only encryption, no authentication). </p>
  
  <p>I did like described in <a href="http://www.oracle.com/%20technetwork/%20database/%20enterprise-edition/%20wp-oracle-jdbc-thin-ssl-130128.pdf" rel="nofollow">SSL With Oracle JDBC Thin Driver</a>:</p>
  
  <p>Changed in <code>listener.ora</code> from</p>
  
  <pre><code>LISTENER =
    (DESCRIPTION_LIST =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
      )
    )
  </code></pre>
  
  <p>to</p>
  
  <pre><code>LISTENER =
    (DESCRIPTION_LIST =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCPS)(HOST = myhost)(PORT = 2484))
      )
    )
  
  WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/tmp/oracle_wallet_tmp)))
  SSL_CLIENT_AUTHENTICATION=FALSE
  </code></pre>
  
  <p>and also added the last two lines to sqlnet.ora.</p>
  
  <p>I then created the wallet with </p>
  
  <pre><code>orapki wallet create -wallet /tmp/oracle_wallet_tmp  -pwd test1234
  </code></pre>
  
  <p>and restarted the listener with</p>
  
  <pre><code>lsnrctl stop
  lsnrctl start
  </code></pre>
  
  <p>The non-encryption session still works fine.
  But </p>
  
  <p>But when trying to connect via JDBC on an encrypted connection I get</p>
  
  <pre><code>Exception in thread "main" java.sql.SQLRecoverableException: I/O-Fehler: Received fatal alert: handshake_failure
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:682)
    at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:711)
    at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:385)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:558)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:187)
    at orassl.Orassl.&lt;init&gt;(Orassl.java:23)
    at orassl.Orassl.main(Orassl.java:38)
  Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
    at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:702)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
    at oracle.net.ns.Packet.send(Packet.java:419)
    at oracle.net.ns.ConnectPacket.send(ConnectPacket.java:241)
    at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:151)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:263)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
    ... 8 more
  </code></pre>
  
  <p>The listener log file <code>listener/alert/log.xml</code> only tells me</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;msg time='2014-03-04T14:03:19.906+01:00' org_id='oracle' comp_id='tnslsnr'
   type='UNKNOWN' level='16' host_id='myhost'
   host_addr='hostip'&gt;
   &lt;txt&gt;04-MAR-2014 14:03:19 * &amp;lt;unknown connect data&amp;gt; * 12561
   &lt;/txt&gt;
  &lt;/msg&gt;
  &lt;msg time='2014-03-04T14:03:19.907+01:00' org_id='oracle' comp_id='tnslsnr'
   type='UNKNOWN' level='16' host_id='myhost'
   host_addr='hostip'&gt;
   &lt;txt&gt;TNS-12561: TNS:unknown error
   &lt;/txt&gt;
  &lt;/msg&gt;
  &lt;msg time='2014-03-04T14:03:19.933+01:00' org_id='oracle' comp_id='tnslsnr'
   type='UNKNOWN' level='16' host_id='myhost'
   host_addr='hostip'&gt;
   &lt;txt&gt;04-MAR-2014 14:03:19 * &amp;lt;unknown connect data&amp;gt; * 12561
   &lt;/txt&gt;
  &lt;/msg&gt;
  &lt;msg time='2014-03-04T14:03:19.933+01:00' org_id='oracle' comp_id='tnslsnr'
   type='UNKNOWN' level='16' host_id='myhost'
   host_addr='hostip'&gt;
   &lt;txt&gt;TNS-12561: TNS:unknown error
   &lt;/txt&gt;
  &lt;/msg&gt;
  </code></pre>
  
  <p>The client connects with the following:</p>
  
  <pre class="lang-java prettyprint-override"><code>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)");
  props.setProperty("user", "dbuser");
  props.setProperty("password", "dbpass");
  final Connection c= DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=hostip)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=mysid)))", props );
  </code></pre>
  
  <p>What am I still doing wrong?</p>