面对“无法与对等方安全通信:没有通用的加密算法。”击中在特定JRE上运行的Java Rest API时发生错误

时间:2019-04-10 10:24:51

标签: java ssl ssl-certificate jetty tls1.2

我使用嵌入式Jetty服务器并使用https创建了一个Rest API,以确保安全。 我们正在使用客户端特定的JRE来运行API。当我在使用Firefox浏览器的https上访问API时,出现以下错误:

无法与对等方安全地通信:没有通用的加密算法。错误代码:SSL_ERROR_NO_CYPHER_OVERLAP

但是,当我更改JRE并使用常用的JRE时,它将开始正常工作。两个JRE的版本相同,即1.8

                HttpConfiguration https = new HttpConfiguration();
        https.addCustomizer(new SecureRequestCustomizer());

        SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStore(keyStore);
        sslContextFactory.setKeyStorePassword("changeit");
        sslContextFactory.setKeyManagerPassword("changeit");
        sslContextFactory.setCertAlias("selfsignlatest");
        sslContextFactory.setNeedClientAuth(true);
        sslContextFactory.setTrustStore(keyStore);
        sslContextFactory.setTrustStorePassword("changeit");

        ServerConnector sslConnector = new ServerConnector(server,
                 new SslConnectionFactory(sslContextFactory, "http/1.1"),
                 new HttpConnectionFactory(https));
        sslConnector.setPort(9008);

         //----Setting connectors in server--------------
         server.setConnectors(new Connector[] { connector, sslConnector});

0 个答案:

没有答案