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 Contributor
Posts: 6
Registered: ‎03-13-2011
My Device: 9800 torch
My Carrier: software engineer intern

I can't establish a SSL/TLS connection after post "STARTTLS" command

[ Edited ]

Hi all:

        I'm trying to implement a post  mail function in an application and when the server ask me to "post 'STARTTLS' command first" , it's really hard for me.

       I've viewed this forum and read some topic carefully

      http://supportforums.blackberry.com/t5/Java-Development/Switching-to-SSL-after-connection-opened-i-e...

 

       and my code is as below:

      

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

 

       DataInputStream   is = conn.openDataInputStream();

       DataOutputStream os = conn.openDataOutputStream();

       ...........

      ...............

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

     

 

--------------------------------------------------------------------------------------------------------------

error comes from here

--------------------------------------------------------------------------------------------------------------

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

 

is = tlsSocket.openDataInputStream();

os= tlsSocket.openDataOutputStream();

 

This TLS connection does NOT established. Curiously it seems that the connection does finish the handshake with server .

below is  my log

 

->STARTTLS
220 2.0.0 SMTP server ready

SSL:->CH
SSL:<-SH
SSL:<-SC
SSL:<-SHD
SSL:->CKE
SSL:->CCS
SSL:->F
SSL:<-F

 

I just dont know why the server send FINISH message to me but this connection isn't avaiable.

Anyone firmilar with or have implemented the STARTTLS issue please share your experience with me

need your help```

 

cheers