2017-10-18 284 views
0

連接時,在我的Android應用我可以連接到這個網址與本地的無線網絡沒有任何問題:出現SSLHandshakeException通過互聯網

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

檢查這一點,如果你usign 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"> 

來源:Trusted certificates

+0

我在所有的Android版本中這個問題。然而,我用這個解決方案,它並沒有解決在Android 8和更早的問題。謝謝。 –