WifiAwareDataPathSecurityConfig.Builder

public static final class WifiAwareDataPathSecurityConfig.Builder
extends Object

java.lang.Object
   ↳ android.net.wifi.aware.WifiAwareDataPathSecurityConfig.Builder


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

Summary

Public constructors

Builder(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 build()

Create a WifiAwareDataPathSecurityConfig to set in WifiAwareNetworkSpecifier.Builder#setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig) to encrypt the link.

WifiAwareDataPathSecurityConfig.Builder setPmk(byte[] pmk)

Configure the PMK for the Wi-Fi Aware connection being requested.

WifiAwareDataPathSecurityConfig.Builder setPmkId(byte[] pmkId)

Configure the PMKID for the Wi-Fi Aware connection being requested.

WifiAwareDataPathSecurityConfig.Builder setPskPassphrase(String pskPassphrase)

Configure the PSK Passphrase for the Wi-Fi Aware connection being requested.

Inherited methods

Public constructors

Builder

Added in API level 33
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() to get the supported capabilities of the device.

Parameters
cipherSuite int: The cipher suite to be used to encrypt the link. One of the Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128, Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256, Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128 and Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256. Value is either 0 or a combination of Characteristics.WIFI_AWARE_CIPHER_SUITE_NONE, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_256, Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_128, and Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256

Public methods

build

Added in API level 33
public WifiAwareDataPathSecurityConfig build ()

Create a WifiAwareDataPathSecurityConfig to set in WifiAwareNetworkSpecifier.Builder#setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig) to encrypt the link.

Returns
WifiAwareDataPathSecurityConfig A WifiAwareDataPathSecurityConfig to be used for encrypting the Wi-Fi Aware data-path. This value cannot be null.

setPmk

Added in API level 33
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 and 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 and Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256. Both PMK and PMKID must be set.

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) to specify a Passphrase instead for shared key cipher suite. Use the setPmkId(byte[]) together for public key cipher suite. This value cannot be null.

Returns
WifiAwareDataPathSecurityConfig.Builder the current Builder builder, enabling chaining of builder methods. This value cannot be null.

setPmkId

Added in API level 33
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 and Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256. both PMK and PMKID must set setPmk(byte[])

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[]) together for public key cipher suite. This value cannot be null.

Returns
WifiAwareDataPathSecurityConfig.Builder the current Builder builder, enabling chaining of builder methods. This value cannot be null.

setPskPassphrase

Added in API level 33
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 and Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256, either passphrase or PMK must be set.

Parameters
pskPassphrase String: The passphrase to be used to encrypt the link. Alternatively, use the setPmk(byte[]) to specify a PMK for shared key cipher suite. This value cannot be null.

Returns
WifiAwareDataPathSecurityConfig.Builder the current Builder builder, enabling chaining of builder methods. This value cannot be null.