×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    secure url issue(https)

    hello

    i am trying to get search data from bing...and it has a https url and even has user name and password to access it...when i am using it on normal pc browser it works fine.but when i am tring to redirect it to mobile browser it says secure connection not available.and when i am using it through code to get the data using the following code

    Code:
    connection = (HttpConnection) Connector.open(baseURL);
    
    connection.setRequestMethod(HttpConnection.GET);
    
    
    connection.setRequestProperty("User-Agent",
    "Profile/MIDP-1.0 Configuration/CLDC-1.0");
    		String accountKey = "d8I62wTYbZSFwVb+HI/CK=";
    	String actkey=accountKey + ":" + accountKey;
    	
    		String accountKeyEnc = Base64.base64Encode((actkey).getBytes());
    
    	String accountKeyEnc = Base64.base64Encode((accountKey + ":" + accountKey).getBytes());
    		connection.setRequestProperty("Authorization", "Basic " + accountKeyEnc);
    
    		
    	connection.setRequestProperty("Content-Type", "text/plain");
    		connection.setRequestProperty("Content-Length", "0");
    	connection.setRequestProperty("Content-Language", "en-US");
    		connection.setRequestProperty("Connection", "close");
    		connection.setRequestProperty("Accept", "text/plain");
    		
    
    		System.out.println("Status Line Code: "
    				+ connection.getResponseCode());
    		System.out.println("Status Line Message: "
    				+ connection.getResponseMessage());
    		if (connection.getResponseCode() == HttpConnection.HTTP_OK) {
    			System.out.println(connection.getHeaderField(0) + " "
    					+ connection.getHeaderFieldKey(0));
    		System.out.println("Header Field Date: "
    					+ connection.getHeaderField("date"));
    			
    			inputstream = connection.openInputStream();
    			int length = (int) connection.getLength();
    			if (length != -1) {
    				byte incomingData[] = new byte[length];
    				inputstream.read(incomingData);
    				str = new String(incomingData);
    			} else {
    				ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
    				int ch;
    				while ((ch = inputstream.read()) != -1) {
    					bytestream.write(ch);
    				}
    				str = new String(bytestream.toByteArray());
    				bytestream.close();
    			}
    			System.out.println(str);
    i am getting 60 http error

    please do help me i am struck

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: secure url issue(https)

    Http ERROR: 60: is SSL certificate problem.

    Your app should be signed and server should have a 3rd party SSL verified certificate... self signed may not work.

    if baseURL = "https URL"
    connection = (HttpConnection) Connector.open(baseURL);
    should be
    HttpsConnection connection = (HttpsConnection) Connector.open(baseURL);
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105
    Quote Originally Posted by im2amit View Post
    Your app should be signed.
    Then you would get an exception of the type ‘SecurityException’. In J2ME, code signing is not required for HTTPS (or using HttpsConnection class).
    Quote Originally Posted by im2amit View Post
    should be HttpsConnection connection = (HttpsConnection) Connector.open(baseURL);
    Because HttpsConnection is a subclass of HttpConnection, you can use the more generic class as well.

    rchadalawada, your code is fine. This is a server-side issue. rchadalawada, what is your baseURL? Does this help?
    Last edited by traud; 2013-02-03 at 10:25.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: secure url issue(https)

    hey traud,

    The issue with bing got resolved i dnt know y its not working in j2me but its working well and good on real device...so the problem i wanna know why is it not working on emulator

    Regards rahul

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: secure url issue(https)

    Interesting, just the emulator? Which one do you use?

  6. #6
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: secure url issue(https)

    nokia asha 305 emulator

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: secure url issue(https)

    Very, very interesting. You could use Wireshark on your computer, and have a look. Although this sounds like a handshake issue on the TCP layer, I would remove the additional HTTP headers, just for testing it. Have you checked the certificates authorities of the Nokia 305 emulator?

Similar Threads

  1. HTTPS certificate issue
    By sandypop in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2012-02-07, 13:49
  2. HTTPS connection issue
    By kumarv75 in forum Mobile Java General
    Replies: 6
    Last Post: 2011-09-06, 14:51
  3. HTTPS Issue On S60
    By devdattac in forum Mobile Java Networking & Messaging & Security
    Replies: 7
    Last Post: 2010-12-22, 09:10
  4. HTTPS (secure HTTP) support on Nokia Java phones ?
    By in forum Mobile Java General
    Replies: 4
    Last Post: 2009-08-03, 16:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×