Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Trust anchor for certification path not found #82

Open
dpdragnev opened this issue May 6, 2021 · 0 comments
Open

Error: Trust anchor for certification path not found #82

dpdragnev opened this issue May 6, 2021 · 0 comments

Comments

@dpdragnev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant