hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Vernet <aver...@scdi.org>
Subject No private keys found in keystore
Date Fri, 27 Jun 2008 23:25:01 GMT

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: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message