# EchConfigList

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/net/ssl/EchConfigList "View this page in Java")

```
open class EchConfigList
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.net.ssl.EchConfigList](https://developer.android.com/reference/kotlin/android/net/ssl/EchConfigList#) |

Data used to configure ECH (Encrypted Client Hello) in a TLS handshake.

This object can only be constructed by feeding in the raw bytes of the EchConfigList from a HTTPS DNS record (see https://datatracker.ietf.org/doc/html/rfc460), and may contain multiple EchConfigs.

The general structure starts with the length of the EchConfigList (2 bytes), then each entry in the list contains the following:

- Version: 2 bytes
- Length of the individual EchConfig: 2 bytes
- Contents: unspecified number of bytes

See https://datatracker.ietf.org/doc/draft-ietf-tls-esni for details of the exact structure.

## Summary

| Public methods ||
|---|---|
| open static [EchConfigList](https://developer.android.com/reference/kotlin/android/net/ssl/EchConfigList#) | `https://developer.android.com/reference/kotlin/android/net/ssl/EchConfigList#fromBytes(kotlin.ByteArray)(byteArr: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)` Factory method to construct a new \[EchConfigList\] from a byte array. |
| open [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | `https://developer.android.com/reference/kotlin/android/net/ssl/EchConfigList#toBytes()()` Returns the raw byte representation of an EchConfigList. |

## Public methods

### fromBytes

```
open static fun fromBytes(byteArr: ByteArray): EchConfigList
```

Factory method to construct a new \[EchConfigList\] from a byte array.

The raw bytes from a HTTPS DNS record should be fed directly into this method.

| Parameters ||
|---|---|
| `byteArr` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ssl/EchConfigList#` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `android.net.ssl.InvalidEchDataException` | if the ECH data is empty, does not contain a length, or has a length mismatch. |
| `java.lang.NullPointerException` | if `byteArr` is null. |

### toBytes

```
open fun toBytes(): ByteArray
```

Returns the raw byte representation of an EchConfigList.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html` | This value cannot be `null`. |