Why am I getting an exception javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated?

前端 未结 4 1200
臣服心动
臣服心动 2021-01-30 18:01

I\'m using Apache HttpComponents HttpClient(4.0.1) to make a HTTPS call, but I\'m this exception as the response:

 javax.net.ssl.SSLPeerUnverifiedException: peer         


        
4条回答
  •  遇见更好的自我
    2021-01-30 18:18

    as mentioned above either you import the certificate

    1. Start command prompt in directory which you have placed certificate (e.g. XYZ.cer)
    2. Run following command just change the active jre path (and please notice ~ symbol )
    3. keytool -import -alias XYZ -file XYZ.cer -keystore C:/Program~1/Java/jdk1.6.0_23/jre/lib/security/cacerts -storepass changeit

                                 OR
      

    use your own trust manager http://tech.chitgoks.com/2011/04/24/how-to-avoid-javax-net-ssl-sslpeerunverifiedexception-peer-not-authenticated-problem-using-apache-httpclient/

提交回复
热议问题