MIDLET 中的 HTTPS

发布于 2025-01-08 05:43:41 字数 876 浏览 1 评论 0原文

我开发了一个应用程序,它可以点击受保护的网址。当我使用“https”点击此网址时,我在模拟器中得到“证书已过期”,在真实设备中得到“证书验证失败”。下面是代码片段:

String loginUrl= "https://myhost.com/somefile";
 HttpConnection httpConn = null;
                DataOutputStream dataOS = null;
                System.out.println("strModuleName.trim()::::"
                        + strModuleName.trim());

                httpConn = (HttpConnection) Connector.open(loginUrl);//, Connector.READ_WRITE);
                httpConn.setRequestProperty("User-Agent",
                        "Profile/MIDP-2.0, Configuration/CLDC-1.0");
                httpConn.setRequestProperty("Connection", "Keep-Alive");
                httpConn.setRequestProperty("Content-Language", "en-US");
                httpConn.setRequestMethod(HttpConnection.POST);         
                dataOS = (DataOutputStream) httpConn.openDataOutputStream();

I have developed an app which hits the url which is secured.when I hit this url using "https" I get "Certificate is expired" in simulator or "Certificate failed verification" in real device. below is the snippet of the code:

String loginUrl= "https://myhost.com/somefile";
 HttpConnection httpConn = null;
                DataOutputStream dataOS = null;
                System.out.println("strModuleName.trim()::::"
                        + strModuleName.trim());

                httpConn = (HttpConnection) Connector.open(loginUrl);//, Connector.READ_WRITE);
                httpConn.setRequestProperty("User-Agent",
                        "Profile/MIDP-2.0, Configuration/CLDC-1.0");
                httpConn.setRequestProperty("Connection", "Keep-Alive");
                httpConn.setRequestProperty("Content-Language", "en-US");
                httpConn.setRequestMethod(HttpConnection.POST);         
                dataOS = (DataOutputStream) httpConn.openDataOutputStream();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2025-01-15 05:43:41

如果您使用 HTTPS,设备需要验证您的服务器 (myhost.com) 已安装的证书链。如果证书已过期,那么您需要将此情况告知网站管理员,以便他可以修复它。

如果证书链正确,则设备必须根据设备本身安装的证书对其进行验证。移动设备通常拥有来自主要证书颁发机构(Verisign 等)的证书。但如果您的服务器证书未安装在设备中,则需要先安装它才能建立 HTTP 连接。

If you're using HTTPS, the device need to validate the Certificate Chain that your server (myhost.com) has installed. If the certificate is expired, then you need to inform this to the webmaster so he can fix it.

If the certificate chain is correct, then the device has to validate it against the certificates that the device itself has installed. It's usual that mobile devices have certificates from the main certificates authorities (Verisign and others). But if your server's certificate is not installed in the device, you need to install it first to make the HTTP connection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文