【问题标题】:Undertow HTTPS listenerUndertow HTTPS 监听器
【发布时间】:2014-12-23 02:45:07
【问题描述】:

我正在尝试提供一个简单的“Hello world!”使用 Undertow 嵌入式服务器通过带有自签名证书的 HTTPS 响应。但是我在客户端(Chrome)上得到ERR_SSL_VERSION_OR_CIPHER_MISMATCH,在服务器日志中得到SSLHandshakeException: no cipher suites in common

似乎除了KeyManager[] 数组之外,我还需要提供 TLS 协议才能使用,但我找不到应该放在哪里。完整示例可在https://github.com/isopov/undertow-https-test/blob/master/src/main/java/com/sopovs/moradanen/UndertowHttpsTest.java 获得 而在https://github.com/isopov/undertow-https-test/blob/master/src/main/java/com/sopovs/moradanen/JettyHttpsTest.java 有使用 Jetty 服务器进行类似测试的示例(证明证书是好的)。

【问题讨论】:

    标签: java https undertow


    【解决方案1】:

    对代码的这种更改对我有用:

        SSLContext sslContext = SSLContext.getInstance("TLS");
        sslContext.init(getKeyManagers(), null, null);
    
        Undertow.builder().addHttpsListener(10443, "0.0.0.0", sslContext)...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 2015-11-12
      • 1970-01-01
      • 1970-01-01
      • 2023-02-05
      相关资源
      最近更新 更多