javax.net.ssl.SSLHandshakeException:cert.CertPathValidatorException:Trust anchor for certification path not found -error in Cordova for Android

江枫思渺然 提交于 2019-12-31 05:13:11

问题


I have integrated Cordova-plugin-client-certificate-addictic in a Cordova app. It’s working great in iPhone but when I run app on Android it’s not working. Error message I am getting in Android is: java.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException:Trust anchor for certification path not found.

Should I need to do some additional stuff for Android, I searched on stack overflow and on github nothing worked so far. Please suggest.


回答1:


After trying various solutions from various post, it did not work. Then i was start doing hit and trial method and one of them worked, below is the detail for same:

open project in android studio and Open the ClientCertificate.java from src folder of plugin.

step 1:go to line#60 and comment this line // InputStream astream = new FileInputStream(initialFile); and put this new line: InputStream astream = cordova.getActivity().getApplicationContext().getAssets().open(p12path);

step2: go to line# // p12path = a.getString(0); and put this new line# p12path = "www/" + a.getString(0);



来源:https://stackoverflow.com/questions/51089586/javax-net-ssl-sslhandshakeexceptioncert-certpathvalidatorexceptiontrust-anchor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!