SSLContext

Instances of this class represent a secure socket protocol implementation which acts as a factory for secure socket factories or <code>SSLEngine</code>s. This class is initialized with an optional set of key and trust managers and source of secure random bytes.

<p> Every implementation of the Java platform is required to support the following standard <code>SSLContext</code> protocol: <ul> <li><tt>TLSv1</tt></li> </ul> This protocol is described in the <a href= "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext"> SSLContext section</a> of the Java Cryptography Architecture Standard Algorithm Name Documentation. Consult the release documentation for your implementation to see if any other algorithms are supported.

Constructors

this
this(SSLContextSpi contextSpi, string protocol)

Creates an SSLContext object.

Members

Functions

createSSLEngine
SSLEngine createSSLEngine(bool clientMode, string peerHost, int peerPort)

Creates a new <code>SSLEngine</code> using this context using advisory peer information. <P> Applications using this factory method are providing hints for an internal session reuse strategy. <P> Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.

createSSLEngine
SSLEngine createSSLEngine(bool clientMode)

Creates a new <code>SSLEngine</code> using this context. <P> Applications using this factory method are providing no hints for an internal session reuse strategy. If hints are desired, {@link #createSSLEngine(string, int)} should be used instead. <P> Some cipher suites (such as Kerberos) require remote hostname information, in which case this factory method should not be used.

getClientSessionContext
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. <P> 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.

getProtocol
string getProtocol()

Returns the protocol name of this <code>SSLContext</code> object.

getServerSessionContext
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. <P> 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.

initialize
void initialize(KeyCertOptions options)

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. <P> 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.)

Static functions

getInstance
SSLContext getInstance(KeyCertOptions options, string protocol)

Returns a <code>SSLContext</code> object that implements the specified secure socket protocol.

setDefault
void setDefault(SSLContext context)

Sets the default SSL context. It will be returned by subsequent calls to {@link #getDefault}. The default context must be immediately usable and not require {@linkplain #init initialization}.

Meta