【发布时间】:2016-10-24 20:09:21
【问题描述】:
我在 Android 中有一个 webview。当我从 http 站点重定向到客户端托管的 https 站点时,我遇到了间歇性的 HTTPS/SSL 故障。
失败日志:
com.company.myapp D AppWebViewClient -> analyzeURL : 1936 : 2016/10/24 5:36:29 : URL: https://client.website.com/ApplicationRegPage/createAccount
com.company.myapp D AppWebViewClient -> onReceivedSslError : 1936 : 2016/10/24 5:36:30 : Received SSL Error
com.company.myapp D AppWebViewClient -> onReceivedSslError : 1936 : 2016/10/24 5:36:30 : SSL Error::https://client.website.com/ApplicationRegPage/createAccount:: primary error: 3 certificate: Issued to: CN=client.website.com,OU=MIT,O=Client\,
Inc,L=Mounds View,ST=Minnesota,C=US;
com.company.myapp D Issued by: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US;
com.company.myapp D on URL: https://client.website.com/ApplicationRegPage/createAccount
com.company.myapp D AppWebViewClient -> printCertificate : 1936 : 2016/10/24 5:36:30 : Expanding Certificate: Issued to: CN=client.website.com,OU=MIT,O=Client\, Inc,L=Mounds View,ST=Minnesota,C=US;
com.company.myapp D Issued by: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US;
com.company.myapp D AppWebViewClient -> printCertificate : 1936 : 2016/10/24 5:36:30 : Issued by
com.company.myapp D AppWebViewClient -> printDName : 1936 : 2016/10/24 5:36:30 : DName: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
com.company.myapp D AppWebViewClient -> printDName : 1936 : 2016/10/24 5:36:30 : CName: Symantec Class 3 Secure Server CA - G4
com.company.myapp D AppWebViewClient -> printDName : 1936 : 2016/10/24 5:36:30 : OName: Symantec Corporation
com.company.myapp D AppWebViewClient -> printDName : 1936 : 2016/10/24 5:36:30 : UName: Symantec Trust Network
com.company.myapp D AppWebViewClient -> printCertificate : 1936 : 2016/10/24 5:36:30 : ValidNotAfter: Wed May 31 23:59:59 GApp+00:00 2017
com.company.myapp D AppWebViewClient -> printCertificate : 1936 : 2016/10/24 5:36:30 : ValidNotBefore: Wed May 04 00:00:00 GApp+00:00 2016
成功日志:
com.company.myapp D AppWebViewClient -> analyzeURL : 1665 : 2016/10/24 5:28:44 : URL: https://client.website.com/ApplicationRegPage/createAccount
com.company.myapp D AppWebChromeClient -> onConsoleMessage : 1665 : 2016/10/24 5:28:46 : Console Msg: https://client.website.com/ApplicationRegPage/createAccount::179:: Uncaught ReferenceError: dstb is not defined
com.company.myapp D AppWebViewClient -> onPageFinished : 1665 : 2016/10/24 5:28:47 : Finished loading: https://client.website.com/ApplicationRegPage/createAccount
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : HTTPS SSL Certificate for URL
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : URL: https://client.website.com/ApplicationRegPage/createAccount
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : Expanding Certificate: Issued to: CN=client.website.com,OU=MIT,O=Client\, Inc,L=Mounds View,ST=Minnesota,C=US;
com.company.myapp D Issued by: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US;
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : Issued by
com.company.myapp D AppWebViewClient -> printDName : 1665 : 2016/10/24 5:28:47 : DName: CN=Symantec Class 3 Secure Server CA - G4,OU=Symantec Trust Network,O=Symantec Corporation,C=US
com.company.myapp D AppWebViewClient -> printDName : 1665 : 2016/10/24 5:28:47 : CName: Symantec Class 3 Secure Server CA - G4
com.company.myapp D AppWebViewClient -> printDName : 1665 : 2016/10/24 5:28:47 : OName: Symantec Corporation
com.company.myapp D AppWebViewClient -> printDName : 1665 : 2016/10/24 5:28:47 : UName: Symantec Trust Network
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : ValidNotAfter: Wed May 31 23:59:59 GApp+00:00 2017
com.company.myapp D AppWebViewClient -> printCertificate : 1665 : 2016/10/24 5:28:47 : ValidNotBefore: Wed May 04 00:00:00 GApp+00:00 2016
我已经阅读了这个“主要错误:3 证书”的各种“修复”,其中涉及 Android WebView 对象上的各种配置更改。包括这里我的配置(我已经尝试过 not 设置 DOM 存储)
protected void configureWebView(WebView mWebView) {
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(getWebViewClient());
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.getSettings().setDomStorageEnabled(true);
// Chrome
mWebView.setWebChromeClient(getWebChromeClient());
}
这些故障是随机的。我已经看到今天早上 10 个站点负载中有 1 个发生错误。不幸的是,我的客户看到它的几率接近 50%。我倾向于在初次启动时更频繁地看到此错误(或新安装应用程序,或从 Android Studio 对应用程序新安装的更新),但我的客户似乎更随机地看到它。
【问题讨论】:
-
我在 Tyrus 和 Grizzly(WebSocket 和 HTTP 实现)中遇到了类似的随机 TLS 握手失败的问题,而 IIRC 的问题是 android TLS 实现随着版本 4.4、5 和 6 的变化而发生变化。这有点像这个:stackoverflow.com/questions/28011581/…
-
我的意思是,您的问题是否发生在其他安卓版本中?我明天会记得我的 tyrus/grizzly 解决方法
-
我们已经验证它发生在 Android 6.0.1 中。等待收到客户关于它正在发生的任何其他版本的回复。 (本地测试主要使用 6.0.1)