Hi

First chek for ur client side certificate.
Android only support BKS certificate.

First ensure for client side certificate and use following code
this will work


SSLSocketFactory SSLSF = *new* SSLSocketFactory(trusted);

schemeRegistry.register(*new* Scheme("https", SSLSF, 443));

ClientConnectionManager manager = *new* ThreadSafeClientConnManager(

parameters, schemeRegistry);

HttpClient httpClient = *new* DefaultHttpClient(manager, parameters);

 httpClient.getParams().setParameter("http.connection.timeout",
*new*Integer(3000));

HttpGet ping = *new* HttpGet("https://10.10.60.7:8443";);

HttpResponse response = httpClient.execute(ping);

*int* status = response.getStatusLine().getStatusCode();

*if* (status == 200) {

InputStream content = response.getEntity().getContent();

*int* c = -1;

StringBuffer buffer = *new* StringBuffer();

*while* ((c = content.read()) != -1) {

buffer.append((*char*) c);

}

content.close();

Log.*i*("EXAMPLE", buffer.toString());

} *else* {

Log.*i*("EXAMPLE", status + "");

}
regards

On Wed, Mar 3, 2010 at 4:31 PM, gemini <[email protected]> wrote:

> Hello,
>
>    I'm working on an application which communicates with remote
> server to fetch data.
> Server requires a client certificate authentication. I'm adding the
> certificate to the keystore. But while connecting, I always get
>
>  java.io.IOException: SSL handshake failure: Failure in SSL
> library,usually a protocol error
>  error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake
> failure (external/openssl/ssl/s3_pkt.c:1053 0x1be510:0x00000003)
>
>  Similar code works without any issue from desktop client.
>  Below is snippet :-
>
> ==================
>
>
>  SSLSocketFactory sslSocketFactory = new SSLSocketFactory(key,"test");
>
>       HttpParams parameters = new BasicHttpParams();
>
>    SchemeRegistry schemeRegistry = new SchemeRegistry();
>
>       schemeRegistry.register(new Scheme("https", sslSocketFactory,
> 443));
>
>    ClientConnectionManager manager = new
> ThreadSafeClientConnManager(parameters, schemeRegistry);
>
>     HttpClient httpClient = new
> DefaultHttpClient(manager,parameters);
>
>     HttpGet ping = new 
> HttpGet("https://192.168.1.45:443<https://192.168.1.45/>
> ");
>      HttpResponse response = httpClient.execute(cmd);   --> error is
> thrown here
>
> ==========
>
>   Any help is appreciated. Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to