summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaNetworkHal.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
index 0507a8867..cfbbfad0e 100644
--- a/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
+++ b/service/java/com/android/server/wifi/SupplicantStaNetworkHal.java
@@ -207,13 +207,6 @@ public class SupplicantStaNetworkHal {
config.wepKeys[i] = NativeUtil.bytesToHexOrQuotedString(mWepKey);
}
}
- /** PSK pass phrase */
- config.preSharedKey = null;
- if (getPskPassphrase() && !TextUtils.isEmpty(mPskPassphrase)) {
- config.preSharedKey = NativeUtil.addEnclosingQuotes(mPskPassphrase);
- } else if (getPsk() && !ArrayUtils.isEmpty(mPsk)) {
- config.preSharedKey = NativeUtil.hexStringFromByteArray(mPsk);
- } /* Do not read SAE password */
/** allowedKeyManagement */
if (getKeyMgmt()) {
@@ -247,6 +240,18 @@ public class SupplicantStaNetworkHal {
supplicantToWifiConfigurationGroupMgmtCipherMask(mGroupMgmtCipherMask);
}
+ /** PSK pass phrase */
+ config.preSharedKey = null;
+ if (getPskPassphrase() && !TextUtils.isEmpty(mPskPassphrase)) {
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)) {
+ config.preSharedKey = mPskPassphrase;
+ } else {
+ config.preSharedKey = NativeUtil.addEnclosingQuotes(mPskPassphrase);
+ }
+ } else if (getPsk() && !ArrayUtils.isEmpty(mPsk)) {
+ config.preSharedKey = NativeUtil.hexStringFromByteArray(mPsk);
+ } /* Do not read SAE password */
+
/** metadata: idstr */
if (getIdStr() && !TextUtils.isEmpty(mIdStr)) {
Map<String, String> metadata = parseNetworkExtra(mIdStr);
@@ -302,7 +307,12 @@ public class SupplicantStaNetworkHal {
// For PSK, this can either be quoted ASCII passphrase or hex string for raw psk.
// For SAE, password must be a quoted ASCII string
if (config.preSharedKey != null) {
- if (config.preSharedKey.startsWith("\"")) {
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WAPI_PSK)) {
+ if (!setPskPassphrase(config.preSharedKey)) {
+ Log.e(TAG, "failed to set wapi psk passphrase");
+ return false;
+ }
+ } else if (config.preSharedKey.startsWith("\"")) {
if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.SAE)) {
/* WPA3 case, field is SAE Password */
if (!setSaePassword(