所以我试图用套接字编写带有Java的https服务器,我遇到了Cipher套件的问题,因为当我尝试启动服务器时,我得到一个SSLHandshakeException:没有共同的密码套件 即使chrome支持
ECDHE-ECDSA-AES128-GCM-SHA256
并在Method getDefaultCipherSuites()的输出中找到
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
我不知道它似乎只有不同的格式 这是代码
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();
}