Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#nestedclasses) \| [Constants](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#constants) \| [Methods](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#inhmethods)

# IkeSessionParams

*** ** * ** ***

` public final class IkeSessionParams `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.ipsec.ike.IkeSessionParams |

<br />

*** ** * ** ***

IkeSessionParams contains all user provided configurations for negotiating an `https://developer.android.com/reference/android/net/ipsec/ike/IkeSession`.

Note that all negotiated configurations will be reused during rekey including SA Proposal and lifetime.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder` This class can be used to incrementally construct a `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams`. |
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthConfig` This class contains common information of an IKEv2 authentication configuration. |
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthDigitalSignLocalConfig` This class represents the configuration to support IKEv2 public-key-signature-based authentication of the local side. |
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthDigitalSignRemoteConfig` This class represents the configuration to support IKEv2 public-key-signature-based authentication of the remote side. |
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthEapConfig` This class represents the configuration to support EAP authentication of the local side. |
| ` class` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthPskConfig` This class represents the configuration to support IKEv2 pre-shared-key-based authentication of local or remote side. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_DPD_DELAY_SEC_DISABLED` Setting timer to this value will disable the Dead Peer Detection(DPD). |
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_ACCEPT_ANY_REMOTE_ID` If set, the IKE library will accept any remote (server) identity, even if it does not match the configured remote identity See `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRemoteIdentification(android.net.ipsec.ike.IkeIdentification)` |
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` If set, and EAP has been configured as the authentication method, the IKE library will request that the remote (also) use an EAP-only authentication flow. |
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_FORCE_PORT_4500` Configures the IKE session to always send to port 4500. |
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_INITIAL_CONTACT` If set, the IKE library will send INITIAL_CONTACT notification to the peers. |
| `int` | `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_MOBIKE` If set, the IKE Session will attempt to handle IP address changes using RFC4555 MOBIKE. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` int` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getDpdDelaySeconds()() ` Retrieves the Dead Peer Detection(DPD) delay in seconds |
| ` int` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getHardLifetimeSeconds()() ` Retrieves hard lifetime in seconds |
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/Integer>` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getIkeOptions()() ` Return all the enabled IKE Options |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/net/ipsec/ike/IkeSaProposal>` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getIkeSaProposals()() ` Retrieves all IkeSaProposals configured |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthConfig` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getLocalAuthConfig()() ` Retrieves the local (client) authentication configuration |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getLocalIdentification()() ` Retrieves the local (client) identity |
| ` int` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getNattKeepAliveDelaySeconds()() ` Retrieves the Network Address Translation Traversal (NATT) keepalive delay in seconds |
| ` https://developer.android.com/reference/android/net/Network` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getNetwork()() ` Retrieves the configured `https://developer.android.com/reference/android/net/Network`, or null if was not set. |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthConfig` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getRemoteAuthConfig()() ` Retrieves the remote (server) authentication configuration |
| ` https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getRemoteIdentification()() ` Retrieves the required remote (server) identity |
| ` int[]` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getRetransmissionTimeoutsMillis()() ` Retrieves the relative retransmission timeout list in milliseconds @see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRetransmissionTimeoutsMillis(int[])` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getServerHostname()() ` Retrieves the configured server hostname The configured server hostname will be resolved during IKE Session creation. |
| ` int` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#getSoftLifetimeSeconds()() ` Retrieves soft lifetime in seconds |
| ` boolean` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#hasIkeOption(int)(int ikeOption) ` Checks if the given IKE Session negotiation option is set |
| ` int` | ` https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#hashCode()() ` Returns a hash code value for the object. |

### 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*.

## Constants

### IKE_DPD_DELAY_SEC_DISABLED

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

```
public static final int IKE_DPD_DELAY_SEC_DISABLED
```

Setting timer to this value will disable the Dead Peer Detection(DPD).

@see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setDpdDelaySeconds(int)`

<br />

Constant Value: 2147483647 (0x7fffffff)

### IKE_OPTION_ACCEPT_ANY_REMOTE_ID

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

```
public static final int IKE_OPTION_ACCEPT_ANY_REMOTE_ID
```

If set, the IKE library will accept any remote (server) identity, even if it does not match the configured remote identity

See `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRemoteIdentification(android.net.ipsec.ike.IkeIdentification)`

<br />

Constant Value: 0 (0x00000000)

### IKE_OPTION_EAP_ONLY_AUTH

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

```
public static final int IKE_OPTION_EAP_ONLY_AUTH
```

If set, and EAP has been configured as the authentication method, the IKE library will request that the remote (also) use an EAP-only authentication flow.

@see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setAuthEap(java.security.cert.X509Certificate,%20android.net.eap.EapSessionConfig)`

<br />

Constant Value: 1 (0x00000001)

### IKE_OPTION_FORCE_PORT_4500

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

```
public static final int IKE_OPTION_FORCE_PORT_4500
```

Configures the IKE session to always send to port 4500.

If set, the IKE Session will be initiated and maintained exclusively using destination port 4500, regardless of the presence of NAT. Otherwise, the IKE Session will be initiated on destination port 500; then, if either a NAT is detected or both MOBIKE and NAT-T are supported by the peer, it will proceed on port 4500.

<br />

Constant Value: 3 (0x00000003)

### IKE_OPTION_INITIAL_CONTACT

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

```
public static final int IKE_OPTION_INITIAL_CONTACT
```

If set, the IKE library will send INITIAL_CONTACT notification to the peers.

If this option is set, the INITIAL_CONTACT notification payload is sent in IKE_AUTH. The client can use this option to assert to the peer that this IKE SA is the only IKE SA currently active between the authenticated identities.

