java.lang.Object
javax.net.ssl.SSLContext
public class SSLContext extends Object
Instances of this class represent a secure socket protocol
implementation which acts as a factory for secure socket
factories or
SSLEngine
s. This class is initialized
with an optional set of key and trust managers and source of
secure random bytes.
Every implementation of the Java platform is required to support the
following standard SSLContext
protocol:
TLSv1.2
- Since:
- 1.4
-
Constructor Summary
Constructors Modifier Constructor Description protected
SSLContext(SSLContextSpi contextSpi, Provider provider, String protocol)
Creates an SSLContext object. -
Method Summary
Modifier and Type Method Description SSLEngine
createSSLEngine()
Creates a newSSLEngine
using this context.SSLEngine
createSSLEngine(String peerHost, int peerPort)
Creates a newSSLEngine
using this context using advisory peer information.SSLSessionContext
getClientSessionContext()
Returns the client session context, which represents the set of SSL sessions available for use during the handshake phase of client-side SSL sockets.static SSLContext
getDefault()
Returns the default SSL context.SSLParameters
getDefaultSSLParameters()
Returns a copy of the SSLParameters indicating the default settings for this SSL context.static SSLContext
getInstance(String protocol)
Returns aSSLContext
object that implements the specified secure socket protocol.static SSLContext
getInstance(String protocol, String provider)
Returns aSSLContext
object that implements the specified secure socket protocol.static SSLContext
getInstance(String protocol, Provider provider)
Returns aSSLContext
object that implements the specified secure socket protocol.String
getProtocol()
Returns the protocol name of thisSSLContext
object.Provider
getProvider()
Returns the provider of thisSSLContext
object.SSLSessionContext
getServerSessionContext()
Returns the server session context, which represents the set of SSL sessions available for use during the handshake phase of server-side SSL sockets.SSLServerSocketFactory
getServerSocketFactory()
Returns aServerSocketFactory
object for this context.SSLSocketFactory
getSocketFactory()
Returns aSocketFactory
object for this context.SSLParameters
getSupportedSSLParameters()
Returns a copy of the SSLParameters indicating the supported settings for this SSL context.void
init(KeyManager[] km, TrustManager[] tm, SecureRandom random)
Initializes this context.static void
setDefault(SSLContext context)
Sets the default SSL context.