android 屏蔽证书验证 CertPathValidatorException: Trust anchor for certification path not found
2017-08-04 15:54
615 查看
android 使用https时 证书如果是用来测试的会爆出下面问题:
解决办法是将证书验证屏蔽掉:
注意:在上线的时候如需验证需要将代码注释掉!!!!
有问题之处烦请在留言中指出,非常感谢。
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
解决办法是将证书验证屏蔽掉:
HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection(); urlConnection.setRequestMethod("POST"); urlConnection.setSSLSocketFactory(context.getSocketFactory()); urlConnection.setHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } });
注意:在上线的时候如需验证需要将代码注释掉!!!!
有问题之处烦请在留言中指出,非常感谢。
相关文章推荐
- andorid HTTPS 不需要证书 VolleyEror: com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not fou
- https 证书校验异常 Trust anchor for certification path not found
- retrofit2中ssl的Trust anchor for certification path not found问题,屏蔽https验证
- Trust anchor for certification path not found.问题解决(关于okhttputils的BUG)
- Smack报错:Trust anchor for certification path not found
- Smack报错:Trust anchor for certification path not found
- Https报错java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
- com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time:
- 在dev环境访问self assigned的https服务器,报Trust Anchor not found for Android SSL Connection
- android:ClassNotFoundException for Activity class的解决方法
- android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): T
- android ksoap2 访问https javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorExce
- Android开发之~java.lang.ClassNotFoundException: Didn't find class "android.view.x" on path: ...
- java.lang.ClassNotFoundException: Didn't find class "android.os.PersistableBundle" on path: DexPathL
- Android应用程序启动时发生AndroidRuntime : ClassNotFoundException for Activity class的解决方法
- Android应用程序启动时发生AndroidRuntime : ClassNotFoundException for Activity class的解决方法
- Android应用程序启动时发生AndroidRuntime : ClassNotFoundException for Activity class的解决方法
- Caused by: java.lang.ClassNotFoundException: Didn’t find class on path apk Android Studio解决方案
- com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException
- WAS导入证书--错误提示:java.security.cert.CertPathValidatorException: Certificate chaining error