# WifiAwareDataPathSecurityConfig.Builder

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

# WifiAwareDataPathSecurityConfig.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
WifiAwareDataPathSecurityConfig.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

A builder class for a Wi-Fi Aware data-path security config to encrypt an Aware connection.

## Summary

|                                                                                                                        ### Public constructors                                                                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#Builder(int))`(int cipherSuite) ` Create a builder for a Wi-Fi Aware data-path security config to encrypt the link with specified cipher suite. |

|                                                                                                                                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                                                                                                                               ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[WifiAwareDataPathSecurityConfig](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig)                 | ` `[build](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#build())`() ` Create a[WifiAwareDataPathSecurityConfig](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig)to set in[WifiAwareNetworkSpecifier.Builder.setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig)](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareNetworkSpecifier.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig))to encrypt the link. |
| ` `[WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | ` `[setPmk](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmk(byte[]))`(byte[] pmk) ` Configure the PMK for the Wi-Fi Aware connection being requested.                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | ` `[setPmkId](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmkId(byte[]))`(byte[] pmkId) ` Configure the PMKID for the Wi-Fi Aware connection being requested.                                                                                                                                                                                                                                                                                                                                                              |
| ` `[WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | ` `[setPskPassphrase](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPskPassphrase(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` pskPassphrase) ` Configure the PSK Passphrase for the Wi-Fi Aware connection being requested.                                                                                                                                                                                                                                                     |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder (int cipherSuite)
```

Create a builder for a Wi-Fi Aware data-path security config to encrypt the link with specified cipher suite. Use[Characteristics.getSupportedCipherSuites()](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#getSupportedCipherSuites())to get the supported capabilities of the device.

- For shared key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256), either passphrase or PMK must be set.
- For public key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256). Both PMK and PMKID must be set.

<br />

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ||
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cipherSuite` | `int`: The cipher suite to be used to encrypt the link. One of the[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128),[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256),[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256). Value is either`0`or a combination of[Characteristics.WIFI_AWARE_CIPHER_SUITE_NONE](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NONE),[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128),[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256),[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128), and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256) <br /> |

**See also:**

- [WifiAwareNetworkSpecifier.Builder.setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig)](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareNetworkSpecifier.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig))

## Public methods

### build

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

```
public WifiAwareDataPathSecurityConfig build ()
```

Create a[WifiAwareDataPathSecurityConfig](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig)to set in[WifiAwareNetworkSpecifier.Builder.setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig)](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareNetworkSpecifier.Builder#setDataPathSecurityConfig(android.net.wifi.aware.WifiAwareDataPathSecurityConfig))to encrypt the link.

<br />

|                                                                                                                                                                           Returns                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WifiAwareDataPathSecurityConfig](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig) | A[WifiAwareDataPathSecurityConfig](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig)to be used for encrypting the Wi-Fi Aware data-path. This value cannot be`null`. <br /> |

### setPmk

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

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

Configure the PMK for the Wi-Fi Aware connection being requested. For shared key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256), either passphrase or PMK must be set. For public key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256). Both PMK and PMKID must be set.

<br />

|                                                                                                                                                                                                                                                                                                    Parameters                                                                                                                                                                                                                                                                                                     ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pmk` | `byte`: A PMK (pairwise master key, see IEEE 802.11i) specifying the key to use for encrypting the data-path. Alternatively, use the[setPskPassphrase(java.lang.String)](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPskPassphrase(java.lang.String))to specify a Passphrase instead for shared key cipher suite. Use the[setPmkId(byte[])](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmkId(byte[]))together for public key cipher suite. This value cannot be`null`. <br /> |

|                                                                                                                                                                             Returns                                                                                                                                                                              ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | the current[Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder)builder, enabling chaining of builder methods. This value cannot be`null`. <br /> |

### setPmkId

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

```
public WifiAwareDataPathSecurityConfig.Builder setPmkId (byte[] pmkId)
```

Configure the PMKID for the Wi-Fi Aware connection being requested. For public key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256). both PMK and PMKID must set[setPmk(byte[])](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmk(byte[]))

<br />

|                                                                                                                                                                                                                                        Parameters                                                                                                                                                                                                                                        ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pmkId` | `byte`: A PMKID (pairwise master key associated identifier, see IEEE 802.11) is generated by Diffie-Hellman key exchange together with a Pairwise Master Key (PMK), specifying the identifier associated to the key to use for encrypting the data-path. Use the[setPmk(byte[])](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmk(byte[]))together for public key cipher suite. This value cannot be`null`. <br /> |

|                                                                                                                                                                             Returns                                                                                                                                                                              ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | the current[Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder)builder, enabling chaining of builder methods. This value cannot be`null`. <br /> |

### setPskPassphrase

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

```
public WifiAwareDataPathSecurityConfig.Builder setPskPassphrase (String pskPassphrase)
```

Configure the PSK Passphrase for the Wi-Fi Aware connection being requested. For shared key cipher suite[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128)and[Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256](https://developer.android.com/reference/android/net/wifi/aware/Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256), either passphrase or PMK must be set.

<br />

|                                                                                                                                                       Parameters                                                                                                                                                        ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pskPassphrase` | `String`: The passphrase to be used to encrypt the link. Alternatively, use the[setPmk(byte[])](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder#setPmk(byte[]))to specify a PMK for shared key cipher suite. This value cannot be`null`. <br /> |

|                                                                                                                                                                             Returns                                                                                                                                                                              ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WifiAwareDataPathSecurityConfig.Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder) | the current[Builder](https://developer.android.com/reference/android/net/wifi/aware/WifiAwareDataPathSecurityConfig.Builder)builder, enabling chaining of builder methods. This value cannot be`null`. <br /> |