# IkeSaProposal.Builder

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/IkeSaProposal.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.IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) |

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

## Summary

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

|                                                                                                                                                                                                                                                                               Public methods                                                                                                                                                                                                                                                                                ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | [addDhGroup](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#addDhGroup(kotlin.Int))`(`dhGroup:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Adds a Diffie-Hellman Group to the SA proposal being built.                                                                                                                                                                |
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | [addEncryptionAlgorithm](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#addEncryptionAlgorithm(kotlin.Int,%20kotlin.Int))`(`algorithm:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `keyLength:` `[Int](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. |
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | [addIntegrityAlgorithm](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#addIntegrityAlgorithm(kotlin.Int))`(`algorithm:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Adds an integrity algorithm to the SA proposal being built.                                                                                                                                        |
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | [addPseudorandomFunction](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#addPseudorandomFunction(kotlin.Int))`(`algorithm:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Adds a pseudorandom function to the SA proposal being built.                                                                                                                                   |
| [IkeSaProposal](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal)                  | [build](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#build())`()` Validates and builds the IkeSaProposal.                                                                                                                                                                                                                                                                                               |

## 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): IkeSaProposal.Builder
```

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

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

|                                                                                   Return                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | Builder of IkeSaProposal. 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
): IkeSaProposal.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 IkeSaProposal. Value is[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_3DES](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_3DES:kotlin.Int),[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_AES_CBC](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_CBC:kotlin.Int),[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_AES_CTR](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_CTR:kotlin.Int),[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_8](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_8:kotlin.Int),[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_12](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_12:kotlin.Int),[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_16](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#ENCRYPTION_ALGORITHM_AES_GCM_16:kotlin.Int), or[android.net.ipsec.ike.SaProposal#ENCRYPTION_ALGORITHM_CHACHA20_POLY1305](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[SaProposal.KEY_LEN_UNUSED](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#KEY_LEN_UNUSED:kotlin.Int)is allowed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

|                                                                                   Return                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | Builder of IkeSaProposal. 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): IkeSaProposal.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 IkeSaProposal. Value is[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_NONE](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_NONE:kotlin.Int),[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA1_96](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA1_96:kotlin.Int),[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_AES_XCBC_96](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_AES_XCBC_96:kotlin.Int),[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_AES_CMAC_96](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_AES_CMAC_96:kotlin.Int),[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_256_128](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_256_128:kotlin.Int),[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_384_192](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_384_192:kotlin.Int), or[android.net.ipsec.ike.SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_512_256](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#INTEGRITY_ALGORITHM_HMAC_SHA2_512_256:kotlin.Int) |

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

### addPseudorandomFunction

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

```
fun addPseudorandomFunction(algorithm: Int): IkeSaProposal.Builder
```

Adds a pseudorandom function to the SA proposal being built.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `algorithm` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):pseudorandom function to add to IkeSaProposal. Value is[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_HMAC_SHA1](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_HMAC_SHA1:kotlin.Int),[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_AES128_XCBC](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_AES128_XCBC:kotlin.Int),[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_SHA2_256](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_SHA2_256:kotlin.Int),[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_SHA2_384](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_SHA2_384:kotlin.Int),[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_SHA2_512](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_SHA2_512:kotlin.Int), or[android.net.ipsec.ike.SaProposal#PSEUDORANDOM_FUNCTION_AES128_CMAC](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/SaProposal#PSEUDORANDOM_FUNCTION_AES128_CMAC:kotlin.Int) |

|                                                                                   Return                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [IkeSaProposal.Builder](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal.Builder#) | Builder of IkeSaProposal. 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(): IkeSaProposal
```

Validates and builds the IkeSaProposal.

|                                                                            Return                                                                             ||
|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| [IkeSaProposal](https://developer.android.com/reference/kotlin/android/net/ipsec/ike/IkeSaProposal) | the validated IkeSaProposal. This value cannot be`null`. |