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
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

Is the certificate on a publicly visible server? If so, I could give it a try.
Developer
kully
Posts: 23
Registered: ‎10-15-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

Thanks for the offer, but the server is on a private network. I'm going to try and create a 'proper' certificate and see if that makes a difference.

 

I'm still looking for any documentation wrt. formatting of the certificate fields and what the BB expects of them.

Developer
kully
Posts: 23
Registered: ‎10-15-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

Ok, I've been hacking about and it appears there is a problem with Connector.open() and self-signed certificates.

 

(1) I add the certificate to the key store.

(2) I check its status by doing 'options' >> 'security options' >> 'certificates'. It has a yellow '?' symbol next to it, the details say it is explicitly trusted.

(3) I check this by opening a HTTPS page on the server using the built in browser, it works fine with no prompts.

(4) I then go back to my code, stepping through, it hangs on 'Connector.open()' with the following output:

 

 

SSL:->CH
SSL:<-SH
SSL:<-SC

 

 

(5) If I change the URL passed into the '.open' function so that it points to a server which has a certificate that is not self-signed, the handshake completes and Connector.open() returns.

 

I'm wondering whether anyone has managed to get this working with self-signed certificates...

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

HTTPS connections to servers with self-signed certs work just fine for me in JDE v4.6.1. I'm using Direct TCP/WiFi.

 

The log in the Output Window looks as follows:

 

SSL:->CH
SSL:<-SH
TLS:<-F
SSL:->CCS
TLS:->F
SSL: Ok

Developer
kully
Posts: 23
Registered: ‎10-15-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

Morning,

 

Well, I managed to get it working. Drinking a celebratory coke as I type.

 

Unfortunately, I had to go into 'Options' >> 'Security Options' >> 'TLS' and set the values of the two fields 'Prompt for Server Trust' and 'Prompt for Domain Name' to 'No'. Either one of these being set to 'Yes' causes the handshake to hang on the 'SSL:<-SC' stage.

 

I'm glad you mentioned that you have it working with v4.6.1 JDE, I'm using v4.2.1 for backwards compatibility reasons and tried 4.5.0 - I think I'll build my app against 4.6.1 to see if that resolves this.

 

In the meantime, I think there is a bug in the JDE - that dialogue box isn't popping up.

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection

BTW, is there anything suspicious in the Event Log?

Developer
kully
Posts: 23
Registered: ‎10-15-2009
My Device: Not Specified

Re: 'Connector.open' hangs for HttpsConnection


My app has a 'spinner' global status screen which spins whilst waiting for the network. I'm doing the network stuff from a thread rather than a runnable and am using the deprecated ui.queuestatus(~) function to add the screen to the queue with a priority of '1'.

That priority was causing the trouble, it stopped the BB dialogue box from showing on top and as the dialogue box is another global status screen it was not shown in the application switcher (alt+escape). The Connector.open() function never returned as it was waiting for the dialogue box that was never seen.

I've now changed the priority to '99' and all is fine.

cheers,