I am using AuthSSLProtocolSocketFactory as I need to sent my client
certificate when talking to server. I do this with the following code:

Protocol authhttps = new Protocol("https",
        (ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(
                new URL("file:///path/to/keystore"), "importkey",
                new URL("file:///path/to/truststore"), "importkey"), 443);
Protocol.registerProtocol("https", authhttps);
HttpClient client = new HttpClient();
GetMethod fileGet = new GetMethod("https://server/path";);
int status = client.executeMethod(fileGet);

This gives me the following exception:

Exception in thread "main" java.security.KeyStoreException: No private keys
found in keystore!
        at
org.apache.commons.ssl.KeyStoreBuilder.validate(KeyStoreBuilder.java:269)
        at 
org.apache.commons.ssl.KeyStoreBuilder.build(KeyStoreBuilder.java:129)
        at org.apache.commons.ssl.KeyMaterial.<init>(KeyMaterial.java:179)
        at org.apache.commons.ssl.KeyMaterial.<init>(KeyMaterial.java:170)
        at org.apache.commons.ssl.KeyMaterial.<init>(KeyMaterial.java:160)
        at org.apache.commons.ssl.KeyMaterial.<init>(KeyMaterial.java:64)
        at org.apache.commons.ssl.KeyMaterial.<init>(KeyMaterial.java:139)
        at
org.apache.commons.httpclient.contrib.ssl.AuthSSLProtocolSocketFactory.<init>(AuthSSLProtocolSocketFactory.java:191)

But the key store I am pointing to does contain a key. This is what I get
when running "keytool -list -keystore keystore":

Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

importkey, Jun 26, 2008, keyEntry,
Certificate fingerprint (MD5):
75:62:FE:32:9F:CE:5F:12:8D:26:CC:02:06:B8:35:B2

Any idea on why I could be getting this exception?

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

-- 
View this message in context: 
http://www.nabble.com/No-private-keys-found-in-keystore-tp18165598p18165598.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to