【问题标题】:javax.net.ssl.SSLHandshakeException:cert.CertPathValidatorException:Trust anchor for certification path not found -error in Cordova for Androidjavax.net.ssl.SSLHandshakeException:cert.CertPathValidatorException:Trust anchor for certificate path not found - Android Cordova 中的错误
【发布时间】:2018-06-28 18:53:21
【问题描述】:
我已在 Cordova 应用程序中集成了 Cordova-plugin-client-certificate-addictic。它在 iPhone 上运行良好,但当我在 Android 上运行应用程序时,它无法正常工作。
我在 Android 中收到的错误消息是:
java.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。
我是否需要为 Android 做一些额外的事情,我在堆栈溢出和 github 上进行了搜索,到目前为止没有任何效果。请提出建议。
【问题讨论】:
标签:
android
iphone
cordova
cordova-plugins
【解决方案1】:
在尝试了各种帖子的各种解决方案后,它没有奏效。
然后我开始做命中和试验方法,其中一个有效,下面是相同的细节:
在android studio中打开项目并从插件的src文件夹中打开ClientCertificate.java。
第 1 步:转到第 60 行并注释此行 // InputStream astream = new FileInputStream(initialFile);
并把这个新行: InputStream astream = cordova.getActivity().getApplicationContext().getAssets().open(p12path);
step2: go to line# // p12path = a.getString(0);
并把这个新行# p12path = "www/" + a.getString(0);