nativescript-community / nativescript-community/https

Error: Trust anchor for certification path not found

オープン
#82 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

証明書をコピーする webpack 設定と https.enableSSLPinning の呼び出しから始め、Android 上で .cer パスがどのようにパッケージ化されるかを確認し、プラグインに記載されている証明書の要件と比較します。シミュレーターと実機で GET を再現し、その後、SSLHandshakeException が発生せずにリクエストが成功することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, javascript
領域
api, security
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。