在Sprint Boot上启用带有自签名证书的HTTPS

时间:2018-04-01 15:35:02

标签: java

我试图在Spring Boot 1.4(和2.0.X)上使用HTTPS启动Web服务器。但是我无法连接到已启动的服务器。

这是我的步骤:

  1. 将SSL属性添加到application.yml
  2.      server:
           ssl:
             enabled: true
             key-store: classpath:keystore.jks
             key-store-password: password
             key-password: password
             key-alias: tomcat
           port: 8443
    
    1. 在src / main / resources上生成自签名证书

      `keytool -genkey -alias tomcat -keyalg RSA -keystore keystore.jks

    2. 运行申请后

       `mvn clean install && java -jar target/audiochat.war
      

      然后在浏览器https://localhost:8433(Chrome,Firefox,Edge)

         ERR_SSL_VERSION_OR_CIPHER_MISMATCH
      

      我试图测试SSL握手

       openssl s_client -connect localhost:8443
      CONNECTED(000001A8)
      ---
      no peer certificate available
      ---
      No client certificate CA names sent
      ---
      SSL handshake has read 7 bytes and written 308 bytes
      ---
      New, (NONE), Cipher is (NONE)
      Secure Renegotiation IS NOT supported
      Compression: NONE
      Expansion: NONE
      No ALPN negotiated
      SSL-Session:
          Protocol  : TLSv1.2
          Cipher    : 0000
          Session-ID:
          Session-ID-ctx:
          Master-Key:
          Key-Arg   : None
          PSK identity: None
          PSK identity hint: None
          SRP username: None
          Start Time: 1522596727
          Timeout   : 300 (sec)
          Verify return code: 0 (ok)
      ---
      28412:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:769:
      

      有关在SpringBoot上正确设置HTTPS的任何想法吗?

0 个答案:

没有答案