Definitely a bug! Horrible oversight on my part. Thanks, Ole, for
spotting it!
I'll have 0.3.1 out by 10:00AM tomorrow with a fix.
0.3.1 also has an exciting new feature: full support of openssl style
private keys (encrypted or plain), as well as pkcs8 keys (encrypted or
plain). DER or PEM. Doesn't matter.
yours,
Julius
ps. Here's the bug:
public Socket createSocket(Socket s, String remoteHost, int remotePort, boolean
autoClose)
throws IOException, UnknownHostException {
SSLSocketFactory sf = getSSLSocketFactory();
SSLSocket ss = (SSLSocket) sf.createSocket(s, remoteHost, remotePort,
autoClose);
doPreConnectSocketStuff(ss);
doPostConnectSocketStuff(ss, remoteHost);
return sslWrapperFactory.wrap( (SSLSocket) s );
// return ss;
}
This line:
return sslWrapperFactory.wrap( (SSLSocket) s );
Needs to be:
return sslWrapperFactory.wrap( (SSLSocket) ss );
I was trying to cast the plain socket! What's wrong with me!
yours,
Julius
On Tue, 2006-14-11 at 15:10 +0000, [EMAIL PROTECTED] wrote:
> Hi all,
>
> strange problem; after switching to commons-ssl-0.3.0 from a previous
> snapshot release we get the following classcastexception;
>
> java.lang.ClassCastException: java.net.Socket
> at org.apache.commons.ssl.SSL.createSocket(SSL.java:358)
> at org.apache.commons.ssl.SSLClient.createSocket(SSLClient.java:206)
> at
> org.apache.commons.httpclient.HttpConnection.tunnelCreated(HttpConnection.java:785)
>
> atorg.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.tunnelCreated(MultiThreadedHttpConnectionManager.java:1481)
>
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeConnect(HttpMethodDirector.java:513)
>
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:390)
>
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
>
> when executing a PostMethod for an SSL connection with a custom truststore.
> When reverting back to a pre-0.3.0 version of commons-ssl it works..
>
> any ideas?
>
> regards,
>
> /Ole
> eviware.com
>
>
--
Julius Davies
Senior Application Developer, Technology Services
Credit Union Central of British Columbia
http://www.cucbc.com/
Tel: 416-652-0183
Cel: 647-232-7571
1441 Creekside Drive
Vancouver, BC
Canada
V6J 4S7
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]