Cmwap J2ME access point by using the Socket Access Security HTTPS1 [transfer]

2010-12-11  来源:本站原创  分类:Mobile  人气:195 

The problem is in my J2ME version of XHTML browser upgrade when they were introduced, I tried many ways, made a lot of posts and asked a lot of people do not find a viable solution. Finally, I connected the PC, use common OTA WireShark intercept data packets to solve the problem, let me share with you the process of solving the problem.
Knowledge points covered:

1, how to use the J2ME Proxy Connection cmwap

2, based on the security socket HTTPS

Try Method One:

Create a new Midlet application, in StartApp method to add the following code:

1 HttpConnection conn = null;
2 InputStream is = null;
3 try {
4 / / url: https: / / ebs.95559. Com .cn / corporbank / es_logon.jsp
5 conn = (HttpConnection) Connector.open ("http://10.0.0.172: 80 / corporbank / es_logon.jsp", Connector.READ, true);
6 String host = "ebs.95559.com.cn";
7 conn.setRequestProperty ("x-online-host", host);
8 conn.setRequestMethod (HttpConnection.GET);
9
10 int code = conn.getResponseCode ();
11 System. Out.println ("Response Code:" + code);
12
13 is = conn.openDataInputStream ();
14
15 System.out.println ("Response Stream:");
16 byte [] buf = new byte [128];
17 while (true) {
18 int availSize = is.read (buf, 0, buf.length);
19 if (availSize == -1) {
20 break;
21}
22 System.out.println (new String (buf, 0, availSize));
23}
24} catch (Exception ex) {
25 ex.printStackTrace ();
26} finally {
27 if (is! = Null) {
28 try {
29 is.close ();
30} catch (IOException ex) {
31 ex.printStackTrace ();
32}
33}
34
35 if (conn! = Null) {
36 try {
37 conn.close ();
38} catch (IOException ex) {
39 ex.printStackTrace ();
40}
41}
42}
43

The role of this code is: using cmwap agent, asked us to develop the page and returns the output in the console the status code and content. Obviously, this is a common cmwap connection, https factors not considered the addition of the output is also expected within:

Response Code: 502
Response Stream:
<? Xml version = "1.0"?>
<! DOCTYPE wml PUBLIC "- / / WAPFORUM / / DTD WML 1.1 / / EN" "http://www.wapforum. Org / DTD/wml_1.1.xml">
<wml> <card>
<p> <do type="prev" name="Back" label="Back"> <prev/> </ do> Connection to host failed. Check your settings and try again. If the pro
blem persists contact your operator. </ p> </ card> </ wml>

Analysis: We request that the safety of HTTP, port 443, and in our code does not reflect the intent that we want to connect to HTTPS, and we just told the agent we want to connect to the address cmwap "ebs.95559.com.cn / corporbank / es_logon.jsp ", but does not tell cmwap proxy to access the address we have is based on HTTPS, so cmwap agent in accordance with the address" http://ebs.95559.com.cn/corporbank/es_logon.jsp "to connect to , just the address is not supported by HTTP: 80's, cmwap gateway agent returned an error.

Try Method Two:

For more ideas, we will code changed a bit, trying to cmwap agents know what we want to access the destination address is HTTPS: 443.

Line 6 modify the program so that it becomes:

String host = "ebs.95559.com.cn: 443";

Running, the console or output the following error:

Response Code: 500
Response Stream:
<? Xml version = "1.0"?>
<! DOCTYPE wml PUBLIC "- / / WAPFORUM / / DTD WML 1.1 / / EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml> <card>
<p> <do type="prev" name="Back" label="Back"> <prev/> </ do> Your request for a service could not be fulfilled. Please try again or c
ontact your operator if the problem persists. </ p> </ card> </ wml>

Analysis: unknown.

Try Method three:

Above two methods fail, it is possible cmwap proxy server SSL port opened to allow the application to access the HTTPS port through this it?

Line 5 to modify the code as follows:

conn = (HttpConnection) Connector.open ("https: / / 10.0.0.172:443 / corporbank / es_logon.jsp", Connector.READ, true);

Simulator for a long time is not responding.

