我正在使用Google Places API开发Android应用程序。直到昨晚,应用程序工作得非常好,我今天要启动它,突然间我开始收到SSLHandShakeException。 我不明白这是怎么突然发生的?我用新的包名创建了一个新的API密钥,我得到了同样的错误。请告诉我应该做些什么。
11-05 16:18:46.459: W/System.err(1022): javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time: Tue Nov 05 16:18:46 GMT+00:00 2013, validation time: Wed Nov 06 14:00:40 GMT+00:00 2013
11-05 16:18:46.459: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:413)
11-05 16:18:46.459: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:257)
11-05 16:18:46.459: W/System.err(1022): at android.net.SSLCertificateSocketFactory.verifyHostname(SSLCertificateSocketFactory.java:191)
11-05 16:18:46.469: W/System.err(1022): at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:276)
11-05 16:18:46.469: W/System.err(1022): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:375)
11-05 16:18:46.469: W/System.err(1022): at sn.createSocket(SourceFile:157)
11-05 16:18:46.469: W/System.err(1022): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
11-05 16:18:46.479: W/System.err(1022): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
11-05 16:18:46.479: W/System.err(1022): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
11-05 16:18:46.479: W/System.err(1022): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
11-05 16:18:46.479: W/System.err(1022): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
11-05 16:18:46.479: W/System.err(1022): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
11-05 16:18:46.489: W/System.err(1022): at android.net.http.AndroidHttpClient.execute(AndroidHttpClient.java:257)
11-05 16:18:46.489: W/System.err(1022): at sl.a(SourceFile:200)
11-05 16:18:46.489: W/System.err(1022): at sl.execute(SourceFile:242)
11-05 16:18:46.489: W/System.err(1022): at sl.execute(SourceFile:310)
11-05 16:18:46.489: W/System.err(1022): at fqz.g(SourceFile:126)
11-05 16:18:46.499: W/System.err(1022): at fqz.c(SourceFile:172)
11-05 16:18:46.499: W/System.err(1022): at ftq.run(SourceFile:418)
11-05 16:18:46.499: W/System.err(1022): at ftp.b(SourceFile:224)
11-05 16:18:46.499: W/System.err(1022): at ftp.run(SourceFile:198)
11-05 16:18:46.509: W/System.err(1022): at frh.run(SourceFile:96)
11-05 16:18:46.509: W/System.err(1022): Caused by: java.security.cert.CertificateException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time: Tue Nov 05 16:18:46 GMT+00:00 2013, validation time: Wed Nov 06 14:00:40 GMT+00:00 2013
11-05 16:18:46.509: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:204)
11-05 16:18:46.509: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:163)
11-05 16:18:46.519: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:593)
11-05 16:18:46.519: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
11-05 16:18:46.519: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:410)
11-05 16:18:46.519: W/System.err(1022): ... 21 more
11-05 16:18:46.519: W/System.err(1022): Caused by: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: current time: Tue Nov 05 16:18:46 GMT+00:00 2013, validation time: Wed Nov 06 14:00:40 GMT+00:00 2013
11-05 16:18:46.529: W/System.err(1022): at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1493)
11-05 16:18:46.529: W/System.err(1022): at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:364)
11-05 16:18:46.529: W/System.err(1022): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190)
11-05 16:18:46.539: W/System.err(1022): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:191)
11-05 16:18:46.539: W/System.err(1022): ... 25 more
11-05 16:18:46.539: W/System.err(1022): Caused by: java.security.cert.CertificateNotYetValidException: current time: Tue Nov 05 16:18:46 GMT+00:00 2013, validation time: Wed Nov 06 14:00:40 GMT+00:00 2013
11-05 16:18:46.549: W/System.err(1022): at org.apache.harmony.security.provider.cert.X509CertImpl.checkValidity(X509CertImpl.java:145)
11-05 16:18:46.549: W/System.err(1022): at org.apache.harmony.security.provider.cert.X509CertImpl.checkValidity(X509CertImpl.java:139)
11-05 16:18:46.549: W/System.err(1022): at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1484)
11-05 16:18:46.549: W/System.err(1022): ... 28 more
答案 0 :(得分:3)
检查系统时间。确保它是最新的。
答案 1 :(得分:0)
我做了很多挖掘工作,并找到了解决这个问题的方法。然而,我的情况是我的应用程序运行完全正常,直到我想在发布它之前最后一次运行它的那天,那是v.suprising。我不断进行更改,并编写了不同的代码来接受任何证书。当我回家时,我运行了我以前的代码并成功执行了。我意识到我的公司网络中存在网络安全问题,这阻止了我的应用程序联系谷歌服务器。所以这个问题是暂时的,在我的情况下,我不得不做任何特别的事情。