Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes How do I get a hold of Java's default SSL Trust Manager? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How do I get a hold of Java Watch "How do I get a hold of Java New topic
Author

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

Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
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

Joined: Dec 13, 2004
Posts: 429
Does anyone know the answer to my question?

Thanks,
Yuriy
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

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:



apigee, a better way to API!
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
Thank you!

Yuriy
Cyrille Le Clerc
Greenhorn

Joined: Jul 19, 2009
Posts: 6
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

Cyrille Le Clerc
cleclerc@xebia.fr, http://blog.xebia.fr/
 
Don't get me started about those stupid light bulbs.
 
subject: How do I get a hold of Java's default SSL Trust Manager?
 
Similar Threads
Calling URL in servlet
Loading Classes in at Runtime - NoClassDefFound
Copying a File
Best encryption and decryption algorithm using java API.
HTML form POST in java?