Analysis: General cell phone comes with browsers support access to HTTPS, while the phone is set proxy address cmwap 10.0.0.172:80. So certain is that mobile phones can access the proxy by 10.0.0.172:80 HTTPS and not 10.0.0.172:443. Internet search data to prove that mobile agent for cmwap opened only port 80, and are not open port 443.

Try to approach four (success):

After more than three failed, I had a good stop and think about solutions. I think the use of OTA, which allows the PC to connect to GPRS on debugging. First to use the data cable to the computer and mobile phone, the computer's local connection is disabled, the phone when the cat used to create cell phone-based dial-up network connection, enter the number "* 99 #", dial-up connection. A good proxy 10.0.0.172:80 browser settings, it can normally browse HTTPS address. I happen to think that since HttpConnection can not be properly connected through cmwap HTTPS, then I use the Socket simulate HTTP requests can succeed? With this question, I began to prepare:

Essential tools:

Wireshark or HttpWatch or Openware Simulator

At first I was using Firefox + Wireshark packet blocking port 80, but the browser to the server after issuing SSL Hello delivered content will be encrypted, Wireshark see is cipher text, quite inconvenient. Figure:

Later I found out, Openware Simulator provides a browser, and itself provides the function similar to Wireshark, and can intercept the transmission to the content of HTTP layer can clearly see that between client and server-side process. Therefore, we Openware Simulator screenshot as a description. Openware Simulator Download Address: here (free, requires email registration)

You can also use HttpWatch 6.0, new version of HttpWatch has been embedded as Firefox extensions. But it is to receive the ocean, or Openware Simulator more direct.

Implementation:

Open the Openwave V7 Simulator, enter the URL address bar in the simulator, screenshots are as follows:

Through the right side of the console output window, we can clearly see Openware Simulator cmwap by agents sent to the request format. And, through the Socket connection is not necessary to add "x-onlin e-host" request header.

Since HttpConnection does not work, our own implementation on the use of Socket Http connection request to the cmwap agent.

Note first the following two points here:

1, J2ME MIDP 2.0 in SocketConnection is an optional package, not every cell phone provide support for Socket;

2, we have to use Socket Connection cmwap agent 10.0.0.172:80, the MIDP 2.0 On Socket access to port 80 added restrictions on the use of the real machine must be signed using certificates generated JAD, otherwise it will throw a security exception.

Here, I do not follow Openware Simulator console connection shown in the order (after the first Connect Get) to connect, use Openware Simulator only prove the feasibility of my idea, I will directly use the Get + the full URL of the way the code to write.

