Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Writing a Custom SSL TrustManager for Eclipse
Writing a Custom SSL TrustManager for Eclipse [message #605239] Wed, 24 March 2010 17:17 Go to next message
Saminda Wijeratne is currently offline Saminda WijeratneFriend
Messages: 16
Registered: July 2009
Junior Member
I'm writing a plugin inorder to handle ssl certificates manually where user is prompted to verify invalid ssl certificates. In eclipse the default is the JRE trust manager which is most of the time com.sun.net.ssl.internal.ssl.X509TrustManagerImpl. I wrote my own trustmanager and it works fine with a normal java program. But when I tried to plug it to the JVM of the running eclipse through a plugin it doesn't work. Following is the code I use to setup the trustmanager.

SSLContext sc;
try {
TrustManager[] trustAllCerts = new TrustManager[]{new EclipseSWTTrustManager(shell)};
sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFa ctory());
HostnameVerifier allHostsValid = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid) ;
} catch (Exception e) {
e.printStackTrace();
}

eventhough the above code executes without a single exception my trustmanager class (EclipseSWTTrustManager) never gets triggered. the default trustmanager gets triggered. Any help would be appreciated.

Thanks in advance,
Saminda
Re: Writing a Custom SSL TrustManager for Eclipse [message #605301 is a reply to message #605239] Sun, 28 March 2010 07:42 Go to previous messageGo to next message
Saminda Wijeratne is currently offline Saminda WijeratneFriend
Messages: 16
Registered: July 2009
Junior Member
I still couldn't find a solution for what I want to do, but foundout that I need to set the sslsocketfactory also. And inside the socket factory we set the trust manager as above. Following is the way I setup sslsocketfactory

java.security.Security.setProperty("ssl.SocketFactory.provider ","abc.DummySSLSocketFactory");

abc.DummySSLSocketFactory is the fully qualified name of the class I have in my plugin which implements the socketfactory. This time it seemed to be the correct path because whenever I was trying to access a url from where ever in my plugin code a class not found exception is thrown for abc.DummySSLSocketFactory class.

So the problem has boiled down to why the class loader cannot locate the class. I'm exported the abc package from the bundle, and even I put the abc.DummySSLSocketFactory in a separate extention bundle for the system bundle (thinking that the classloader was unable to see classes inside other bundles), but still i get the class not found error.

So now its a classloading issue only (hopefully). Any help would be appreciated.
Re: Writing a Custom SSL TrustManager for Eclipse [message #605818 is a reply to message #605301] Wed, 19 May 2010 11:37 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: May 2010
Junior Member
Hi, Am facing exactly the same issue you have posted in your first message. I have created new TrustManager and Provider implementation. But while SSLSocket creation happens, its loading my trust manager implementation.
Were you able to reach anywhere in the problem
Re: Writing a Custom SSL TrustManager for Eclipse [message #605820 is a reply to message #605818] Wed, 19 May 2010 12:51 Go to previous message
Saminda Wijeratne is currently offline Saminda WijeratneFriend
Messages: 16
Registered: July 2009
Junior Member
Nop. never had the time to look at it again. I cant exactly think of a starting point to crack this issue other than debugging the eclipse source. Will update this thread if I find somethign useful. Hope u'll get luckier.
Previous Topic:Writing a Custom SSL TrustManager for Eclipse
Next Topic:PDE/API Tools: compare with API baseline
Goto Forum:
  


Current Time: Wed Apr 24 14:11:36 GMT 2024

Powered by FUDForum. Page generated in 0.03169 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top