ucar.unidata.util
Class NaiveTrustProvider

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by java.security.Provider
                  extended by ucar.unidata.util.NaiveTrustProvider
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public final class NaiveTrustProvider
extends Provider

Provides all secure socket factories, with a socket that ignores problems in the chain of certificate trust. This is good for embedded applications that just want the encryption aspect of SSL communication, without worrying too much about validating the identify of the server at the other end of the connection. In other words, this may leave you vulnerable to a man-in-the-middle attack.

See Also:
Serialized Form

Nested Class Summary
static class NaiveTrustProvider.NaiveTrustManagerFactory
          The factory for the NaiveTrustProvider
 
Nested classes/interfaces inherited from class java.security.Provider
Provider.Service
 
Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
NaiveTrustProvider()
          Hook in at the provider level to handle libraries and 3rd party utilities that use their own factory.
 
Method Summary
static void setAlwaysTrust(boolean enableNaiveTrustProvider)
          This is the only method the client code need to call.
 
Methods inherited from class java.security.Provider
clear, elements, entrySet, get, getInfo, getName, getProperty, getService, getServices, getVersion, keys, keySet, load, put, putAll, putService, remove, removeService, toString, values
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, equals, hashCode, isEmpty, rehash, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NaiveTrustProvider

public NaiveTrustProvider()
Hook in at the provider level to handle libraries and 3rd party utilities that use their own factory. Requires permission to execute AccessController.doPrivileged, so this probably won't work in applets or other high-security jvms

Method Detail

setAlwaysTrust

public static void setAlwaysTrust(boolean enableNaiveTrustProvider)
This is the only method the client code need to call. Yup, just put NaiveTrustProvider.setAlwaysTrust() into your initialization code and you're good to go

Parameters:
enableNaiveTrustProvider - set to true to always trust (set to false it not yet implemented)