相关文章
  • Cmwap J2ME access point by using the Socket Access Security HTTPS1 [transfer] 2010-12-11

    The problem is in my J2ME version of XHTML browser upgrade when they were introduced, I tried many ways, made a lot of posts and asked a lot of people do not find a viable solution. Finally, I connected the PC, use common OTA WireShark intercept data

  • J2ME cmwap access point by using the Socket Access Security HTTPS 2010-03-17

    The problem is in my J2ME version of XHTML browser upgrade when they were introduced, I tried many ways, made a lot of posts and asked a lot of people do not find a viable solution. Finally, I connected the PC on the general OTA use WireShark interce

  • Cmwap J2ME access point by using the Socket Access Security HTTPS 2 [transfer] 2010-12-11

    Create a new Midp application, add the following code in startApp: 1 SocketConnection conn = null; 2 OutputStream os = null; 3 InputStream is = null; 4 try { 5 / / url: https: / / ebs.95559. Com .cn / corporbank / es_logon.jsp 6 conn = (SocketConnect

  • J2ME using the Socket access security through HTTPS access points cmwap 2010-03-29

    The problem is in my J2ME version of XHTML browser upgrade when they were introduced, I have tried many ways, made a lot of posts and asked a lot of people do not find a viable solution. Finally, I connected the PC on a general-purpose use of OTA int

  • Flash Socket Communications security policy issues 2010-09-30

    Flash Socket Communications security policy issues Will be published as html flash format, load the page, swf can not communicate with the server socket. Flash side shows the error as: securityErrorHandler message : [SecurityErrorEvent type = "securi

  • JSEL2.0 support nested access, that is, dot operator to access the variable in the property case 2010-08-23

    How to access support nested variable access, that is, dot operator to access the variable in the property, assuming we have a Foo class: Definition of class foo public class foo ( private int age; private int sexy; private String brithday; public in

  • access into sql server, sql view access to build the table 2011-04-10

    access into sql server, sql view access to build the table First release of SQL components "Ad Hoc Distributed Queries" of the "STATEMENT'OpenRowset OpenDatasource" access Practices: Open the sql server sql window, run the following co

  • LoadRunner scripts manually writing Socket Access 2011-05-17

    Action: # Include "lrs.h" Action () { lrs_create_socket ("socket0", "TCP", "RemoteHost = 127.0.0.1:1212", LrsLastArg); lrs_send ("socket0", "buf1", LrsLastArg); lrs_receive ("socket0",

  • Flash Socket Communications Security Policy 2010-08-14

    The flash release for the html format, after the page loads, swf can not communicate with the server socket. Flash side shows the error as: securityErrorHandler message : [SecurityErrorEvent type = "securityError" bubbles = false cancelable = fa

  • Can not access the XX (folders) to refuse access solutions 2011-05-23

    Problem Description: "Double-click it will pop-up" can not access the XX (folder) Access Denied "error window; right attribute points safe, then they pop up," You are not authorized to view or edit the current XX permission settings; H

  • Android to access files on the problem of access to Tomcat 2010-12-15

    Want to achieve SAX parsing XML documents, like the inside through the net package downloaded from the tomcat and then placed inside the SAX parse, the result is always less than download. Finally, a flash head. The original android inside local addr

  • cgi can not access external resources, cannot create directory ==> super security selinux 2011-09-27

    Today, doing a monitoring script, but not always successfully created the directory, After careful checking, no permissions problems. After repeated tests, / tmp directory with read and write operations, the rest were not. Reflect on the final positi

  • Java socket - Summary 2010-04-12

    Summary Java language simplifies the sockets application use. It is based on fact java.net package Socket and ServerSocket classes. Once you understand what happens behind the appearance, you can easily use these classes. In real life, the use of soc

  • Socket address structure 2010-03-19

    Article access procedures for the previous example. First introduced the socket address structure: struct sockaddr_in, defined in the netinet / in.h, the general is in / usr / include under struct in_addr ( in_addr_t s_addr; / * 32 bytes of ipv4 addr

  • ActionScript 3.0 Socket programming 2010-04-14

    Programming using ActionScript3.0 time to note the following issues: 1, and Socket server connection. 2, the server sends data to the Socket. 3, reading data from the Socket server. 4, shook hands with the Socket server and determine what kind of dat

  • Based on JAVA the SNMP protocol packets Socket Communications 2010-06-03

    1. Introduction Since the late eighties SNMP (Simple Network Management Protocol) SNMP available since the network management technology in just a few decades has been rapid development, with management enhancements and the expansion of managed objec

  • Achieved with java socket 2010-07-27

    Abstract The Java environment provides a support network library java. net, can be adapted to a variety of network protocols, including TCP / IP, UDP and so on. Using java. net package, can quickly develop a variety of network applications. In this p

  • August 1, 2010 --- actionscript socket connection of the strategy document 2010-08-02

    August 1, 2010 --- actionscript socket connection to the strategy document Socket connection before the strategy document there are some unresolved problems, and Firefox, google chrome browser does not support changes made today on the deal, the ques

  • [Tutorial] AS 3.0 socket communication, the whole basis of comparison compare, do not go around the 2010-08-27

    Transfer from http://520pig.blogbus.com/logs/32821429.html Socket socket connection allows Flash player by specifying the port communicate with the server, but the socket after the data transfer communication is still not close to artificially close.

  • Applet and access Mysql database performance test and found some problems to find a solution. 2010-08-27

    I was doing a feature words of data mining small test, I use java + access + jdbc for development. Requirements are as follows: A text set text set that many txt text, text as follows: Under the renowned/n /f ,/w In fact difficult to associate/w eh/i