Aerogear SSLHandshakeException CertPathValidatorException

时间:2017-01-04 10:42:56

标签: android push-notification ssl-certificate aerogear

我刚刚开始测试the aerogear push notifcation solution。我通过docker在本地安装它。似乎SSL证书存在问题。 我甚至发现this ticket似乎已经关闭了。 我试图注册一个Android模拟器,我得到以下问题:

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:328)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103)
at com.android.okhttp.Connection.connect(Connection.java:143)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java)
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.addBodyRequest(HttpRestProvider.java:219)
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:147)
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:134)
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:180)
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:135)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:318)
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:219)
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:115)
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:556)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103) 
at com.android.okhttp.Connection.connect(Connection.java:143) 
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185) 
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128) 
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245) 
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218) 
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.addBodyRequest(HttpRestProvider.java:219) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:147) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:134) 
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:180) 
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:135) 
at android.os.AsyncTask$2.call(AsyncTask.java:295) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 
Caused by: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:318) 
at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:219) 
at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:115) 
at com.android.org.conscrypt.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:556) 
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324) 
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:103) 
at com.android.okhttp.Connection.connect(Connection.java:143) 
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185) 
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128) 
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341) 
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330) 
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114) 
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245) 
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218) 
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.addBodyRequest(HttpRestProvider.java:219) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:147) 
at org.jboss.aerogear.android.pipe.http.HttpRestProvider.post(HttpRestProvider.java:134) 
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:180) 
at org.jboss.aerogear.android.unifiedpush.fcm.AeroGearFCMPushRegistrar$4.doInBackground(AeroGearFCMPushRegistrar.java:135) 
at android.os.AsyncTask$2.call(AsyncTask.java:295) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 

1 个答案:

答案 0 :(得分:0)

Docker内部的Wildfly使用自签名证书加密Android和UPS之间的HTTP流量。有几种方法可以解决这个问题。

  1. 使用证书颁发机构签署您的证书
  2. 在Docker镜像中公开端口8080并使用
  3. 进行连接
  4. 在Android N中使用证书固定并将Wildfly正在使用的SSL证书加载到您的应用中(https://developer.android.com/training/articles/security-config.html#CertificatePinning
  5. 注入忽略SSL错误(telling java to accept self-signed ssl certificate
  6. 的TrustManager