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