diff options
author | Roshan Pius <rpius@google.com> | 2019-10-29 09:15:31 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-11-14 12:12:58 -0800 |
commit | a9ebe48227eb5befd221451a013cbd0a76eac999 (patch) | |
tree | 8bb3ec31fbb2e671d51aef48afdc9a1ed6b3fe8a /tests | |
parent | 09621a42f86690346814c48cf1cdb1f123402e12 (diff) |
WifiConfigStore: Encrypt credentials for networks (4/4)
Add a setting to turn on/off encryption. This global setting will be
turned on for devices which require encrypted credentials.
We don't need to support flipping the global settings back n forth.
Only needs to support the one way toggle from off
to on once for the lifetime of the device.
Bug: 140485110
Test: atest com.android.server.wifi
Test: Manual verification
- Store a PSK network config on older build
- Upgrade to build with this CL
- adb shell settings put global niap_mode 1
- Ensured that the psk was read correctly on upgrade
- Ensured that the psk was encrypted when stored on disk after upgrade
Change-Id: Ibabe0814bfc42a7bf610d18e89a7b82bacfdfeed
Merged-In: Ibabe0814bfc42a7bf610d18e89a7b82bacfdfeed
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 2 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 0badc6fbd..c4cbc6e50 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -234,7 +234,7 @@ public class WifiConfigManagerTest { .spyStatic(WifiConfigurationUtil.class) .strictness(Strictness.LENIENT) .startMocking(); - when(WifiConfigStore.createUserFiles(anyInt())).thenReturn(mock(List.class)); + when(WifiConfigStore.createUserFiles(anyInt(), anyBoolean())).thenReturn(mock(List.class)); when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mDataTelephonyManager); when(WifiConfigurationUtil.calculatePersistentMacForConfiguration(any(), any())) .thenReturn(TEST_RANDOMIZED_MAC); diff --git a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java index 66534d247..8f96bc106 100644 --- a/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/util/XmlUtilTest.java @@ -37,8 +37,6 @@ import com.android.server.wifi.util.XmlUtil.WifiEnterpriseConfigXmlUtil; import org.junit.Before; import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -77,7 +75,7 @@ public class XmlUtilTest { private static final int TEST_PHASE2_METHOD = WifiEnterpriseConfig.Phase2.MSCHAPV2; private final String mXmlDocHeader = "XmlUtilTest"; - @Mock private WifiConfigStoreEncryptionUtil mWifiConfigStoreEncryptionUtil; + private WifiConfigStoreEncryptionUtil mWifiConfigStoreEncryptionUtil = null; @Before public void setUp() throws Exception { @@ -117,6 +115,7 @@ public class XmlUtilTest { @Test public void testPskWifiConfigurationSerializeDeserializeWithEncryption() throws IOException, XmlPullParserException { + mWifiConfigStoreEncryptionUtil = mock(WifiConfigStoreEncryptionUtil.class); WifiConfiguration pskNetwork = WifiConfigurationTestUtil.createPskNetwork(); EncryptedData encryptedData = new EncryptedData(new byte[0], new byte[0]); when(mWifiConfigStoreEncryptionUtil.encrypt(pskNetwork.preSharedKey.getBytes())) @@ -429,6 +428,7 @@ public class XmlUtilTest { config.setEapMethod(TEST_EAP_METHOD); config.setPhase2Method(TEST_PHASE2_METHOD); + mWifiConfigStoreEncryptionUtil = mock(WifiConfigStoreEncryptionUtil.class); EncryptedData encryptedData = new EncryptedData(new byte[0], new byte[0]); when(mWifiConfigStoreEncryptionUtil.encrypt(TEST_PASSWORD.getBytes())) .thenReturn(encryptedData); |