@see "https://tools.ietf.org/html/rfc7296#section-2.4" RFC 7296, Internet Key Exchange Protocol Version 2 (IKEv2)

@see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#addIkeOption(int)`

<br />

Constant Value: 4 (0x00000004)

### IKE_OPTION_MOBIKE

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

```
public static final int IKE_OPTION_MOBIKE
```

If set, the IKE Session will attempt to handle IP address changes using RFC4555 MOBIKE.

Upon IP address changes (including Network changes), the IKE session will initiate an RFC 4555 MOBIKE procedure, migrating both this IKE Session and associated IPsec Transforms to the new local and remote address pair.

The IKE library will first attempt to enable MOBIKE to handle the changes of underlying network and addresses. For callers targeting SDK `https://developer.android.com/reference/android/os/Build.VERSION_CODES#S_V2` and earlier, this option will implicitly enable the support for rekey-based mobility, and thus if the server does not support MOBIKE, the IKE Session will try migration by rekeying all associated IPsec SAs. This rekey-based mobility feature is not best-practice and has technical issues; accordingly, it will no longer be enabled for callers targeting SDK `https://developer.android.com/reference/android/os/Build.VERSION_CODES#TIRAMISU` and above.

Checking whether or not MOBIKE is supported by both the IKE library and the server in an IKE Session is done via `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionConfiguration#isIkeExtensionEnabled(int)`.

It is recommended that IKE_OPTION_MOBIKE be enabled unless precluded for compatibility reasons.

If this option is set for an IKE Session, Transport-mode SAs will not be allowed in that Session.

Callers that need to perform migration of IPsec transforms and tunnels MUST implement migration specific methods in `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionCallback` and `https://developer.android.com/reference/android/net/ipsec/ike/ChildSessionCallback`.

<br />

Constant Value: 2 (0x00000002)

## Public methods

### equals

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

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getDpdDelaySeconds

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

```
public int getDpdDelaySeconds ()
```

Retrieves the Dead Peer Detection(DPD) delay in seconds

<br />

| Returns ||
|---|---|
| `int` | Value is `https://developer.android.com/` or greater <br /> |

### getHardLifetimeSeconds

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

```
public int getHardLifetimeSeconds ()
```

Retrieves hard lifetime in seconds

<br />

| Returns ||
|---|---|
| `int` | Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |

### getIkeOptions

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

```
public Set<Integer> getIkeOptions ()
```

Return all the enabled IKE Options

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/Integer>` | A Set of enabled IKE options that have been added using `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#addIkeOption(int)` This value cannot be `null`. Value is one of the following: - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_ACCEPT_ANY_REMOTE_ID` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_MOBIKE` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_FORCE_PORT_4500` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_INITIAL_CONTACT` |

### getIkeSaProposals

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

```
public List<IkeSaProposal> getIkeSaProposals ()
```

Retrieves all IkeSaProposals configured

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/net/ipsec/ike/IkeSaProposal>` | This value cannot be `null`. <br /> |

### getLocalAuthConfig

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

```
public IkeSessionParams.IkeAuthConfig getLocalAuthConfig ()
```

Retrieves the local (client) authentication configuration

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthConfig` | This value cannot be `null`. <br /> |

### getLocalIdentification

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

```
public IkeIdentification getLocalIdentification ()
```

Retrieves the local (client) identity

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification` | This value cannot be `null`. <br /> |

### getNattKeepAliveDelaySeconds

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

```
public int getNattKeepAliveDelaySeconds ()
```

Retrieves the Network Address Translation Traversal (NATT) keepalive delay in seconds

<br />

| Returns ||
|---|---|
| `int` | Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |

### getNetwork

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

```
public Network getNetwork ()
```

Retrieves the configured `https://developer.android.com/reference/android/net/Network`, or null if was not set.

@see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setNetwork(android.net.Network)`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/Network` | <br /> |

### getRemoteAuthConfig

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

```
public IkeSessionParams.IkeAuthConfig getRemoteAuthConfig ()
```

Retrieves the remote (server) authentication configuration

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.IkeAuthConfig` | This value cannot be `null`. <br /> |

### getRemoteIdentification

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

```
public IkeIdentification getRemoteIdentification ()
```

Retrieves the required remote (server) identity

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/ipsec/ike/IkeIdentification` | This value cannot be `null`. <br /> |

### getRetransmissionTimeoutsMillis

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

```
public int[] getRetransmissionTimeoutsMillis ()
```

Retrieves the relative retransmission timeout list in milliseconds

@see `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams.Builder#setRetransmissionTimeoutsMillis(int[])`

<br />

| Returns ||
|---|---|
| `int[]` | This value cannot be `null`. <br /> |

### getServerHostname

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

```
public String getServerHostname ()
```

Retrieves the configured server hostname

The configured server hostname will be resolved during IKE Session creation.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | This value cannot be `null`. <br /> |

### getSoftLifetimeSeconds

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

```
public int getSoftLifetimeSeconds ()
```

Retrieves soft lifetime in seconds

<br />

| Returns ||
|---|---|
| `int` | Value is between `https://developer.android.com/` and `https://developer.android.com/` inclusive <br /> |

### hasIkeOption

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

```
public boolean hasIkeOption (int ikeOption)
```

Checks if the given IKE Session negotiation option is set

<br />

| Parameters ||
|---|---|
| `ikeOption` | `int`: the option to check. Value is one of the following: - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_ACCEPT_ANY_REMOTE_ID` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_EAP_ONLY_AUTH` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_MOBIKE` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_FORCE_PORT_4500` - `https://developer.android.com/reference/android/net/ipsec/ike/IkeSessionParams#IKE_OPTION_INITIAL_CONTACT` |

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

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the provided option is invalid. |

### hashCode

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

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |