I am trying to create a server using SSL but I keep getting the following error:
"Server aborted:javax.net.ssl.SSLException: No available certificate or key corresponds to the SSL cipher suites which are enabled."
I am not sure if I am creating the certificates correctly. Here is my code. I am converting an old TCP Server to an SSL Server
// SSL Server import java.net.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.net.ServerSocketFactory; import javax.net.ssl.SSLServerSocketFactory; public class SSL_Server { public static void main(String[] args) { int port = 2018; ServerSocketFactory ssocketFactory = SSLServerSocketFactory.getDefault(); ServerSocket ssocket = null; System.out.println("SSL_Server started"); System.setProperty("javax.net.ssl.keyStore","mySrvKeystore"); System.setProperty("javax.net.ssl.keyStorePassword","123456"); final ExecutorService threadPool = Executors.newCachedThreadPool(); try { ssocket = ssocketFactory.createServerSocket(port); InetAddress myIP =InetAddress.getLocalHost(); System.out.println(myIP.getHostAddress()); while(true){ Socket aClient = ssocket.accept(); //create a new thread for every client threadPool.submit(new SSL_ClientHandler(aClient)); } } catch(Exception e) { System.err.println("Server aborted:" + e); } finally { try{ ssocket.close(); } catch (Exception e){ System.err.println("could not close connection properly" + e); } } System.out.println("connection was closed successfully"); } }