在我的Android应用程序中,我可以使用本地wifi连接到此网址,没有任何问题:
https://didgahmobile.chargoon.net/
然而,当我尝试通过互联网连接时,例如使用移动数据或通过代理连接,我在Android应用程序中得到SSLHandshakeException
。桌面和移动Chrome浏览器也会显示消息"Your connection is not private"
。
javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
我已检查过服务器防火墙,对IP地址没有限制。
我的另一个https
网址也有一些不同的情况。在这种情况下,我第一次通过本地wifi连接后,我可以通过代理或移动日期进行连接,但是在全新安装后连接或使用移动数据或代理清除数据会引发相同的SSLHandshakeException
。
那么问题是什么?
答案 0 :(得分:0)
如果您使用android 7,请检查此项,因为您必须添加一些配置:
<network-security-config>
<domain-config>
<domain includeSubdomains="true">yourDomain.com</domain>
<!-- like: didgahmobile.chargoon.net -->
<trust-anchors>
<!-- Trust preinstalled CAs -->
<certificates src="system" />
<!-- Additionally trust user added CAs -->
<certificates src="user" />
</trust-anchors>
</domain-config>
</network-security-config>
<application
android:name="yourappname"
...
android:networkSecurityConfig="@xml/network_security_config">