jen*_*nzz 8 twitter ssl android ssl-certificate
我正在使用Twitter的新Fabric SDK for Android.我已将Charles设置为Mac上的代理,因此我可以分析API响应中的JSON有效负载.
启用了Charles中的SSL代理并为我的测试设备授予了访问权限.
但是,Charles对Twitter的任何请求都显示以下错误:
状态 失败
失败 SSLHandshake:收到致命警报:certificate_unknown
Logcat告诉我:
retrofit.RetrofitError: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:306)
at com.squareup.okhttp.Connection.upgradeToTls(Connection.java:241)
at com.squareup.okhttp.Connection.connect(Connection.java:158)
at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:174)
at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:120)
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:209)
at io.fabric.sdk.android.services.network.PinningTrustManager.checkSystemTrust(PinningTrustManager.java:117)
at io.fabric.sdk.android.services.network.PinningTrustManager.checkServerTrusted(PinningTrustManager.java:160)
Run Code Online (Sandbox Code Playgroud)
在我看来,我需要相信一些证书...任何想法?
Fabric SDK使用SSL证书固定来确保它们直接与Twitter服务器通信.不幸的是,这意味着您将无法查看Fabric和Twitter后端之间的流量.
通常,标准SSL仅要求给定证书是"可信的".这就是为什么你能够在模拟器或测试设备上信任Charles证书,然后网络堆栈就不会抱怨.但是,当库使用SSL证书固定时,它不会仅信任任何可信证书,而只信任某组证书.因此,即使您的模拟器看到了受信任的Charles证书,Twitter库也会失败,除非看到实际的Twitter API证书.查看更多https://www.infinum.co/the-capsized-eight/articles/securing-mobile-banking-on-android-with-ssl-certificate-pinning
如果您需要查看流量,则需要使用不使用SSL证书固定的Twitter库.
| 归档时间: |
|
| 查看次数: |
2497 次 |
| 最近记录: |