summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-05-11 23:11:22 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-05-11 23:11:22 -0700
commit8e3b01bd92259e2dcf8c2a72b4d0ab967c03e4e7 (patch)
tree14385794ef3cc6ccc9ebc2c540774bba46a6f6f8 /tests
parent719403d0cc89312877765eb48f9c98bdcc0d9684 (diff)
parentbd007ddac74fb5ca8281e8ad46fbb7ef314512b3 (diff)
Merge "[InformationElementUtil] Add FT/SAE AKM" into qt-dev am: fcafe95467
am: bd007ddac7 Change-Id: Idd3279059e75389ae13a21d83d3d213fbb7b5374
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java152
1 files changed, 152 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
index b7a6cefb9..cbb728644 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
@@ -388,6 +388,158 @@ public class InformationElementUtilTest {
}
/**
+ * Test Capabilities.generateCapabilitiesString() with RSN IE, CCMP and PSK+SAE transition mode.
+ * Expect the function to return a string with the proper security information.
+ */
+ @Test
+ public void buildCapabilities_rsnPskSaeTransitionElement() {
+ InformationElement ieRsn = new InformationElement();
+ ieRsn.id = InformationElement.EID_RSN;
+ ieRsn.bytes = new byte[] {
+ // RSNE Version (0x0001)
+ (byte) 0x01, (byte) 0x00,
+ // Group cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of cipher suites (1)
+ (byte) 0x01, (byte) 0x00,
+ // Cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of AKMs (2)
+ (byte) 0x02, (byte) 0x00,
+ // PSK AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x02,
+ // SAE AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x08,
+ // Padding
+ (byte) 0x00, (byte) 0x00 };
+
+ InformationElement[] ies = new InformationElement[] { ieRsn };
+
+ BitSet beaconCap = new BitSet(16);
+ beaconCap.set(4);
+
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
+ assertEquals("[RSN-PSK+SAE-CCMP]", result);
+ }
+
+ /**
+ * Test Capabilities.generateCapabilitiesString() with RSN IE, CCMP and SAE+FT/SAE.
+ * Expect the function to return a string with the proper security information.
+ */
+ @Test
+ public void buildCapabilities_rsnSaeFtSaeElement() {
+ InformationElement ieRsn = new InformationElement();
+ ieRsn.id = InformationElement.EID_RSN;
+ ieRsn.bytes = new byte[] {
+ // RSNE Version (0x0001)
+ (byte) 0x01, (byte) 0x00,
+ // Group cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of cipher suites (1)
+ (byte) 0x01, (byte) 0x00,
+ // Cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of AKMs (2)
+ (byte) 0x02, (byte) 0x00,
+ // SAE AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x08,
+ // FT/SAE AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x09,
+ // Padding
+ (byte) 0x00, (byte) 0x00 };
+
+ InformationElement[] ies = new InformationElement[] { ieRsn };
+
+ BitSet beaconCap = new BitSet(16);
+ beaconCap.set(4);
+
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
+ assertEquals("[RSN-SAE+FT/SAE-CCMP]", result);
+ }
+
+ /**
+ * Test Capabilities.generateCapabilitiesString() with RSN IE, CCMP and OWE.
+ * Expect the function to return a string with the proper security information.
+ */
+ @Test
+ public void buildCapabilities_rsnOweElement() {
+ InformationElement ieRsn = new InformationElement();
+ ieRsn.id = InformationElement.EID_RSN;
+ ieRsn.bytes = new byte[] {
+ // RSNE Version (0x0001)
+ (byte) 0x01, (byte) 0x00,
+ // Group cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of cipher suites (1)
+ (byte) 0x01, (byte) 0x00,
+ // Cipher suite: CCMP
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ // Number of AKMs (1)
+ (byte) 0x01, (byte) 0x00,
+ // OWE AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x12,
+ // Padding
+ (byte) 0x00, (byte) 0x00 };
+
+ InformationElement[] ies = new InformationElement[] { ieRsn };
+
+ BitSet beaconCap = new BitSet(16);
+ beaconCap.set(4);
+
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
+ assertEquals("[RSN-OWE-CCMP]", result);
+ }
+
+ /**
+ * Test Capabilities.generateCapabilitiesString() with RSN IE, GCMP-256 and SUITE_B_192.
+ * Expect the function to return a string with the proper security information.
+ */
+ @Test
+ public void buildCapabilities_rsnSuiteB192Element() {
+ InformationElement ieRsn = new InformationElement();
+ ieRsn.id = InformationElement.EID_RSN;
+ ieRsn.bytes = new byte[] {
+ // RSNE Version (0x0001)
+ (byte) 0x01, (byte) 0x00,
+ // Group cipher suite: GCMP-256
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x09,
+ // Number of cipher suites (1)
+ (byte) 0x01, (byte) 0x00,
+ // Cipher suite: GCMP-256
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x09,
+ // Number of AKMs (1)
+ (byte) 0x01, (byte) 0x00,
+ // SUITE_B_192 AKM
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x0C,
+ // Padding
+ (byte) 0x00, (byte) 0x00 };
+
+ InformationElement[] ies = new InformationElement[] { ieRsn };
+
+ BitSet beaconCap = new BitSet(16);
+ beaconCap.set(4);
+
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
+ assertEquals("[RSN-EAP_SUITE_B_192-GCMP-256]", result);
+ }
+
+ /**
* Test Capabilities.generateCapabilitiesString() with both RSN and WPA1 IE which are malformed.
* Expect the function to return a string with empty key management & pairswise cipher security
* information.