Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/net/ssl/SSLEngines#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/ssl/SSLEngines#inhmethods)

# SSLEngines

*** ** * ** ***


`
public


class
SSLEngines
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.ssl.SSLEngines |

<br />

*** ** * ** ***

Static utility methods for accessing additional functionality of supported instances of
`https://developer.android.com/reference/javax/net/ssl/SSLEngine`. Engines from the platform TLS provider will be compatible with all
methods in this class.

## Summary

| ### Public methods ||
|---|---|
| ` static byte[]` | ` https://developer.android.com/reference/android/net/ssl/SSLEngines#exportKeyingMaterial(javax.net.ssl.SSLEngine,%20java.lang.String,%20byte[],%20int)(https://developer.android.com/reference/javax/net/ssl/SSLEngine engine, https://developer.android.com/reference/java/lang/String label, byte[] context, int length) ` Exports a value derived from the TLS master secret as described in RFC 5705. |
| ` static boolean` | ` https://developer.android.com/reference/android/net/ssl/SSLEngines#isSupportedEngine(javax.net.ssl.SSLEngine)(https://developer.android.com/reference/javax/net/ssl/SSLEngine engine) ` Returns whether the given engine can be used with the methods in this class. |
| ` static void` | ` https://developer.android.com/reference/android/net/ssl/SSLEngines#setEchConfigList(javax.net.ssl.SSLEngine,%20android.net.ssl.EchConfigList)(https://developer.android.com/reference/javax/net/ssl/SSLEngine engine, https://developer.android.com/reference/android/net/ssl/EchConfigList echConfigList) ` Sets an EchConfigList to be used to establish ECH on the TLS handshake. |
| ` static void` | ` https://developer.android.com/reference/android/net/ssl/SSLEngines#setUseSessionTickets(javax.net.ssl.SSLEngine,%20boolean)(https://developer.android.com/reference/javax/net/ssl/SSLEngine engine, boolean useSessionTickets) ` Enables or disables the use of session tickets. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public methods

### exportKeyingMaterial

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static byte[] exportKeyingMaterial (SSLEngine engine, 
                String label, 
                byte[] context, 
                int length)
```

Exports a value derived from the TLS master secret as described in RFC 5705.

A number of protocols leverage Transport Layer Security (TLS) to perform key
establishment but then use some of the keying material for their own purposes.

This method allows an application to export keying material from a TLS connection.
The exported material will be the same on the client and server if they pass in
the same values for `label` and `context`. See RFC 5705 for further
details.

<br />

| Parameters ||
|---|---|
| `engine` | `SSLEngine`: the engine to use for exporting keying material. This value cannot be `null`. <br /> |
| `label` | `String`: the label to use in calculating the exported value. This must be an ASCII-only string. This value cannot be `null`. <br /> |
| `context` | `byte`: the application-specific context value to use in calculating the exported value. This may be `null` to use no application context, which is treated differently than an empty byte array. <br /> |
| `length` | `int`: the number of bytes of keying material to return. <br /> |

| Returns ||
|---|---|
| `byte[]` | a value of the specified length, or `null` if the handshake has not yet completed or the connection has been closed. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/javax/net/ssl/SSLException` | if the value could not be exported. |

### isSupportedEngine

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isSupportedEngine (SSLEngine engine)
```

Returns whether the given engine can be used with the methods in this class. In general,
only engines from the platform TLS provider are supported.

<br />

| Parameters ||
|---|---|
| `engine` | `SSLEngine`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### setEchConfigList

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [C Extensions 22](https://developer.android.com/sdkExtensions)

```
public static void setEchConfigList (SSLEngine engine, 
                EchConfigList echConfigList)
```

Sets an EchConfigList to be used to establish ECH on the TLS handshake.

This function must be called before the handshake is started or it will have no effect.

<br />

| Parameters ||
|---|---|
| `engine` | `SSLEngine`: the engine. This value cannot be `null`. <br /> |
| `echConfigList` | `EchConfigList`: the ECH config data to be used in the handshake. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the given engine is not a platform engine |

### setUseSessionTickets

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void setUseSessionTickets (SSLEngine engine, 
                boolean useSessionTickets)
```

Enables or disables the use of session tickets.

This function must be called before the handshake is started or it will have no effect.

<br />

| Parameters ||
|---|---|
| `engine` | `SSLEngine`: the engine. This value cannot be `null`. <br /> |
| `useSessionTickets` | `boolean`: whether to enable or disable the use of session tickets <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the given engine is not a platform engine |