Reputation: 105143
I'm trying to create my own implementation of javax.net.ssl.SSLSocketFactory
, in order to catch all HTTP/SSL requests, send by a third-party library, and log them. This is how the factory is called in that library (it's commons-httpclient):
import javax.net.ssl.SSLSocketFactory;
// ...
return SSLSocketFactory.getDefault().createSocket(host, port);
Current implementation used is com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
. How can I change it to my own custom class?
Upvotes: 3
Views: 14958
Reputation: 1375
From http://download.oracle.com/javase/1.4.2/docs/api/javax/net/ssl/SSLSocketFactory.html:
(...) The default implementation can be changed by setting the value of the "ssl.SocketFactory.provider" security property (in the Java security properties file) to the desired class.
More information about defining your own security policy file can be found at http://download.oracle.com/javase/1.4.2/docs/guide/security/PolicyFiles.html.
It seems that you can only change that property at the JSM level, and not for each project. In Windows, you can find that file at Java\jre6\lib\security\java.security.
Upvotes: 7