0

So im trying to write an https server with Java over sockets and i am having problems with the Cipher suites because when i try to start the server i get an SSLHandshakeException: no cipher suites in common even though chrome supports

ECDHE-ECDSA-AES128-GCM-SHA256

and in the output of the Method getDefaultCipherSuites() you can find

TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

which i dont know it seems like its pretty much the same only different formatting and here is the Code

    SSLServerSocketFactory sslServerSocketFactory =(SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
    SSLServerSocket serverSocket = (SSLServerSocket) sslServerSocketFactory.createServerSocket(443);
    while (true)
    {
        SSLSocket client =(SSLSocket) serverSocket.accept();
        BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));

        HttpRequest httpRequest= new HttpRequest(in);

        HttpResponse httpResponse = new HttpResponse();
        httpResponse.setHTTPver(httpRequest.getHTTPver());
        httpResponse.setStatusCode("200 OK");
        httpResponse.setContent_Type("text/html");
        httpResponse.setResponseMessage("Hallo Client!");
        httpResponse.setAccess_Control_Allow_Origin(httpRequest.getOrigin());

        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));

        httpResponse.SendResponse(out);

        out.close();
        in.close();
        client.close();
    }
Sunil Kanzar
  • 1,244
  • 1
  • 9
  • 21
Digger2011
  • 26
  • 6
  • Possible duplicate of [Key generation requirements for TLS ECDHE-ECDSA-AES128-GCM-SHA256](http://stackoverflow.com/q/10185110/5221149) – Andreas Apr 10 '17 at 17:03
  • Though I don't even see *where* you are supplying the key. – Andreas Apr 10 '17 at 17:04
  • i dont really see what supplying the Key has to do with this and atleast from the site where i looked into it worked with the getDefault() call and even if its the problem with the key wouldnt the error be something with certificat? – Digger2011 Apr 10 '17 at 17:22
  • Digger2011: no; if Java SSL/TLS server does not have a privatekey&certificate of the correct type to implement at least one otherwise acceptable ciphersuite offered by a client, the result is alert 40 and exception 'no cipher suites in common'. Poss dupe http://stackoverflow.com/questions/15405581/no-cipher-suites-in-common-while-establishing-a-secure-connection and http://stackoverflow.com/questions/15076820/java-sslhandshakeexception-no-cipher-suites-in-common – dave_thompson_085 Apr 10 '17 at 21:41

0 Answers0