BlackBerry 无法连接到某些使用 HTTPS 的网页
BlackBerry will not connect to some webpages with HTTPS
我正在为 BlackBerry 6.x 系统编写一个 Java 应用程序供我个人使用。
所以我的发展遇到了很大的障碍。基本上,我需要应用程序连接到特定网页以检索一些数据。由于我需要使用纯文本凭据登录站点,因此我强烈建议使用 HTTPS。
出于某种我无法解决的原因,该设备无法连接到我需要连接的站点以及许多其他站点。
设备完全能够加载的页面包括https://www.google.com.au, and https://www.youtube.com。
设备无法连接的页面包括https://github.com, and https://duckduckgo.com。
值得注意的评论:
- 此问题同时出现在 BlackBerry 模拟器和物理设备上。使用的物理设备是 BlackBerry Curve 9300 运行ning BlackBerryOS 6.3。模拟器是类似的东西。 (BlackBerry 7.x JDK 附带的 9600 模拟器也有同样的问题。)
- 无法通过Java代码使用HTTPS访问的页面也无法使用系统中的默认浏览器访问。尽管能够使用第 3 方 Opera Mini 浏览器正常连接到这些站点。
- 问题似乎只在尝试使用 HttpsConnection 而不是 HttpConnection 时出现。如果我使用不安全的 HttpConnection,我可以连接到该站点,但我不想使用它。
以下是我在设备上尝试 运行 的总体要点:
public static final String SITE_URL = "https://duckduckgo.com";
HttpsConnection conn = null;
try {
// Create connection
conn = (HttpsConnection) Connector.open(SITE_URL + ";deviceside=true;interface=wifi", 3, true);
// Try print certificate information
Certificate c = conn.getSecurityInfo().getServerCertificate();
Dialog.alert("Issuer: " + c.getIssuer() + " subj:" + c.getSubject());
// Getting response code opens connection, sends request,
// and reads HTTP headers.
int rcode = conn.getResponseCode();
if (rcode != HttpsConnection.HTTP_OK) {
throw new IOException ("HTTP response: " + rcode);
}
Dialog.alert("Response: " + rcode);
} catch (ClassCastException e) {
throw new IllegalArgumentException("Not a HTTP URL");
} catch (IOException e) {
Dialog.alert("IOException: " + e.getMessage());
} finally {
// Close connection and stream.
if (is != null) { is.close(); }
if (conn != null) { conn.close(); }
}
如果我将 SITE_URL
更改为我知道我可以连接到的东西 (https://www.google.com.au, et al) then the code runs fine and I get a HTTP 200. When I try to connect to say, https://duckduckgo.com,程序只会抛出一个 IOException。(具体来说,它似乎是一个 TLSIOException,如果我捕获了所有相关的 IOException 子类)和 returns 在调用 getMessage()
.
时为 null
谢谢,
任何帮助或建议将不胜感激。
您的服务器需要什么版本的 TLS? BBOS 很老,我相信只支持 TLS 1.0 和 SSL 3.0。您可以通过在您的设备上访问此站点来进行验证。 https://clienttest.ssllabs.com:8443/ssltest/viewMyClient.html
很可能您连接的服务器也不支持那些旧版本。
我正在为 BlackBerry 6.x 系统编写一个 Java 应用程序供我个人使用。
所以我的发展遇到了很大的障碍。基本上,我需要应用程序连接到特定网页以检索一些数据。由于我需要使用纯文本凭据登录站点,因此我强烈建议使用 HTTPS。
出于某种我无法解决的原因,该设备无法连接到我需要连接的站点以及许多其他站点。
设备完全能够加载的页面包括https://www.google.com.au, and https://www.youtube.com。
设备无法连接的页面包括https://github.com, and https://duckduckgo.com。
值得注意的评论:
- 此问题同时出现在 BlackBerry 模拟器和物理设备上。使用的物理设备是 BlackBerry Curve 9300 运行ning BlackBerryOS 6.3。模拟器是类似的东西。 (BlackBerry 7.x JDK 附带的 9600 模拟器也有同样的问题。)
- 无法通过Java代码使用HTTPS访问的页面也无法使用系统中的默认浏览器访问。尽管能够使用第 3 方 Opera Mini 浏览器正常连接到这些站点。
- 问题似乎只在尝试使用 HttpsConnection 而不是 HttpConnection 时出现。如果我使用不安全的 HttpConnection,我可以连接到该站点,但我不想使用它。
以下是我在设备上尝试 运行 的总体要点:
public static final String SITE_URL = "https://duckduckgo.com";
HttpsConnection conn = null;
try {
// Create connection
conn = (HttpsConnection) Connector.open(SITE_URL + ";deviceside=true;interface=wifi", 3, true);
// Try print certificate information
Certificate c = conn.getSecurityInfo().getServerCertificate();
Dialog.alert("Issuer: " + c.getIssuer() + " subj:" + c.getSubject());
// Getting response code opens connection, sends request,
// and reads HTTP headers.
int rcode = conn.getResponseCode();
if (rcode != HttpsConnection.HTTP_OK) {
throw new IOException ("HTTP response: " + rcode);
}
Dialog.alert("Response: " + rcode);
} catch (ClassCastException e) {
throw new IllegalArgumentException("Not a HTTP URL");
} catch (IOException e) {
Dialog.alert("IOException: " + e.getMessage());
} finally {
// Close connection and stream.
if (is != null) { is.close(); }
if (conn != null) { conn.close(); }
}
如果我将 SITE_URL
更改为我知道我可以连接到的东西 (https://www.google.com.au, et al) then the code runs fine and I get a HTTP 200. When I try to connect to say, https://duckduckgo.com,程序只会抛出一个 IOException。(具体来说,它似乎是一个 TLSIOException,如果我捕获了所有相关的 IOException 子类)和 returns 在调用 getMessage()
.
谢谢,
任何帮助或建议将不胜感激。
您的服务器需要什么版本的 TLS? BBOS 很老,我相信只支持 TLS 1.0 和 SSL 3.0。您可以通过在您的设备上访问此站点来进行验证。 https://clienttest.ssllabs.com:8443/ssltest/viewMyClient.html
很可能您连接的服务器也不支持那些旧版本。