java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。Android 2.3
问题内容:
在我的服务器(生产服务器)中,我具有goDaddy
ssl证书。我有iOS和Android应用程序都与服务器连接,iOS都没有问题连接,Android版本为4.
一切都很好,但是设备版本为2.3。我总是收到SSLHandshakeException。
我在Android开发人员页面(https://developer.android.com/training/articles/security-
ssl.html)上确实很喜欢。
然后,我看到了这个线程在谈论扩展密钥用法,但是在调试时,我得到了以下信息:
[2]: OID: 2.5.29.37, Critical: false
Extended Key Usage: [ "1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.2" ]
因此,我猜该证书不是“强制”扩展密钥用法。
此外,在此线程上还有其他一些可能的原因,例如日期/时间完全错误,这些原因都不存在。
考虑到这一点,我现在不知道问题可能在哪里。
有什么建议?
编辑: 下面的StackTrace:
08-04 16:54:30.139: W/System.err(4832): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
08-04 16:54:30.149: W/System.err(4832): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:161)
08-04 16:54:30.149: W/System.err(4832): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:664)
08-04 16:54:30.149: W/System.err(4832): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
08-04 16:54:30.159: W/System.err(4832): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:474)
问题答案:
看来证书的颁发者不在2.3设备的信任存储中。
查看GoDaddy证书的根ca和中间ca,并检查证书是否在2.3设备上存在。
有关获取2.3证书列表的信息,请参见http://www.andreabaccega.com/blog/2010/09/23/android-root-
certification-authorities-
list/
。
当只有根CA可用时,请确保您的Web服务器还根据请求提供中间证书。