Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#inhmethods)

# PasnConfig.Builder

*** ** * ** ***

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

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.rtt.PasnConfig.Builder |

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig`

**Proximity Detection Security Configuration**

To configure authenticated Pre-association Security Negotiation (PASN) for Proximity Detection, application must provide a device identity key and a corresponding security credential (either a PMK or a password).

**1. Device Identity Key:**

Call `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setProximityDetectionSeekerDeviceIdentityKey(byte[])` to set the 16-byte device identity key (DevIK) of the device acting as the Ranging Seeker. This key is required regardless of whether the current device is the Seeker or the Advertiser. The device's role as Seeker or Advertiser is specified in `https://developer.android.com/`.

When this device is the **Seeker**, it uses the DevIK to generate a Device Identity Resolution Attribute (DIRA) and include it in the PASN M1 frame in the security handshake.

When this device is the **Advertiser**, it uses the Seeker's DevIK (provisioned out-of-band) and the Seeker's DIRA Tag from received PASN M1 frame to identify the correct security credential.

**2. Security Credential:**

Along with setting the device identity key, application must provide exactly one of the following security credentials:

**PMK (Pairwise Master Key):** Call `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPmk(byte[])` to provide a pre-shared 32-byte PMK.

**Password:** Call `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPassword(java.lang.String)` to provide a password. The system will then derive the necessary keys.

Using both a PMK and a password simultaneously is not allowed and will cause the `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#build()` method to throw an `https://developer.android.com/reference/java/lang/IllegalStateException`. Similarly, calling `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setProximityDetectionSeekerDeviceIdentityKey(byte[])` without providing either a PMK or a password will also result in an `https://developer.android.com/reference/java/lang/IllegalStateException`.

For standard (non-Proximity Detection) Wi-Fi RTT, see `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setWifiSsid(android.net.wifi.WifiSsid)` and `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPassword(java.lang.String)` for STA-AP ranging configuration.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#Builder(int,%20int)(int baseAkms, int ciphers) ` Builder |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#build()() ` Builds a `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig` object. |
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPasnComebackCookie(byte[])(byte[] pasnComebackCookie) ` Set PASN comeback cookie. |
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPassword(java.lang.String)(https://developer.android.com/reference/java/lang/String password) ` Sets the password if needed by the base AKM of the PASN. |
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPmk(byte[])(byte[] pmk) ` Configures the PMK (Pairwise Master Key) for authenticated PASN mode in proximity detection. |
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setProximityDetectionSeekerDeviceIdentityKey(byte[])(byte[] seekerDevIK) ` The Ranging Seeker's device identity key (devIK) required for authenticated PASN mode in proximity detection. |
| ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | ` https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setWifiSsid(android.net.wifi.WifiSsid)(https://developer.android.com/reference/android/net/wifi/WifiSsid wifiSsid) ` Sets the Wi-Fi Service Set Identifier (SSID). |

### 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 constructors

### Builder

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

```
public Builder (int baseAkms, 
                int ciphers)
```

Builder

<br />

| Parameters ||
|---|---|
| `baseAkms` | `int`: The AKMs that PASN is configured to use. PASN will use the most secure AKM in the configuration. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_NONE` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_PASN` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_SAE` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FT_EAP_SHA256` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FT_PSK_SHA256` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FT_EAP_SHA384` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FT_PSK_SHA384` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FILS_EAP_SHA256` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#AKM_FILS_EAP_SHA384` |
| `ciphers` | `int`: The CIPHERs that PASN is configured to use. PASN will use the most secure CIPHER in the configuration which is applicable to the base AKM. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#CIPHER_NONE` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#CIPHER_CCMP_128` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#CIPHER_CCMP_256` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#CIPHER_GCMP_128` - `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig#CIPHER_GCMP_256` |

## Public methods

### build

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

```
public PasnConfig build ()
```

Builds a `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig` object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig` | This value cannot be `null`. <br /> |

### setPasnComebackCookie

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

```
public PasnConfig.Builder setPasnComebackCookie (byte[] pasnComebackCookie)
```

Set PASN comeback cookie. PASN authentication allows the station to provide comeback cookie which was indicated in the `https://developer.android.com/reference/android/net/wifi/rtt/RangingResult` by the AP with a deferral time.

When an AP receives a large volume of initial PASN Authentication frames, it can use the comeback after field in the PASN Parameters element to indicate a deferral time and optionally provide a comeback cookie which is an opaque sequence of octets. Upon receiving this response, the ranging initiator (STA) must wait for the specified time before retrying secure authentication, presenting the received cookie to the AP. See `https://developer.android.com/reference/android/net/wifi/rtt/RangingResult#getPasnComebackCookie()` and `https://developer.android.com/reference/android/net/wifi/rtt/RangingResult#getPasnComebackAfterMillis()`.

<br />

| Parameters ||
|---|---|
| `pasnComebackCookie` | `byte`: an opaque sequence of octets. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | a reference to this Builder. This value cannot be `null`. <br /> |

### setPassword

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

```
public PasnConfig.Builder setPassword (String password)
```

Sets the password if needed by the base AKM of the PASN.

For STA-AP ranging, If a password is not set directly, it may be retrieved from a saved network profile identified by the SSID. See `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setWifiSsid(android.net.wifi.WifiSsid)`.

<br />

| Parameters ||
|---|---|
| `password` | `String`: password string. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | a reference to this Builder. This value cannot be `null`. <br /> |

### setPmk

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

```
public PasnConfig.Builder setPmk (byte[] pmk)
```

Configures the PMK (Pairwise Master Key) for authenticated PASN mode in proximity detection.

<br />

| Parameters ||
|---|---|
| `pmk` | `byte`: A PMK, which must be 32 bytes. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | the builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. <br /> |

### setProximityDetectionSeekerDeviceIdentityKey

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

```
public PasnConfig.Builder setProximityDetectionSeekerDeviceIdentityKey (byte[] seekerDevIK)
```

The Ranging Seeker's device identity key (devIK) required for authenticated PASN mode in proximity detection. This key is always the Seeker's DevIK, regardless of the device's role.

<br />

| Parameters ||
|---|---|
| `seekerDevIK` | `byte`: the device identity key of the seeker device, which must be 16 bytes. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | the builder to facilitate chaining `builder.setXXX(..).setXXX(..)`. This value cannot be `null`. <br /> |

### setWifiSsid

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

```
public PasnConfig.Builder setWifiSsid (WifiSsid wifiSsid)
```

Sets the Wi-Fi Service Set Identifier (SSID). This is used to get the saved profile to retrieve password if password is not set using `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder#setPassword(java.lang.String)`. Note: If password and SSID is not set, secure ranging will use unauthenticated PASN.

<br />

| Parameters ||
|---|---|
| `wifiSsid` | `WifiSsid`: Wi-Fi Service Set Identifier (SSID). This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder` | a reference to this Builder. This value cannot be `null`. <br /> |