Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CertPathValidatorException: Trust anchor for certification path not found 解决 #145

Open
soapgu opened this issue May 26, 2022 · 0 comments
Labels
JAVA This doesn't seem right problem problem or trouble 安卓 安卓

Comments

@soapgu
Copy link
Owner

soapgu commented May 26, 2022

  • 直接上Exception信息

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 
 	at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:362)  	
        at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1134) 
 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1089) 
 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:876)
  	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:747) 
 	at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:712) 
 	at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:849)
  	at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.access$100(ConscryptEngineSocket.java:722) 
 	at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:238)
  	at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:217) 
 	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:336) 
 	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:300) 
 	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:185) 
 	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) 
 	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) 
 	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88) 
 	at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169) 
 	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) 
 	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) 
 	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) 
 	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) 
 	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) 
 	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229) 
 	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:172) 
 	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
	at java.lang.Thread.run(Thread.java:933) <br> Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 
 	at com.android.org.conscrypt.TrustManagerImpl.verifyChain(TrustManagerImpl.java:677) 
 	at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:554) 
 	at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:620) 
 	at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:510) 
 	at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:428) 
 	at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:356) 
 	at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94) 
 	at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:90) 
 	at com.android.org.conscrypt.ConscryptEngineSocket$2.checkServerTrusted(ConscryptEngineSocket.java:161) 
 	at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:250) 
 	at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1644) 
 	at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method) 
 	at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:568) 
 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1095) 
 	at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1079) 
 	... 31 more 
 Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. 
 	... 46 more 
  • 解决方案

一看又是https证书的问题

@soapgu soapgu added 安卓 安卓 JAVA This doesn't seem right problem problem or trouble labels May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JAVA This doesn't seem right problem problem or trouble 安卓 安卓
Projects
None yet
Development

No branches or pull requests

1 participant