Urgent : Unable to load Keystore

Hi,

I have HTTPS Client with client authendication

When I load my keystore using KeyManagerfactory the client is not sending its certificate to the server

and I am getting the below error in server

-

Thread-0, handling exception: javax.net.ssl.SSLHandshakeException: null cert chain

IOException occurred when processing request.

But If I load the keystore using system property as below it works fine , the client sends the certificate chain to the server

System.setProperty("javax.net.ssl.keyStoreType", "JKS");

System.setProperty("javax.net.ssl.keyStore", KEYSTORE);

System.setProperty("javax.net.ssl.keyStorePassword", "password");

But I want to load the Keystore using KeyManagerFactory.Can anyone tell whats wrong in the below code

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("javax.net.debug", "all");

KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");

KeyStore keystore = KeyStore.getInstance("JKS");

keystore.load(new FileInputStream(KEYSTORE), KEYSTOREPW);

kmf.init(keystore, KEYPW);

TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");

KeyStore truststore = KeyStore.getInstance("jks");

truststore.load(new FileInputStream(TRUSTSTORE), TRUSTSTOREPW);

tmf.init(truststore);

SSLContext sslc = SSLContext.getInstance("SSLv3");

sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);

HttpsURLConnection urlc = (HttpsURLConnection)new URL(urlString).openConnection();

urlc.setHostnameVerifier(new TrustAllHostnames());

urlc.setDefaultSSLSocketFactory(sslc.getSocketFactory());

BufferedReader reader = new BufferedReader(new InputStreamReader(urlc.getInputStream()));

String line;

-

Thanks in advance,

Babu

[1884 byte] By [babuce@gmail.coma] at [2007-10-3 8:47:39]
# 1
Looks ok. You can get rid of the lineSecurity.addProvider(new com.sun.net.ssl.internal.ssl.Provider());if you are using Java >= 1.4. Is there anything in your keystore?
ejpa at 2007-7-15 3:56:41 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2
Hi ,Thanks for your response. I have removed the line Security.addProvider but it did not work.I have the private key and certificate in keystore.Thanks,Babu
babuce@gmail.coma at 2007-7-15 3:56:41 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 3
Can you turn on -Djavax.net.debug=ssl,handshake,keymanager at the client and show us what it says.
ejpa at 2007-7-15 3:56:41 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...