Is it possible to get Java to ignore the “trust store” and just accept whatever SSL certificate it gets?

后端 未结 5 543
暖寄归人
暖寄归人 2020-11-28 08:36

I am trying to write an SSL client that sends mail using the javax.mail API. The problem I am having is that the server request that I use SSL, but the server is also config

5条回答
  •  独厮守ぢ
    2020-11-28 09:14

    Try this (answer to question 2):

    System.setProperty("javax.net.ssl.trustStore", "/path/to/truststore");
    

    You can also specify this as an additional command line parameter:

    java -Djavax.net.ssl.trustStore=/path/to/truststore 
    

    On Fedora this could be the system wide java trust store in /etc/pki/java/cacerts

提交回复
热议问题