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

# Builder

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/android/net/ipsec/ike/ChildSaProposal.Builder "View this page in Java")

```
class Builder
```

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

This class is used to incrementally construct a ChildSaProposal. ChildSaProposal instances are immutable once built.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#Builder()()` <br /> |

| Public methods ||
|---|---|
| [ChildSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#) | `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#addDhGroup(kotlin.Int)(dhGroup: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Adds a Diffie-Hellman Group to the SA proposal being built. |
| [ChildSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#) | `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#addEncryptionAlgorithm(kotlin.Int,%20kotlin.Int)(algorithm: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, keyLength: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Adds an encryption algorithm with a specific key length to the SA proposal being built. |
| [ChildSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#) | `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#addIntegrityAlgorithm(kotlin.Int)(algorithm: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Adds an integrity algorithm to the SA proposal being built. |
| [ChildSaProposal](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal) | `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#build()()` Validates and builds the ChildSaProposal. |

## Public constructors

### Builder

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

```
Builder()
```

## Public methods

### addDhGroup

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

```
fun addDhGroup(dhGroup: Int): ChildSaProposal.Builder
```

Adds a Diffie-Hellman Group to the SA proposal being built.

If this ChildSaProposal will be used for the first Child SA created as part of IKE AUTH exchange, DH groups configured here will only apply when the Child SA is later rekeyed. In this case, configuring different DH groups for IKE and Child SA may cause Rekey Child to fail.

If no DH groups are supplied here, but the server requests a DH exchange during rekey, the IKE SA's negotiated DH group will still be accepted.

| Parameters ||
|---|---|
| `dhGroup` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): to add to ChildSaProposal. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_1024_BIT_MODP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_1536_BIT_MODP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_2048_BIT_MODP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_3072_BIT_MODP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_4096_BIT_MODP:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#DH_GROUP_CURVE_25519:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#` | Builder of ChildSaProposal. This value cannot be `null`. |

### addEncryptionAlgorithm

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

```
fun addEncryptionAlgorithm(
    algorithm: Int, 
    keyLength: Int
): ChildSaProposal.Builder
```

Adds an encryption algorithm with a specific key length to the SA proposal being built.

| Parameters ||
|---|---|
| `algorithm` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): encryption algorithm to add to ChildSaProposal. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_3DES:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_CBC:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_CTR:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_8:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_12:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_16:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_CHACHA20_POLY1305:kotlin.Int` |
| `keyLength` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): key length of algorithm. For algorithms that have fixed key length (e.g. 3DES) only `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#KEY_LEN_UNUSED:kotlin.Int` is allowed. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#` | Builder of ChildSaProposal. This value cannot be `null`. |

### addIntegrityAlgorithm

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

```
fun addIntegrityAlgorithm(algorithm: Int): ChildSaProposal.Builder
```

Adds an integrity algorithm to the SA proposal being built.

| Parameters ||
|---|---|
| `algorithm` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): integrity algorithm to add to ChildSaProposal. Value is one of the following: - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_NONE:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA1_96:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_AES_XCBC_96:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_AES_CMAC_96:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_256_128:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_384_192:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_512_256:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal.Builder#` | Builder of ChildSaProposal. This value cannot be `null`. |

### build

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

```
fun build(): ChildSaProposal
```

Validates and builds the ChildSaProposal.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/net/ipsec/ike/ChildSaProposal` | the validated ChildSaProposal. This value cannot be `null`. |