Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
shahumang8
Posts: 580
Registered: ‎08-09-2010
My Device: Not Specified

Re: TLS Connection implementations Problem

Hi Peter,

 

   Last you provide me some more information like how to connection establish (call webservice) into TLS?

 

      As per rim example they build url (called webservice )like this 

 

   private static final String GET = "GET /go/mobile/samplehttps.shtml HTTP/1.1\r\nHost: www.blackberry.com\r\nConnection: close\r\n\r\n";

  

    For TLS.

 

     So it's right?

 

Thanks,

Umang,

 

   

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: TLS Connection implementations Problem

What you are doing there is building a string that matches the HTTP/HTTPS specification.  HTTP/HTTPS sits on top of the socket connection, so to do this, you need to open the socket and then format the data that you send to match the specification that you want.  As I noted here:

http://supportforums.blackberry.com/t5/Java-Development/TLS-Connection-implementations-Problem/m-p/2...

I have done this once.  To implement this, I read the HTTP specifications which I found on the Internet and made sure that what I sent matched the specification and what I received I interpreted correctly. 

 

But as I noted, from memory, I did this because I needed to.  I don't see why you need to.  You are sending normal HTTPS formatted data on the socket, so you should open the socket using that protocol.  Why won't that work?

 

 

Please use plain text.
Developer
shahumang8
Posts: 580
Registered: ‎08-09-2010
My Device: Not Specified

Re: TLS Connection implementations Problem

Thanks Peter.

 

  Some more query

 

  1. I use the SSL1.0 so basically they support TLS1.0 right?If right then they provide a security as per TLS ?Means they provide security same like SSL3.0?

 

  2. What the difference between SSL 3.0 and TLS1.0?

 

  3. Http over TLS work or we build the difference code?

 

Thanks,

Umang. 

 

 

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: TLS Connection implementations Problem

Information on the differences between SSL and TLS, and the various levels of SSL is better obtained elsewhere.  I only know the minimum I need to know...  Which is not a lot.

 

Here might be useful:

http://en.wikipedia.org/wiki/Transport_Layer_Security

 

When you open an HTTPS connection, you will get a secure socket connection that will be one of the supported methods.  This is what the HttpsConnection class says:

"

This interface defines the necessary methods and constants to establish a secure network connection. The URI format with scheme https when passed to Connector.open will return a HttpsConnection. RFC 2818 defines the scheme.

A secure connection MUST be implemented by one or more of the following specifications:

•HTTP over TLS as documented in RFC 2818 and TLS Protocol Version 1.0 as specified in RFC 2246.

•SSL V3 as specified in The SSL Protocol Version 3.0

•WTLS as specified in WAP Forum Specifications June 2000 (WAP 1.2.1) conformance release - Wireless Transport Layer Security document WAP-199. •WAP(TM) TLS Profile and Tunneling Specification as specified in WAP-219-TLS-20010411-a

HTTPS is the secure version of HTTP (IETF RFC2616), a request-response protocol in which the parameters of the request must be set before the request is sent.

"

 

Now if your Server supports TLS, then you can open an HTTPS Connection and you will probably get a TLS socket connection, which is what you want.  After you have your HttpsConnection, you can check what security you have got using the

getSecurityInfo()

of the

HttpsConnection

 

I still think this is not clear to you and I'm sorry I can't explain it any better.  But in fact I don't think you need anything more.  You need to try two things:

 

a) Open an https connection to the Server in question and see what security you are getting.

b) Ask the Server people how they expect you to use the service - can you use https on port 443 for example.

 

Can I also ask you to review all the posts that I have made on this Thread and research any points you don't understand.  Remember the question you are asking is not actually a BB related question, it is a general question, that would, if it was an issue, be documented elsewhere.  I don't think there is a problem here, I suspect you think there is a problem because you do not understand what is going on.  I've tried to clarify, perhaps by reviewing what I have said again and researching this you will gain a better understanding. 

 

Hope that helps. 

 

BTW, I have one option that I think you might be able to try, but I would rather not suggest that until you have done (a) and (b) above.

 

Good luck. 

Please use plain text.
Developer
shahumang8
Posts: 580
Registered: ‎08-09-2010
My Device: Not Specified

Re: TLS Connection implementations Problem

Ok.I check out.

Thanks,
Umang.
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: TLS Connection implementations Problem

OP has supplied me, via PM, the following additional information:

 

"If tls implemented from our side then not to change anything into code because they run http over tls so there are no any requirement to change anything from our side ,only server side change i hope may i right?

 

I read all post of your and some R&D after that i clarify this.

 

So please provide me your suggestion/feedback about this message."

 

Sorry it is still not clear to me that you have in fact done what I suggested in my last post which was:

 

You need to try two things:

a) Open an https connection to the Server in question and see what security you are getting.

b) Ask the Server people how they expect you to use the service - can you use https on port 443 for example.

 

In neither of these cases is there a need to change the Server side processing at all.  Can you please do these things and let us know what happens. 

 

I have asked you to research other things and have not had a response.  Can you tell us the answer to the following:

Go back to the people providing the Web Service you are trying to use and ask how other users are using this service.  Are they establishing HTTPS connections?  Is this Web Service a socket or HTTP server?

 

As previously noted, I have a more complicated suggestion to try, but if you are not able to try (a), then you will not understand the more complicated suggestion. 

 

I appreciate that perhaps English is not your favorite language, so I have tried to be as clear as I possibly can be.  But being blunt here, we have not actually moved forward from where we were 2 weeks ago.  As far as I can see, it is not me that is holding this up. If you want to move this forward then please do the things I ask.  If you are struggling to understand what I am saying, or explain your point in English, then perhaps ask someone else to help?  Also if the server you are contacting is accessible to other people, then point us at it and the documentation for using the service that you are trying to implement and perhaps we can help more directly. 

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: TLS Connection implementations Problem

I thought I woud just add to this two more things, that might help future readers of this Thread:

 

a) The solution that I thought that OP might be able to use was to open a TLS connection then cast the connection to an httpConnection.  I think that will work.  But since that is, as far as I know, pretty much what https does anyway, it seems more reasonable to code it as https.

 

b) In the networking documentaiton in the new Java microsite, it actually has a simple example of opening a socket connection and sending http flow.  Here is the link:

https://developer.blackberry.com/java/documentation/network_api_1984363_11.html

 

I suspect that link might be broken over time, so here is the relevant code.  _connection is a connection obtained using ConnectionFactory.

 

               // Send HTTP GET to the server.
                OutputConnection outputConn = (OutputConnection) _connection;
                os = outputConn.openOutputStream();
                String getCommand = "GET " + "/" + " HTTP/1.0\r\n\r\n";
                os.write(getCommand.getBytes());
                os.flush();

                // Get InputConnection and read the server's response.
                InputConnection inputConn = (InputConnection) _connection;
                is = inputConn.openInputStream();
                byte[] data = net.rim.device.api.io.IOUtilities.streamToBytes(is);
                result = new String(data);

 

 

 

Please use plain text.