File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I get a hold of Java's default SSL Trust Manager?

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need my program to be able to make HTTPS posts. I know that you can disable server authentication by creating a new X509TrustManager as described here: http://www.exampledepot.com/egs/javax.net.ssl/TrustAll.html?l=rel. But what I really want is for my X509TrustManager to wrap the default TrustManager. Then if the default TM throws a CertificationException, my own X509TrustManager will have the option to squash it on a case-by-case basis.

So the question is, how do I get a hold of the JVM's default Trust Manager?

Thank you,
Yuriy
[ February 28, 2007: Message edited by: Yuriy Zilbergleyt ]
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know the answer to my question?

Thanks,
Yuriy
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can follow the following link:

http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html#TrustManager

The following code is copied from the above link and is what you want:

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!

Yuriy
 
Cyrille Le Clerc
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Here is a sample of code to get the JVM's default Trust Managers :


I get the following result on my Apple 1.6.0_17 JVM :

JVM Default Trust Managers:
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl@687b6889
Accepted issuers count : 163


Hope this helps,

Cyrille
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic