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
New Member
bb-dev
Posts: 1
Registered: ‎06-04-2010
My Device: 9000
My Carrier: AT&T

Re: Switching to SSL after connection opened (i.e. STARTTLS)

Hi dkonigs,

 

Thanks for sharing. I tried your codes, but I got TLSAlertException (alert description 50, means DECODE_ERROR) when intializing the TLS10Connection from the underlying SocketConnection. any comments?

Please use plain text.
New Contributor
sharecast
Posts: 6
Registered: ‎03-13-2011
My Device: 9800 torch
My Carrier: software engineer intern

Re: Switching to SSL after connection opened (i.e. STARTTLS)

Hi :

  I use your method to establish a STARTTLS connection.

 and my code is as below:

conn  = (SocketConnection)Connector.open("socket://"+url+":"+port+";deviceside=true;interface=wifi");

is = conn.openDataInputStream();

os= conn.openDataOutputStream();

is.read(.....something....);

os.write("STARTTLS\r\n");

TLS10Connection tlsSocket = new TLS10Connection (new StreamConnectionWrapper(conn, is, os)
                ,"socket://"+url+":"+conn.getPort()+";deviceside=false;interface=wifi");

is = tlsSocket.openDataInputStream();

os= tlsSocket.openDataOutputStream();

.....

.....

But I got some exception, it seems that this connection does NOT established, tlsSocket.isConnectionEstablished() equals false. 

 

Here is my logo:

->HELO

250 BLU0-SMTP106.phx.gbl Hello [192.232.69.163]
->STARTTLS
220 2.0.0 SMTP server ready

SSL:->CH
SSL:<-SH
SSL:<-SC
SSL:<-SHD
SSL:->CKE
SSL:->CCS
SSL:->F
SSL:<-F
NVS: delete 34
NVS: write 34
NVS: erase 3631
NVS: commit 542

no stack trace.

 

need your help ,thanks

Please use plain text.