# SSLContextSpi

public abstract class **SSLContextSpi** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
This class defines the *Service Provider Interface* (**SPI** )
for the `SSLContext` class.

All the abstract methods in this class must be implemented by each
cryptographic service provider who wishes to supply the implementation
of a particular SSL context.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html`

### Public Constructor Summary

|---|---|
|   | [SSLContextSpi](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#SSLContextSpi())() |

### Protected Method Summary

|---|---|
| abstract [SSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngine.html) | [engineCreateSSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineCreateSSLEngine())() Creates a new `SSLEngine` using this context. |
| abstract [SSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngine.html) | [engineCreateSSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineCreateSSLEngine(java.lang.String,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) host, int port) Creates a `SSLEngine` using this context. |
| abstract [SSLSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSessionContext.html) | [engineGetClientSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetClientSessionContext())() Returns a client `SSLSessionContext` object for this context. |
| [SSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html) | [engineGetDefaultSSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetDefaultSSLParameters())() Returns a copy of the SSLParameters indicating the default settings for this SSL context. |
| abstract [SSLSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSessionContext.html) | [engineGetServerSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetServerSessionContext())() Returns a server `SSLSessionContext` object for this context. |
| abstract [SSLServerSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLServerSocketFactory.html) | [engineGetServerSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetServerSocketFactory())() Returns a `ServerSocketFactory` object for this context. |
| abstract [SSLSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSocketFactory.html) | [engineGetSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetSocketFactory())() Returns a `SocketFactory` object for this context. |
| [SSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html) | [engineGetSupportedSSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineGetSupportedSSLParameters())() Returns a copy of the SSLParameters indicating the maximum supported settings for this SSL context. |
| abstract void | [engineInit](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineInit(javax.net.ssl.KeyManager[],%20javax.net.ssl.TrustManager[],%20java.security.SecureRandom))([KeyManager\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/KeyManager.html) km, [TrustManager\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/TrustManager.html) tm, [SecureRandom](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/SecureRandom.html) sr) Initializes this context. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**SSLContextSpi**
()

<br />

## Protected Methods

#### protected abstract [SSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngine.html)
**engineCreateSSLEngine**
()

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,
`https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContextSpi.html#engineCreateSSLEngine(java.lang.String,%20int)` should be used
instead.


Some cipher suites (such as Kerberos) require remote hostname
information, in which case this factory method should not be used.

##### Returns

- the `SSLEngine` Object

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if the SSLContextImpl requires initialization and the `engineInit()` has not been called |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#createSSLEngine()`

#### protected abstract [SSLEngine](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngine.html)
**engineCreateSSLEngine**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) host, int port)

Creates a `SSLEngine` using this context.


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.

##### Parameters

| host | the non-authoritative name of the host |
| port | the non-authoritative port |
|---|---|

##### Returns

- the `SSLEngine` Object

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if the SSLContextImpl requires initialization and the `engineInit()` has not been called |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#createSSLEngine(java.lang.String,%20int)`

#### protected abstract [SSLSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSessionContext.html)
**engineGetClientSessionContext**
()

Returns a client `SSLSessionContext` object for
this context.

##### Returns

- the `SSLSessionContext` object

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#getClientSessionContext()`

#### protected [SSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html)
**engineGetDefaultSSLParameters**
()

Returns a copy of the SSLParameters indicating the default
settings for this SSL context.

The parameters will always have the ciphersuite and protocols
arrays set to non-null values.

The default implementation obtains the parameters from an
SSLSocket created by calling the
{@linkplain javax.net.SocketFactory#createSocket
SocketFactory.createSocket()} method of this context's SocketFactory.

##### Returns

- a copy of the SSLParameters object with the default settings

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | if the default SSL parameters could not be obtained. |
|---|---|

#### protected abstract [SSLSessionContext](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSessionContext.html)
**engineGetServerSessionContext**
()

Returns a server `SSLSessionContext` object for
this context.

##### Returns

- the `SSLSessionContext` object

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#getServerSessionContext()`

#### protected abstract [SSLServerSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLServerSocketFactory.html)
**engineGetServerSocketFactory**
()

Returns a `ServerSocketFactory` object for
this context.

##### Returns

- the `ServerSocketFactory` object

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if the SSLContextImpl requires initialization and the `engineInit()` has not been called |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#getServerSocketFactory()`

#### protected abstract [SSLSocketFactory](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLSocketFactory.html)
**engineGetSocketFactory**
()

Returns a `SocketFactory` object for this
context.

##### Returns

- the `SocketFactory` object

##### Throws

| [IllegalStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalStateException.html) | if the SSLContextImpl requires initialization and the `engineInit()` has not been called |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#getSocketFactory()`

#### protected [SSLParameters](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLParameters.html)
**engineGetSupportedSSLParameters**
()

Returns a copy of the SSLParameters indicating the maximum supported
settings for this SSL context.

The parameters will always have the ciphersuite and protocols
arrays set to non-null values.

The default implementation obtains the parameters from an
SSLSocket created by calling the
{@linkplain javax.net.SocketFactory#createSocket
SocketFactory.createSocket()} method of this context's SocketFactory.

##### Returns

- a copy of the SSLParameters object with the maximum supported settings

##### Throws

| [UnsupportedOperationException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/UnsupportedOperationException.html) | if the supported SSL parameters could not be obtained. |
|---|---|

#### protected abstract void
**engineInit**
([KeyManager\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/KeyManager.html) km, [TrustManager\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/TrustManager.html) tm, [SecureRandom](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/SecureRandom.html) sr)

Initializes this context.

##### Parameters

| km | the sources of authentication keys |
| tm | the sources of peer authentication trust decisions |
| sr | the source of randomness |
|---|---|

##### Throws

| [KeyManagementException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyManagementException.html) | if this operation fails |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLContext.html#init(javax.net.ssl.KeyManager[],%20javax.net.ssl.TrustManager[],%20java.security.SecureRandom)`