Class SSLContexts


  • public final class SSLContexts
    extends java.lang.Object
    SSLContext factory methods.

    Please note: the default Oracle JSSE implementation of SSLContext#init(KeyManager[], TrustManager[], SecureRandom) accepts multiple key and trust managers, however only only first matching type is ever used. See for example: SSLContext.html#init

    Since:
    4.4
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SSLContexts()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.net.ssl.SSLContext createDefault()
      Creates default factory based on the standard JSSE trust material (cacerts file in the security properties directory).
      static javax.net.ssl.SSLContext createSystemDefault()
      Creates default SSL context based on system properties.
      static SSLContextBuilder custom()
      Creates custom SSL context.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SSLContexts

        private SSLContexts()
    • Method Detail

      • createDefault

        public static javax.net.ssl.SSLContext createDefault()
                                                      throws SSLInitializationException
        Creates default factory based on the standard JSSE trust material (cacerts file in the security properties directory). System properties are not taken into consideration.
        Returns:
        the default SSL socket factory
        Throws:
        SSLInitializationException - if NoSuchAlgorithmException or KeyManagementException are thrown when invoking SSLContext.getInstance(String)
      • createSystemDefault

        public static javax.net.ssl.SSLContext createSystemDefault()
                                                            throws SSLInitializationException
        Creates default SSL context based on system properties. This method obtains default SSL context by calling SSLContext.getInstance("Default"). Please note that Default algorithm is supported as of Java 6. This method will fall back onto createDefault() when Default algorithm is not available.
        Returns:
        default system SSL context
        Throws:
        SSLInitializationException - if createDefault() throws it
      • custom

        public static SSLContextBuilder custom()
        Creates custom SSL context.
        Returns:
        default system SSL context