Android仿真器“链验证失败";使用自签名证书连接开发人员计算机 [英] Android Emulator "Chain Validation Failed" connecting developers machine with self-signed cert

查看:312
本文介绍了Android仿真器“链验证失败";使用自签名证书连接开发人员计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android Studio项目,该项目调用基于Web的API服务.当服务代码在dev,qa,prod等中时.没有证书问题,但是当尝试在Web api开发人员框中单击以测试新功能/错误修复/等等时,我得到:

I have an Android Studio project that calls a web based API service. When the service code is in dev, qa, prod etc. There are NO certificate issues but when trying to hit the web api developers box to test a new feature / bug fix / etc. I get:

由于错误而没有回复:

No reply because of error:

javax.net.ssl.SSLHandshakeException:链验证失败

javax.net.ssl.SSLHandshakeException: Chain validation failed

在com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:361)

at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:361)

我有从服务开发人员机器导出的自签名证书,没有私有密钥DER编码.我放到模拟器上,并安装"了该模拟器.但这行不通.

I had the self signed certificate exported from the service developers machine WITHOUT the private key DER encoded. I dropped onto the emulator and it "installed" but this did not work.

我接受了与上面相同的证书,然后将其复制到仿真的SD卡中.然后从模拟器中的安全设置安装.结果相同.链验证失败.

I took the same cert above and copied to the emulated sd card. Then installed from security settings in emulator. Same result. Chain validation failed.

现在,我的安全/证书知识非常基础.我认为该错误实际上描述了问题所在.自签名证书中没有链条……但是我可能是错的.

Now my security / certificate knowledge is very basic. I think the error actually describes the problem. There is no chain in a self signed certificate...but I could be wrong.

无论如何,我该如何解决?

Regardless, how do I work around this?

我希望能够运行我的Android代码并在开发人员框中进行测试/调试等.

I desire to be able to run my Android code and hit the developers box for testing / debugging etc.

我读过这样的帖子,只是为了让公司环境阻止我访问开放SSL等网站.

I have read post like this one only to have the corporate environment I am in blocking the sites for open SSL etc.

https ://android.stackexchange.com/questions/61540/self-signed-certificate-install-claims-success-but-android-acts-as-if-cert-isn

我正在通过WebView访问该服务.

I am accessing the service through a WebView.

推荐答案

此问题的原因可能是设备的日期时间错误

A cause of this problem can be wrong date time of the device

这篇关于Android仿真器“链验证失败";使用自签名证书连接开发人员计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