Builder
class Builder
kotlin.Any | |
↳ | 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 | |
---|---|
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.Builder |
Configure the PMK for the Wi-Fi Aware connection being requested. |
WifiAwareDataPathSecurityConfig.Builder |
Configure the PMKID for the Wi-Fi Aware connection being requested. |
WifiAwareDataPathSecurityConfig.Builder |
setPskPassphrase(pskPassphrase: String) Configure the PSK Passphrase for the Wi-Fi Aware connection being requested. |
Public constructors
Builder
Builder(cipherSuite: Int)
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.
- For shared key cipher suite
Characteristics.WIFI_AWARE_CIPHER_SUITE_NCS_SK_128
andCharacteristics.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
andCharacteristics.WIFI_AWARE_CIPHER_SUITE_NCS_PK_256
. Both PMK and PMKID must be set.
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 android.net.wifi.aware.Characteristics#WIFI_AWARE_CIPHER_SUITE_NONE , android.net.wifi.aware.Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_128 , android.net.wifi.aware.Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_SK_256 , android.net.wifi.aware.Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_128 , and android.net.wifi.aware.Characteristics#WIFI_AWARE_CIPHER_SUITE_NCS_PK_256 |
Public methods
build
fun build(): WifiAwareDataPathSecurityConfig
Create a WifiAwareDataPathSecurityConfig
to set in WifiAwareNetworkSpecifier.Builder.setDataPathSecurityConfig(WifiAwareDataPathSecurityConfig)
to encrypt the link.
Return | |
---|---|
WifiAwareDataPathSecurityConfig |
A WifiAwareDataPathSecurityConfig to be used for encrypting the Wi-Fi Aware data-path. This value cannot be null . |
setPmk
fun setPmk(pmk: ByteArray): WifiAwareDataPathSecurityConfig.Builder
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 |
ByteArray: 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 . |
Return | |
---|---|
WifiAwareDataPathSecurityConfig.Builder |
the current Builder builder, enabling chaining of builder methods. This value cannot be null . |
setPmkId
fun setPmkId(pmkId: ByteArray): WifiAwareDataPathSecurityConfig.Builder
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 |
ByteArray: 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 . |
Return | |
---|---|
WifiAwareDataPathSecurityConfig.Builder |
the current Builder builder, enabling chaining of builder methods. This value cannot be null . |
setPskPassphrase
fun setPskPassphrase(pskPassphrase: String): WifiAwareDataPathSecurityConfig.Builder
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 . |
Return | |
---|---|
WifiAwareDataPathSecurityConfig.Builder |
the current Builder builder, enabling chaining of builder methods. This value cannot be null . |