title: Can a Java key store import a key pair generated by OpenSSL?
body: <p>I generate a certification key with openssl.  Here is my command:</p>
  
  <blockquote>
    <p>openssl genrsa -des3 -out enc_key.pem 1024</p>
  </blockquote>
  
  <p>I export into cer file, then with java keytool I import into java keystore (jks).</p>
  
  <p>The keystore sounds good. I can load the keystore from my java app.</p>
  
  <p>The problem is when client connect to the server (In this case is FTP server, not web server, and I use apache mina), the exception occured:</p>
  
  <blockquote>
    <p>javax.net.ssl.SSLHandshakeException: SSL handshake failed.
        at org.apache.mina.filter.ssl.SslFilter.messageReceived(SslFilter.java:433)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
        at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)</p>
  </blockquote>
  
  <p>...</p>
  
  <blockquote>
    <p>Caused by: javax.net.ssl.SSLHandshakeException: no cipher suites in common
        at com.sun.net.ssl.internal.ssl.Handshaker.checkThrown(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.checkTaskThrown(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.writeAppRecord(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.wrap(Unknown Source)
        at javax.net.ssl.SSLEngine.wrap(Unknown Source)</p>
  </blockquote>
  
  <p>...</p>
  
  <blockquote>
    <p>Caused by: javax.net.ssl.SSLHandshakeException: no cipher suites in common
        at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)</p>
  </blockquote>
  
  <p>There is a few things that I want to ask:</p>
  
  <ol>
  <li>What is the cipher of certification that I generate with openssl?  How can we know? maybe by command line openssl xxx?</li>
  <li>I go to <a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#AppA" rel="noreferrer">http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#AppA</a>.  And I put SSL_RSA_xxx to enabled cipher suites, but still can't work (I put SSL_RSA because it the SSL is using ssl implisit, and genrsa, just my opinion genrsa is generate RSA).  Is it correct?</li>
  <li>Anybody knows the solution?</li>
  <li>Or, anybody knows how to generate the standard keystore from openssl command line until can be used in java app (off course with the cipher).  Because right now I can generate the certification from openssl and export keystore java, but I don't know what is the cipher that I used and how I use in the java app.  Note:  I can run if the keystore is generate directly FROM java.  Right now the problem is if the keystore generated by java keytool from certification like openssl (and other maybe).</li>
  </ol>
  
  <p>Any help will be appreciated! Thanks</p>