Ignore certificate errors when requesting a URL in Java

后端 未结 5 1999
一个人的身影
一个人的身影 2020-12-19 23:35

I\'m trying to print a URL (without having a browser involved at all) but the URL is currently throwing the following:

javax.net.ssl.SSLHandshakeException: 
         


        
5条回答
  •  猫巷女王i
    2020-12-20 00:24

    On a related note: my mutual certifcate authentication with a WCF .net Web Service was causing issues in my test environment. I added these two lines to my code to fix the problem and allow me to work through the issue:

    //Uncomment this in case server demands some unsafe operations       
    System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");       
    
    //this command allowed me to see the detailed debugger log for detecting the
    //issue with my certs.
    System.setProperty("javax.net.debug","all");
    

    Here is a nice reference for dealing with SSL negotiation and certifcates in a Java/Windows/Unix world: Transport Layer Security (TLS) Renegotiation Issue Readme

提交回复
热议问题