Top Description Constructors Methods
org.apache.hc.core5.ssl

public final Class SSLContexts

extends Object
Class Inheritance
Imports
java.security.KeyManagementException, .NoSuchAlgorithmException, javax.net.ssl.SSLContext

javax.net.ssl.SSLContext factory methods.

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

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SSLContext

Returns:

the default SSL socket factory
createDefault
()

Creates default factory based on the standard JSSE trust material (cacerts file in the security properties directory).

public static SSLContext

Returns:

default system SSL context
createSystemDefault
()

Creates default SSL context based on system properties.

public static SSLContextBuilder

Returns:

default system SSL context
custom
()

Creates custom SSL context.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SSLContextsback to summary
private SSLContexts()

Method Detail

createDefaultback to summary
public static 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:SSLContext

the default SSL socket factory

Exceptions
SSLInitializationException:
if NoSuchAlgorithmException or KeyManagementException are thrown when invoking SSLContext#getInstance(String)
createSystemDefaultback to summary
public static 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:SSLContext

default system SSL context

Exceptions
SSLInitializationException:
if createDefault() throws it
customback to summary
public static SSLContextBuilder custom()

Creates custom SSL context.

Returns:SSLContextBuilder

default system SSL context