nativescript-community / nativescript-community/https

Error: Trust anchor for certification path not found

Ouverte
#82 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Vue
Étoiles
52
Forks
40
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par la configuration webpack de copie du certificat et l'appel à https.enableSSLPinning ; vérifiez comment le chemin .cer est empaqueté sur Android et comparez-le aux attentes documentées du plugin concernant le certificat. Reproduisez le GET dans le simulateur et sur un appareil physique, puis confirmez que la requête aboutit sans SSLHandshakeException.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
android, javascript
Domaine
api, security
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.