2.2 froyo ssl handshake failure with DefaultHttpClient

Showing 1-3 of 3 messages
2.2 froyo ssl handshake failure with DefaultHttpClient Weng 5/26/10 7:54 AM
Hi,

I have an application that connects to an URL using https. It runs
fine on 1.5, 1.6 and 2.1. I tried to run it on 2.2 but I get the
following exception:

05-26 14:10:25.305: ERROR/NativeCrypto(285): Unknown error 5 during
connect
 java.io.IOException: SSL handshake failure: I/O error during system
call, Unknown error: 0
     at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeconnect(Native
Method)
     at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:
316)
     at
org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:
92)
     at
org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:
381)
     at
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:
164)
     at
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:
164)
     at
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:
119)
     at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
348)
     at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
555)
     at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
487)
     at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
465)
         ...
     at android.os.AsyncTask$2.call(AsyncTask.java:185)
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:
305)
     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
     at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1068)
     at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:561)
     at java.lang.Thread.run(Thread.java:1096)

This is the code:

SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http",
PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https",
SSLSocketFactory.getSocketFactory(), 443));

HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setUseExpectContinue(params, false);

ClientConnectionManager cm = new ThreadSafeClientConnManager(params,
schemeRegistry);
httpClient = new DefaultHttpClient(cm, params);

try {
        HttpUriRequest httpUriRequest = ......
        //Works on 1.5, 1.6, 2.1
        //Throws the exception on 2.2
        HttpResponse httpResponse = httpClient.execute(httpUriRequest);
        ...
} catch (IOException e){
        ...
}


As you can see, I'm using the default httpclient and
connectionmanager. It is hard to debug because I don't have the source
code. Has anything changed in the SSL implementation? Is there a
solution/workaround? Or is this just a plain bug I need to report?

Thnx in advance

Re: [android-developers] 2.2 froyo ssl handshake failure with DefaultHttpClient Mark Murphy 5/26/10 8:06 AM
Weng wrote:
> As you can see, I'm using the default httpclient and
> connectionmanager. It is hard to debug because I don't have the source
> code. Has anything changed in the SSL implementation? Is there a
> solution/workaround? Or is this just a plain bug I need to report?

Try:

http://stackoverflow.com/questions/2899079/custom-ssl-handling-stopped-working-on-android-2-2-froyo

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

Re: 2.2 froyo ssl handshake failure with DefaultHttpClient Weng 5/27/10 6:33 AM
Thanks, but I've already seen and tried this solution but it doesn't
work.

On 26 mei, 17:06, Mark Murphy <mmur...@commonsware.com> wrote:
> Weng wrote:
> > As you can see, I'm using the default httpclient and
> > connectionmanager. It is hard to debug because I don't have the source
> > code. Has anything changed in theSSLimplementation? Is there a

> > solution/workaround? Or is this just a plain bug I need to report?
>
> Try:
>
> http://stackoverflow.com/questions/2899079/custom-ssl-handling-stoppe...
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

>
> Android Training in US: 14-18 June 2010:http://bignerdranch.com