| java.lang.Object | |
| ↳ | javax.net.ssl.SSLContext |
Instances of this class represent a secure socket protocol
implementation which acts as a factory for secure socket
factories or SSLEngines. This class is initialized
with an optional set of key and trust managers and source of
secure random bytes.
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates an SSLContext object.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
SSLEngine using this context using
advisory peer information. | |||||||||||
Creates a new
SSLEngine using this context. | |||||||||||
Returns the client session context, which represents the set of
SSL sessions available for use during the handshake phase of
client-side SSL sockets.
| |||||||||||
Returns the default SSL context.
| |||||||||||
Returns a copy of the SSLParameters indicating the default
settings for this SSL context.
| |||||||||||
Returns a
SSLContext object that implements the
specified secure socket protocol. | |||||||||||
Returns a
SSLContext object that implements the
specified secure socket protocol. | |||||||||||
Returns a
SSLContext object that implements the
specified secure socket protocol. | |||||||||||
Returns the protocol name of this
SSLContext object. | |||||||||||
Returns the provider of this
SSLContext object. | |||||||||||
Returns the server session context, which represents the set of
SSL sessions available for use during the handshake phase of
server-side SSL sockets.
| |||||||||||
Returns a
ServerSocketFactory object for
this context. | |||||||||||
Returns a
SocketFactory object for this
context. | |||||||||||
Returns a copy of the SSLParameters indicating the supported
settings for this SSL context.
| |||||||||||
Initializes this context.
| |||||||||||
Sets the default SSL context.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Creates an SSLContext object.
| contextSpi | the delegate |
|---|---|
| provider | the provider |
| protocol | the protocol |
Creates a new SSLEngine using this context using
advisory peer information.
Applications using this factory method are providing hints for an internal session reuse strategy.
Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.
| peerHost | the non-authoritative name of the host |
|---|---|
| peerPort | the non-authoritative port |
SSLEngine object| UnsupportedOperationException | if the underlying provider does not implement the operation. |
|---|---|
| IllegalStateException | if the SSLContextImpl requires
initialization and the init() has not been called |
Creates a new SSLEngine using this context.
Applications using this factory method are providing no hints
for an internal session reuse strategy. If hints are desired,
createSSLEngine(String, int) should be used
instead.
Some cipher suites (such as Kerberos) require remote hostname information, in which case this factory method should not be used.
SSLEngine object| UnsupportedOperationException | if the underlying provider does not implement the operation. |
|---|---|
| IllegalStateException | if the SSLContextImpl requires
initialization and the init() has not been called |
Returns the client session context, which represents the set of SSL sessions available for use during the handshake phase of client-side SSL sockets.
This context may be unavailable in some environments, in which case this method returns null. For example, when the underlying SSL provider does not provide an implementation of SSLSessionContext interface, this method returns null. A non-null session context is returned otherwise.
Returns the default SSL context.
If a default context was set using the SSLContext.setDefault() method, it is returned. Otherwise, the first
call of this method triggers the call
SSLContext.getInstance("Default").
If successful, that object is made the default SSL context and returned.
The default context is immediately
usable and does not require initialization.
| NoSuchAlgorithmException | if the
SSLContext.getInstance() call fails |
|---|
Returns a copy of the SSLParameters indicating the default settings for this SSL context.
The parameters will always have the ciphersuites and protocols arrays set to non-null values.
| UnsupportedOperationException | if the default SSL parameters could not be obtained. |
|---|
Returns a SSLContext object that implements the
specified secure socket protocol.
A new SSLContext object encapsulating the SSLContextSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.
Note that the list of registered providers may be retrieved via
the Security.getProviders() method.
| protocol | the standard name of the requested protocol. See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names. |
|---|---|
| provider | the name of the provider. |
SSLContext object.| NoSuchAlgorithmException | if a SSLContextSpi implementation for the specified protocol is not available from the specified provider. |
|---|---|
| NoSuchProviderException | if the specified provider is not registered in the security provider list. |
| IllegalArgumentException | if the provider name is null or empty. |
Returns a SSLContext object that implements the
specified secure socket protocol.
A new SSLContext object encapsulating the SSLContextSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
| protocol | the standard name of the requested protocol. See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names. |
|---|---|
| provider | an instance of the provider. |
SSLContext object.| NoSuchAlgorithmException | if a KeyManagerFactorySpi implementation for the specified protocol is not available from the specified Provider object. |
|---|---|
| IllegalArgumentException | if the provider name is null. |
Returns a SSLContext object that implements the
specified secure socket protocol.
This method traverses the list of registered security Providers, starting with the most preferred Provider. A new SSLContext object encapsulating the SSLContextSpi implementation from the first Provider that supports the specified protocol is returned.
Note that the list of registered providers may be retrieved via
the Security.getProviders() method.
| protocol | the standard name of the requested protocol. See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names. |
|---|
SSLContext object.| NoSuchAlgorithmException | if no Provider supports a TrustManagerFactorySpi implementation for the specified protocol. |
|---|
Returns the protocol name of this SSLContext object.
This is the same name that was specified in one of the
getInstance calls that created this
SSLContext object.
SSLContext object.
Returns the provider of this SSLContext object.
SSLContext object
Returns the server session context, which represents the set of SSL sessions available for use during the handshake phase of server-side SSL sockets.
This context may be unavailable in some environments, in which case this method returns null. For example, when the underlying SSL provider does not provide an implementation of SSLSessionContext interface, this method returns null. A non-null session context is returned otherwise.
Returns a ServerSocketFactory object for
this context.
ServerSocketFactory object| IllegalStateException | if the SSLContextImpl requires
initialization and the init() has not been called
|
|---|
Returns a SocketFactory object for this
context.
SocketFactory object| IllegalStateException | if the SSLContextImpl requires
initialization and the init() has not been called
|
|---|
Returns a copy of the SSLParameters indicating the supported settings for this SSL context.
The parameters will always have the ciphersuites and protocols arrays set to non-null values.
| UnsupportedOperationException | if the supported SSL parameters could not be obtained. |
|---|
Initializes this context. Either of the first two parameters may be null in which case the installed security providers will be searched for the highest priority implementation of the appropriate factory. Likewise, the secure random parameter may be null in which case the default implementation will be used.
Only the first instance of a particular key and/or trust manager implementation type in the array is used. (For example, only the first javax.net.ssl.X509KeyManager in the array will be used.)
| km | the sources of authentication keys or null |
|---|---|
| tm | the sources of peer authentication trust decisions or null |
| random | the source of randomness for this generator or null |
| KeyManagementException | if this operation fails |
|---|
Sets the default SSL context. It will be returned by subsequent calls
to getDefault(). The default context must be immediately usable
and not require initialization.
| context | the SSLContext |
|---|
| NullPointerException | if context is null |
|---|---|
| SecurityException | if a security manager exists and its
checkPermission method does not allow
SSLPermission("setDefaultSSLContext") |