2

使用此代码:

import org.eclipse.jetty.server.*;
import org.eclipse.jetty.util.ssl.*;
import org.eclipse.jetty.util.log.*;

public class JettySSLFailure {

   public static void main(String[] args) throws Exception {
      Log.getRootLogger().setDebugEnabled(true);
      Server server = new Server();
      SslContextFactory sslContextFactory = new SslContextFactory();
      sslContextFactory.setKeyStorePath("trajan.jks");
      sslContextFactory.setKeyStoreType("JCEKS");
      sslContextFactory.setKeyStorePassword("welcome1");
      sslContextFactory.setCertAlias("trajanssl");
      sslContextFactory.setKeyManagerPassword("welcome1");
      SslConnectionFactory sslConnectionFactory =
              new SslConnectionFactory(
              sslContextFactory, "http/1.1");
      HttpConfiguration sslHttpConfig = new HttpConfiguration();
      HttpConnectionFactory httpConnectionFactory =
              new HttpConnectionFactory(sslHttpConfig);
      ServerConnector serverConnector =
              new ServerConnector(server, sslConnectionFactory,
              httpConnectionFactory);
      serverConnector.setPort(9999);
      server.addConnector(serverConnector);
      server.start();
   }
}

而这个密钥库https://sites.google.com/site/skissane/files/trajan.jks

还有这些 JAR:javax.servlet-3.0.0.v201112011016.jar jetty-http-9.0.4.v20130625.jar jetty-io-9.0.4.v20130625.jar jetty-server-9.0.4.v20130625.jar jetty- util-9.0.4.v20130625.jar

任何 SSL 连接尝试都会导致日志记录:javax.net.ssl.SSLHandshakeException: no cipher suites in common

有人知道我做错了什么吗?

4

0 回答 0