nativescript-community / nativescript-community/https
Error: Trust anchor for certification path not found
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Vue
- Estrelas
- 52
- Forks
- 40
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece pela configuração do webpack para copiar o certificado e pela chamada de https.enableSSLPinning; verifique como o caminho .cer é empacotado no Android e compare-o com as expectativas documentadas do plugin para o certificado. Reproduza o GET no simulador e em um dispositivo físico e confirme então que a solicitação é bem-sucedida sem SSLHandshakeException.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- android, javascript
- Domínio
- api, security
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100