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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
daniloercoli
Posts: 49
Registered: ‎05-06-2009

TLSIOException on POSTs

[ Edited ]

I've developed an app that is used to upload pictures on the server by using HTTPS connections that stopped working suddenly last week for a bunch of users.
I've three BB devices and I can replicate the issue that the users are reporting only on one of those devices. (The issue it's not related to a specific OS version, or device model).

 

That's said, I'm getting the following error on the Java version of the app:  net.rim.device.cldc.io.ssl.TLSIOException

 

And the following is the app log:

[253.453] SSL:->CH
[253.687] SSL:<-SH
[254.039] SSL:<-SC
[254.14] SSL:<-SKE
[254.148] SSL:CKE
[254.226] SSL:->CCS
[254.234] TLS:->F
[254.64] TLS:<-F
20120413T001618Z [ERROR] [net.rim.device.cldc.io.ssl.TLSIOException] XmlRpcClient.execute Error
20120413T001619Z [ERROR] SSL communication error
20120413T001620Z [ERROR] >>> Logging the certificate details
20120413T001620Z [ERROR] SSL certificate not accepted. Reason: 0, certificate: null
20120413T001621Z [ERROR] Reason: 0
20120413T001622Z [ERROR] Certificate is null!
20120413T001623Z [ERROR] <<< Logging the certificate details

 

I enabled the debug mode on the nginx server, and noticed the following error message when the upp tried to connect to the server:

2012/04/16 21:14:38 [info] 20893#0: *359 SSL_read() failed (SSL: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac), client: 151.XX.XXX.XXX, server: _, request: "POST /xmlrpc.php HTTP/1.1", host: "XXX.XXX"

 

I thought it was an issue of the certificate installed on the server, and so I've installed the server side php app (WordPress) locally on a simple installation of XAMMP. I've enabled the SSL support by using a self-signed certificate. Unfortunately, the app works fine on HTTP, but doesn't work with HTTPS.

 

Still not happy with the tests I did, I thought to created a simple WebWorks app that send pictures to the server by using POST requests.  I created that new app on a completely different dev env (OSX), only the signing keys are the same of the Java app.  
The following is the error message I'm getting on the WebWorks app:
Code: 500
name: Error requesting resource.
I tried to upload pictures by using the HTTP protocol, and like the Java app, everything works fine on HTTP.

 

For the sake of precision I'm having this issue on a Bold9900 over WiFi. The same app installed on a Curve 9300 and on a Curve 8900 is still working fine .


I'm running out of idea, any thoughts?

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

Are you using a self signed certificate on the server as well?  A BlackBerry Enterprise Server administrator can set an IT Policy that prevents connections made through untrusted certificates.

 

You say it just started happening.  What changed recently?  Did it ever work on these devices or is this a new BlackBerry model and/or OS that you haven't ran the application on before?

 

Which BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
daniloercoli
Posts: 49
Registered: ‎05-06-2009

Re: TLSIOException on POSTs

[ Edited ]
Are you using a self signed certificate on the server as well?

We are not using a self-signed certificate on our server.

You say it just started happening. What changed recently? Did it ever work on these devices or is this a new BlackBerry model and/or OS that you haven't ran the application on before?

The app was working fine on those devices till 9th April. Then stopped working only on HTTPS ( I can post pictures on HTTP without issue). We didn't change the server configuration/software, in fact our (Android | iOS | WinPhone7 | WebOS | Nokia) apps are still working fine.

Which BlackBerry handheld software version are you testing on?

I've 3 BB devices and the app stopped working only on one of those: - BB 9900 7.0 ( Applications: v7.0.0.296 - Platform 5.0.0.496 ) I've tried to upgraded this device with the BlackBerry Handheld Software v7.0.0.2406 ( Applications: 7.0.0.585 - Software Platform: 5.0.0.734) but the issue was still there. I also did a device wipe.


Users with the following devices are reporting the same issue:

  • BB Device Name: 8520 > Platform Version: 5.2.0.64 > Software Version (OS Version): 5.0.0.59 > Network Name: VodaCom-SA 
  • BB Device Name: 8520 > Platform Version: 5.2.0.64 > Software Version: 5.0.0.592 > Network Name: MTN 
  • BB Device Model: 9780 BB Apps Version: 6.0.0.285 BB Platform Version: 6.5.0.54 
  • BB Device Model: 9700 BB Apps Version: 5.0.0.593 BB Platform Version: 5.1.0.147
Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

You mentioned that you were testing over WiFi.  Do you see different behaviour depending on the transport route being used (BES, WiFi, direct TCP, WAP 2.0) or do all fail on the devices with issues?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
daniloercoli
Posts: 49
Registered: ‎05-06-2009

Re: TLSIOException on POSTs

I've tried with WiFi and Direct TCP. (No BIS, BES, or WAP2). From the feedback I received in the last few days I can say that users with BIS are having this issue.

Another device with this issue:
Device Name: 8120
Platform Version: 2.7.0.105
Software Version: 4.5.0.174
Network Name: Orange
Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

How are you opening the connection?  Can you provide a code sample?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

Attached is a sample application that uses the 4 different options to establish a secure connection.  Give this a try and let me know the results.

 

Note that you'll need to change the server used in the URL and page in the GET command to point to your server.

 

I built this using BlackBerry Java SDK 5.0 and tried all 4 options over WiFi on a few different devices and didn't have any issue.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
daniloercoli
Posts: 49
Registered: ‎05-06-2009

Re: TLSIOException on POSTs

[ Edited ]

Thanks for the code I will give it a try. I will probably post the code of the test app (WebWorks app, simple Ajax connections) I wrote 3 days ago soon. 

 

Side note: We released the latest stable version of our app one year ago (ver 1.5 released MAY 3RD, 2011) and it worked fine till 2 weeks ago. We have a large BB user base, with a lot of new pictures and updates sent from our users on a daily basis. Everything was working fine till April 9th, while right now a lot of users are having issue. ( Eg: http://twitter.com/Mister_Mobility/statuses/193393629258199040)

The src code that opens network connections was written 3 years ago, and didn't change lately. http://blackberry.trac.wordpress.org/browser/trunk/src/com/wordpress/utils/conn

The question is, why it stopped working suddenly, while the other mobile apps are still working fine? Why the code that was working fine till April 9th is not working anymore only on 1 of my test devices? (All of the devices are attached to the same WiFi network).

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

[ Edited ]

Can you send me the full URL and port you are connecting to?  Send over private message if you like.

 

That will help with the investigation on this side.  Thanks!

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: TLSIOException on POSTs

Thank you for sending the test application.  I tried it out, but wasn't able to reproduct the TLSIOException when connected over WiFi.  I was receiving an EOFException when using HTTPS (HTTP worked fine).  This was triggered because the application was not setting the Content-Length header.  Once I added that I was able to complete the request.  I added to the ContentReaderThread as shown here (middle line).

 

con.setRequestMethod(HttpConnection.POST);
con.setRequestProperty("Content-Length", Long.toString(documentToSend.length()));
con.setRequestProperty("Content-Type", "text/xml");

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.