Hello

I try to set up a secure connection via SSL. I get the following
handshake error:

java.io.IOException: SSL handshake failure: Failure in SSL library,
usually a protocol error error:14094410:SSL
routines:SSL3_READ_BYTES:sslv3 alert handshake failure

My App creates a certificate request, send it to a server and get an
certificate (pem string).
I store the certificate as a .p12 file (PKCS12). This works well so
far... But  when i try to access the webservice with a httpclient i
get the handshake error..

some code snippets:

//creating the pkcs12 file
FileOutputStream fOut = new FileOutputStream(certPath);
store = KeyStore.getInstance("PKCS12");
store.load(null, null);
store.setKeyEntry("alias", keyPair, "password".toCharArray(), chain);
store.store(fOut, "".toCharArray());
fOut.flush();
fOut.close();

//loading the keystore for preparing the ssl connection
trusted = KeyStore.getInstance(KeyStore.getDefaultType());
File directory = getDir("data", Context.MODE_PRIVATE);
String fileName = directory.getAbsolutePath() + "/cert.p12";
FileInputStream fis = new FileInputStream(fileName);
trusted.load(fis, "".toCharArray());
fis.close();

//httpclient init
HttpParams parameters = new BasicHttpParams();
SchemeRegistry schemeRegistry = new SchemeRegistry();

schemeRegistry.register(new Scheme("https", SSLSF, 443));
ClientConnectionManager manager = new ThreadSafeClientConnManager(
parameters, schemeRegistry);
HttpClient httpclient = new DefaultHttpClient(manager, parameters);

HttpPost httppost = new HttpPost(URL);
httppost.setHeader("Content-Type",  "text/xml; charset=UTF-8");
httppost.setHeader("SOAPAction",  SOAP_ACTION);

final StringBuffer soap = new StringBuffer();
soap.append(soapMessage);

HttpEntity entity = new StringEntity(soap.toString());
httppost.setEntity(entity);
HttpResponse response = httpclient.execute(httppost);  //fails with
the handshake error...

Many thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" 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-security-discuss?hl=en.

Reply via email to