nativescript-community / nativescript-community/https
Error: Trust anchor for certification path not found
还没有人认领这个 Issue。
- 主要语言
- Vue
- 星标
- 52
- 派生
- 40
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello,
Following the documentation I am trying to implement a simple call to test the plugin but I when I execute the call I get the following error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
I am testing it on an Android simulator, but I get the same error on a physical device as well.
Here is my code:
adding the cert to webpack
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
{ from: { glob: "**/*.png" } },
{ from: { glob: "certs/*.cer" } },
]
enable the pinning
const dir = knownFolders.currentApp().getFolder('certs');
const cert = dir.getFile('<cert_name>.cer').path;
https.enableSSLPinning({
host: <domain>',
certificate: cert
});
then
https.request({
url: '<url>',
method: 'GET'
}).then((res) => {
console.log(res.statusCode);
}).catch((err) => {
console.error(err);
});
The code runs without an issue and the certificate is valid. I checked it using the openssl x509 -in <cert.cer> -text -noout command.
Am I missing something?
Thank you
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从复制证书的 webpack 配置和 https.enableSSLPinning 调用开始;验证 .cer 路径在 Android 上是如何打包的,并将其与插件文档中记录的证书要求进行比较。在模拟器和实体设备上重现 GET,然后确认请求在没有 SSLHandshakeException 的情况下成功。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, javascript
- 领域
- api, security
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100