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
Contributor
Posts: 40
Registered: ‎10-10-2011
My Device: BB Curve&Bold
My Carrier: Airtel
Accepted Solution

How to open a secure TLS connection on BlackBerry?

Hi All,

 

I am using a secure connection on BlackBerry. I have a client certificate(.crt).

How to open a secure connection?

How to add the client certificate to server connection code?

How to get certificate from Server?

How to verify the certificate?

 

I am using this code,it throws uncaught exception.

 

SecureConnectionconn = (SecureConnection) Connector
.open("tls://my server address:5061;deviceside=true",Connector.READ_WRITE,true);

 

please help me.ASAP send sample code.

 

Thanks

 

 

BlackBerry Development Advisor
Posts: 15,694
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How to open a secure TLS connection on BlackBerry?

First you'll need to Add a Certificate to DeviceKeyStore.  What exception are you getting (include its .toString details)?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 40
Registered: ‎10-10-2011
My Device: BB Curve&Bold
My Carrier: Airtel

Re: How to open a secure TLS connection on BlackBerry?

Hi Mark,

 

I have added the certificate to Device Keystore(ex: ca.crt file) Successfully.I didn't get any exception.

 

I am using this code

SecureConnection conn=(SecureConnection )Connector.open("tls://addressSmiley Tongueort;deviceside=true");

 

How to add the certificate to Server conection code?Is it require or not? How to verify the server certificate?

 

 


BlackBerry Development Advisor
Posts: 15,694
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How to open a secure TLS connection on BlackBerry?

What exception does that code give you?

 

I've attached a sample that shows various ways to make a secure connection.  It's set to use WiFi only right now (interface=wifi).

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Contributor
Posts: 18
Registered: ‎10-11-2010
My Device: Not Specified

Re: How to open a secure TLS connection on BlackBerry?

Hi Mark, 

 

Is there any difference between calling the following with "tls://"

sec = (SecureConnection)Connector.open(_theUrl);
input = sec.openInputStream();
output = sec.openOutputStream();                                

 

and calling the following with "socket://"

s = (StreamConnection)Connector.open(_theUrl);
tls10 = new TLS10Connection(s, _theUrl);
input = tls10.openInputStream();
output = tls10.openOutputStream();
 

 Thanks.

 

BlackBerry Development Advisor
Posts: 15,694
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How to open a secure TLS connection on BlackBerry?

Not really.  The first example (with the tls:// URL) does the same thing in the Connector.open call.

 

Mark

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Highlighted
Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: How to open a secure TLS connection on BlackBerry?

Hi,

 

     Can you provide me some idea for how to SetRequestProperty  into TLS?

 

Thanks,

Umang.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to open a secure TLS connection on BlackBerry?