4

i'm working on an application for android devices( 2.2). I'm trying to get an html page.The java code I use seems to work, so I can obtain the page I want, but sometimes the app crashes and i get the exception: "no peer certificate". When this happens, if I wait one hour or I change network, it works normally. Does someone know how to solve this? The site is https://stud.infostud.uniroma1.it/Sest/Log/

I'm really sorry about my english, I hope you'll understand!

user1071138
  • 656
  • 3
  • 12
  • 30

2 Answers2

7

When I was getting that exception it was because my phones date was not correctly set. I just switched back to using the network provided date and everything worked.

Tyler
  • 137
  • 2
  • 8
  • Confirming that: when the date of my tablet was reset to some day in January 2002, I could not connect to the internet using the Play Store or the Gmail client (but the browser could connect to the internet). The log would say: 01-02 11:12:41.760: E/Gmail(995): IOException: com.android.org.bouncycastle.jce.exception.ExtCert PathValidatorException: Could not validate certificate: current time: Fri Jan 02 11:12:41 HNEC 1970, validation time: Mon Jun 08 22:43:27 HNEC 2009. Changing the date/time to the correct one, fixed the problem. – gfour Jun 15 '12 at 23:06
-1

Try putting this before you make the network call:

System.setProperty("http.keepAlive", "false");

It sounds like you're having issues with a known issue that causes Android to break when trying to be clever with its connections. If that doesn't work check here

Community
  • 1
  • 1
FunkTheMonk
  • 10,908
  • 1
  • 31
  • 37
  • Do you have a 2.3 device handy (could try the emulator). If that works, there's an issue with the certificate - Android 2.2 or earlier doesn't trust many CAs – FunkTheMonk Dec 05 '11 at 09:49
  • I've already tried with other version(2.3 too)...same problem. When I got the problem, I tried to connect with the phone browser and I got the same exception. With my laptop everything works. – user1071138 Dec 05 '11 at 09:58
  • I have noticed only now that: the server use 256-bit cryptography with AES_256_CBC SHA1 for authentication message, and RSA for keys exchange.. also, server use TLS 1.0! can be this the issue? how can i solve it? Thanks a lot! ;) – user1071138 Dec 07 '11 at 15:01