Accept server's self-signed ssl certificate in Java client

后端 未结 12 1481
日久生厌
日久生厌 2020-11-22 00:04

It looks like a standard question, but I couldn\'t find clear directions anywhere.

I have java code trying to connect to a server with probably self-signed (or expir

12条回答
  •  伪装坚强ぢ
    2020-11-22 00:41

    The accepted answer is fine, but I'd like to add something to this as I was using IntelliJ on Mac and couldn't get it to work using the JAVA_HOME path variable.

    It turns out Java Home was different when running the application from IntelliJ.

    To figure out exactly where it is, you can just do System.getProperty("java.home") as that's where the trusted certificates are read from.

提交回复
热议问题