1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.net.eap.test.message;
18 
19 import static com.android.internal.net.TestUtils.hexStringToByteArray;
20 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.AT_VERSION_LIST_DATA;
21 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.IDENTITY_STRING;
22 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.IV;
23 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.NONCE_MT_STRING;
24 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.RAND_1;
25 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.RAND_2;
26 import static com.android.internal.net.eap.test.message.simaka.attributes.EapTestAttributeDefinitions.RES;
27 
28 /**
29  * EapTestMessageDefinitions provides byte[] encodings of commonly used EAP Messages.
30  *
31  * @see <a href="https://tools.ietf.org/html/rfc3748#section-4">RFC 3748, Extensible Authentication
32  * Protocol (EAP)</a>
33  */
34 public class EapTestMessageDefinitions {
35     public static final String ID = "10";
36     public static final int ID_INT = Integer.parseInt(ID, 16 /* radix */);
37 
38     // EAP-AKA Identity request
39     public static final String EAP_REQUEST_TYPE_DATA = "0500000D010000";
40     public static final byte[] EAP_AKA_IDENTITY_REQUEST =
41             hexStringToByteArray(EAP_REQUEST_TYPE_DATA);
42 
43     // EAP-AKA/Identity request with no attributes
44     public static final byte[] EAP_REQUEST_AKA = hexStringToByteArray("01" + ID + "000817050000");
45     public static final byte[] EAP_REQUEST_AKA_IDENTITY_PACKET =
46             hexStringToByteArray("01" + ID + "000A17" + EAP_REQUEST_TYPE_DATA);
47     public static final byte[] EAP_REQUEST_IDENTITY_PACKET =
48             hexStringToByteArray("01" + ID + "000501");
49     public static final byte[] EAP_REQUEST_IDENTITY_PACKET_TOO_LONG =
50             hexStringToByteArray("01" + ID + "00050100");
51 
52     // EAP-Identity: hex for ASCII in "[email protected]"
53     public static final String EAP_IDENTITY_STRING = "7465737440616E64726F69642E6E6574";
54     public static final byte[] EAP_IDENTITY = hexStringToByteArray(EAP_IDENTITY_STRING);
55     public static final byte[] EAP_RESPONSE_IDENTITY_PACKET =
56             hexStringToByteArray("02" + ID + "001501" + EAP_IDENTITY_STRING);
57     public static final byte[] EAP_RESPONSE_IDENTITY_DEFAULT_PACKET =
58             hexStringToByteArray("02" + ID + "000501");
59     public static final byte[] EAP_REQUEST_NOTIFICATION_PACKET =
60             hexStringToByteArray("01" + ID + "000802AABBCC");
61     public static final byte[] EAP_SUCCESS_PACKET = hexStringToByteArray("03" + ID + "0004");
62     public static final byte[] EAP_FAILURE_PACKET = hexStringToByteArray("04" + ID + "0004");
63     public static final byte[] EAP_SIM_CLIENT_ERROR_RESPONSE =
64             hexStringToByteArray("02" + ID + "000C120E000016010001");
65     public static final byte[] EAP_SIM_CLIENT_ERROR_INSUFFICIENT_CHALLENGES =
66             hexStringToByteArray("02" + ID + "000C120E000016010002");
67     public static final byte[] EAP_SIM_CLIENT_ERROR_UNABLE_TO_PROCESS =
68             hexStringToByteArray("02" + ID + "000C120E000016010000");
69     public static final byte[] EAP_AKA_CLIENT_ERROR_UNABLE_TO_PROCESS =
70             hexStringToByteArray("02" + ID + "000C170E000016010000");
71 
72     // EAP-SIM response containing SELECTED_VERSION (1) and IDENTITY attributes
73     public static final byte[] EAP_SIM_RESPONSE_PACKET = hexStringToByteArray(
74             "02" + ID + "0024120A0000100100010E060011" + IDENTITY_STRING + "000000");
75     public static final byte[] EAP_SIM_RESPONSE_WITHOUT_IDENTITY =
76             hexStringToByteArray("02" + ID + "0020120A000007050000" + NONCE_MT_STRING + "10010001");
77     public static final byte[] EAP_SIM_NOTIFICATION_RESPONSE = hexStringToByteArray(
78             "02" + ID + "0008120C0000");
79     public static final byte[] EAP_AKA_NOTIFICATION_RESPONSE =
80             hexStringToByteArray("02" + ID + "0008170C0000");
81 
82     // Body of EapData is the list of supported methods
83     public static final byte[] EAP_RESPONSE_NAK_PACKET =
84             hexStringToByteArray("02" + ID + "00060312");
85     public static final byte[] EAP_RESPONSE_NOTIFICATION_PACKET =
86             hexStringToByteArray("02" + ID + "000502");
87     public static final byte[] EAP_REQUEST_MD5_CHALLENGE =
88             hexStringToByteArray("01" + ID + "000504");
89     public static final byte[] EAP_REQUEST_NAK_PACKET =
90             hexStringToByteArray("01" + ID + "000503");
91     public static final String EAP_REQUEST_SIM_TYPE_DATA = "0A00000F02000200010000";
92     public static final byte[] EAP_REQUEST_SIM_START_PACKET =
93             hexStringToByteArray("01" + ID + "001012" + EAP_REQUEST_SIM_TYPE_DATA);
94 
95     public static final byte[] REQUEST_UNSUPPORTED_TYPE_PACKET =
96             hexStringToByteArray("01" + ID + "0005FF");
97     public static final byte[] REQUEST_MISSING_TYPE_PACKET =
98             hexStringToByteArray("01" + ID + "0004");
99     public static final byte[] LONG_SUCCESS_PACKET = hexStringToByteArray("03" + ID + "000500");
100     public static final byte[] SHORT_PACKET = hexStringToByteArray("01" + ID + "0005");
101     public static final byte[] INCOMPLETE_HEADER_PACKET = hexStringToByteArray("03" + ID);
102     public static final byte[] INVALID_CODE_PACKET = hexStringToByteArray("F0" + ID + "0004");
103 
104     // Attributes
105     public static final String SKIPPABLE_DATA = "112233445566";
106     public static final byte[] SKIPPABLE_DATA_BYTES = hexStringToByteArray(SKIPPABLE_DATA);
107     public static final byte[] SKIPPABLE_INVALID_ATTRIBUTE =
108             hexStringToByteArray("FF02" + SKIPPABLE_DATA);
109     public static final byte[] NON_SKIPPABLE_INVALID_ATTRIBUTE =
110             hexStringToByteArray("7F010000");
111 
112     // Type-Data
113     public static final byte[] EAP_SIM_START_SUBTYPE =
114             hexStringToByteArray("0A00000F02" + AT_VERSION_LIST_DATA + "0A010000");
115     public static final byte[] INVALID_SUBTYPE = hexStringToByteArray("FF");
116     public static final byte[] TYPE_DATA_INVALID_AT_RAND =
117             hexStringToByteArray("0A000001050000" + RAND_1);
118     public static final byte[] SHORT_TYPE_DATA = hexStringToByteArray("0A");
119     public static final byte[] TYPE_DATA_INVALID_ATTRIBUTE =
120             hexStringToByteArray("0A00007F01");
121     public static final byte[] EAP_SIM_START_DUPLICATE_ATTRIBUTES =
122             hexStringToByteArray("0A00000F02" + "0A010000" + "0A010000");
123 
124     // RAND Challenge Results
125     public static final String SRES_1 = "11223344";
126     public static final byte[] SRES_1_BYTES = hexStringToByteArray(SRES_1);
127     public static final String SRES_2 = "44332211";
128     public static final byte[] SRES_2_BYTES = hexStringToByteArray(SRES_2);
129     public static final byte[] SRES_BYTES = hexStringToByteArray(SRES_1 + SRES_2);
130     public static final String KC_1 = "0102030405060708";
131     public static final byte[] KC_1_BYTES = hexStringToByteArray(KC_1);
132     public static final String KC_2 = "0807060504030201";
133     public static final byte[] KC_2_BYTES = hexStringToByteArray(KC_2);
134     public static final byte[] VALID_CHALLENGE_RESPONSE =
135             hexStringToByteArray("04" + SRES_1 + "08" + KC_1);
136     public static final byte[] CHALLENGE_RESPONSE_INVALID_SRES = hexStringToByteArray("03");
137     public static final byte[] CHALLENGE_RESPONSE_INVALID_KC =
138             hexStringToByteArray("04" + SRES_1 + "04");
139 
140     public static final String IMSI = "123456789012345";
141     public static final String EAP_SIM_IDENTITY = "1" + IMSI;
142     public static final byte[] EAP_SIM_IDENTITY_BYTES = hexStringToByteArray(EAP_SIM_IDENTITY);
143 
144     // ASCII hex for "0" + IMSI (EAP-AKA identity format)
145     public static final String EAP_AKA_IDENTITY_BYTES = "30313233343536373839303132333435";
146 
147     // Master Key generation
148     public static final String MK_STRING = "0123456789ABCDEF0123456789ABCDEF01234567";
149     public static final byte[] MK = hexStringToByteArray(MK_STRING);
150     public static final String K_ENCR_STRING = "000102030405060708090A0B0C0D0E0F";
151     public static final byte[] K_ENCR = hexStringToByteArray(K_ENCR_STRING);
152     public static final String K_AUT_STRING = "0F0E0D0C0B0A09080706050403020100";
153     public static final byte[] K_AUT = hexStringToByteArray(K_AUT_STRING);
154     public static final String MSK_STRING =
155             "00112233445566778899AABBCCDDEEFF"
156             + "00112233445566778899AABBCCDDEEFF"
157             + "00112233445566778899AABBCCDDEEFF"
158             + "00112233445566778899AABBCCDDEEFF";
159     public static final byte[] MSK = hexStringToByteArray(MSK_STRING);
160     public static final String EMSK_STRING =
161             "FFEEDDCCBBAA99887766554433221100"
162             + "FFEEDDCCBBAA99887766554433221100"
163             + "FFEEDDCCBBAA99887766554433221100"
164             + "FFEEDDCCBBAA99887766554433221100";
165     public static final byte[] EMSK = hexStringToByteArray(EMSK_STRING);
166 
167     // MAC computation
168     public static final String ORIGINAL_MAC_STRING = "112233445566778899AABBCCDDEEFF11";
169     public static final byte[] ORIGINAL_MAC = hexStringToByteArray(ORIGINAL_MAC_STRING);
170     public static final String COMPUTED_MAC_STRING = "FFEEDDCCBBAA998877665544332211FF";
171     public static final byte[] COMPUTED_MAC = hexStringToByteArray(COMPUTED_MAC_STRING);
172     public static final String EAP_SIM_CHALLENGE_REQUEST_STRING =
173             "01" + ID + "0040" // EAP-Request | ID | length in bytes
174             + "120b0000" // EAP-SIM | Challenge | 2B padding
175             + "01090000" + RAND_1 + RAND_2 // EAP-SIM AT_RAND attribute
176             + "0B05000000000000000000000000000000000000"; // AT_MAC attribute with no MAC
177     public static final byte[] MAC_INPUT =
178             hexStringToByteArray(EAP_SIM_CHALLENGE_REQUEST_STRING + NONCE_MT_STRING);
179 
180     // Response Message with MAC
181     public static final String EAP_SIM_CHALLENGE_RESPONSE_EMPTY_MAC =
182             "02" + ID + "001C" // EAP-Response | ID | length in bytes
183             + "120b0000" // EAP-SIM | Challenge | 2B padding
184             + "0B05000000000000000000000000000000000000"; // AT_MAC attribute with no MAC
185     public static final byte[] EAP_SIM_CHALLENGE_RESPONSE_MAC_INPUT =
186             hexStringToByteArray(EAP_SIM_CHALLENGE_RESPONSE_EMPTY_MAC + SRES_1 + SRES_2);
187     public static final byte[] EAP_SIM_CHALLENGE_RESPONSE_WITH_MAC = hexStringToByteArray(
188             "02" + ID + "001C" // EAP-Response | ID | length in bytes
189             + "120b0000" // EAP-SIM | Challenge | 2B padding
190             + "0B050000" + COMPUTED_MAC_STRING); // AT_MAC attribute
191 
192     public static final byte[] EAP_SIM_NOTIFICATION_REQUEST_WITH_EMPTY_MAC = hexStringToByteArray(
193             "01" + ID + "0020" // EAP-Request | ID | length in bytes
194                     + "120C0000" // EAP-SIM | Notification | 2B padding
195                     + "0C010000" // AT_NOTIFICATION attribute
196                     + "0B05000000000000000000000000000000000000"); // empty AT_MAC attribute
197     public static final byte[] EAP_SIM_NOTIFICATION_RESPONSE_WITH_EMPTY_MAC = hexStringToByteArray(
198             "02" + ID + "001C" // EAP-Response | ID | length in bytes
199                     + "120C0000" // EAP-SIM | Notification | 2B padding
200                     + "0B05000000000000000000000000000000000000"); // empty AT_MAC attribute
201 
202     public static final byte[] EAP_SIM_NOTIFICATION_RESPONSE_WITH_MAC = hexStringToByteArray(
203             "02" + ID + "001C" // EAP-Response | ID | length in bytes
204                     + "120C0000" // EAP-SIM | Notification | 2B padding
205                     + "0B050000" + COMPUTED_MAC_STRING); // AT_MAC attribute
206 
207     public static final byte[] EAP_AKA_NOTIFICATION_REQUEST_REAUTH_WITH_EMPTY_MAC =
208             hexStringToByteArray(
209                     "01" + ID + "0048" // EAP-Request | ID | length in bytes(4 4 4 20 20 20 = 72)
210                             + "170C0000" // EAP-AKA | Notification | 2B padding
211                             + "0C010000" // AT_NOTIFICATION attribute
212                             + "81050000"
213                             + IV // AT_IV attribute
214                             + "82050000"
215                             + "AF82D73A5A75AF1D3871244CA0B19338" // AT_ENCR_DATA attribute
216                             + "0B05000000000000000000000000000000000000"); // empty AT_MAC attribute
217 
218     public static final byte[] EAP_AKA_NOTIFICATION_RESPONSE_REAUTH_WITH_EMPTY_MAC =
219             hexStringToByteArray(
220                     "02"
221                             + ID
222                             + "0044" // EAP-Response | ID | length in bytes(4 4 20 20 20 = 68)
223                             + "170C0000" // EAP-AKA | Notification | 2B padding
224                             + "81050000"
225                             + IV // AT_IV attribute
226                             + "82050000"
227                             + "AF82D73A5A75AF1D3871244CA0B19338" // AT_ENCR_DATA attribute
228                             + "0B05000000000000000000000000000000000000"); // empty AT_MAC attribute
229 
230     public static final byte[] EAP_AKA_NOTIFICATION_RESPONSE_REAUTH_WITH_MAC =
231             hexStringToByteArray(
232                     "02"
233                             + ID
234                             + "0044" // EAP-Response | ID | length in bytes(4 4 20 20 20 = 68)
235                             + "170C0000" // EAP-AKA | Notification | 2B padding
236                             + "81050000"
237                             + IV // AT_IV attribute
238                             + "82050000"
239                             + "AF82D73A5A75AF1D3871244CA0B19338" // AT_ENCR_DATA attribute
240                             + "0B050000"
241                             + COMPUTED_MAC_STRING); // AT_MAC attribute
242 
243     public static final byte[] EAP_AKA_IDENTITY_RESPONSE =
244             hexStringToByteArray("02" + ID + "001C" // EAP-Response | ID | length in bytes
245                     + "17050000" // EAP-AKA | Identity | 2B padding
246                     + "0E050010" + EAP_AKA_IDENTITY_BYTES); // AT_IDENTITY ("0" + IMSI)
247 
248     // Base64 of: FF0111
249     public static final String EAP_AKA_UICC_RESP_INVALID_TAG = "/wER";
250 
251     // Base64 of: DC0E112233445566778899AABBCCDDEE
252     public static final String EAP_AKA_UICC_RESP_SYNCHRONIZE_BASE_64 = "3A4RIjNEVWZ3iJmqu8zd7g==";
253 
254     public static final byte[] EAP_AKA_SYNCHRONIZATION_FAILURE =
255             hexStringToByteArray("02" + ID + "0018" // EAP-Response | ID | length in bytes
256                     + "17040000" // EAP-SIM | Synchronization-Failure | 2B padding
257                     + "0404112233445566778899AABBCCDDEE"); // AT_AUTS attribute
258 
259     public static final String CK = "00112233445566778899AABBCCDDEEFF";
260     public static final byte[] CK_BYTES = hexStringToByteArray(CK);
261     public static final String IK = "FFEEDDCCBBAA99887766554433221100";
262     public static final byte[] IK_BYTES = hexStringToByteArray(IK);
263 
264     // Base-64 of: 'DB05' + RES_BYTES + '10' + CK + '10' + IK
265     // 'DB0511223344551000112233445566778899AABBCCDDEEFF10FFEEDDCCBBAA99887766554433221100'
266     public static final String EAP_AKA_UICC_RESP_SUCCESS_BASE_64 =
267             "2wURIjNEVRAAESIzRFVmd4iZqrvM3e7/EP/u3cy7qpmId2ZVRDMiEQA=";
268 
269     public static final byte[] EAP_AKA_AUTHENTICATION_REJECT =
270             hexStringToByteArray("02" + ID + "000817020000");
271     public static final String EAP_AKA_CHALLENGE_RESPONSE_MAC = "7086E8341306F99CDB949DBE9CAC4EB2";
272     public static final byte[] EAP_AKA_CHALLENGE_RESPONSE_MAC_BYTES =
273             hexStringToByteArray(EAP_AKA_CHALLENGE_RESPONSE_MAC);
274     public static final byte[] EAP_AKA_CHALLENGE_RESPONSE_TYPE_DATA =
275             hexStringToByteArray(
276                     "01000003030028" + RES + "0000000B050000" + EAP_AKA_CHALLENGE_RESPONSE_MAC);
277     public static final byte[] EAP_AKA_CHALLENGE_RESPONSE =
278             hexStringToByteArray(
279                     "02100028" // EAP-Response | ID | length in bytes
280                             + "17010000" // EAP-AKA | Challenge | 2B padding
281                             + "03030028" + RES + "000000" // AT_RES attribute
282                             + "0B050000" + EAP_AKA_CHALLENGE_RESPONSE_MAC); // AT_MAC attribute
283 
284     public static final byte[] EAP_SUCCESS = hexStringToByteArray("03860004");
285 
286     public static final byte[] EAP_REQUEST_MSCHAP_V2 =
287             hexStringToByteArray("01" + ID + "00061A01");
288 
289     // MSCHAPv2 Test vectors taken from RFC 2759#9.2 and RFC 3079#3.5.3
290     public static final String MSCHAP_V2_USERNAME = "User";
291     public static final String MSCHAP_V2_USERNAME_HEX = "55736572";
292     public static final byte[] MSCHAP_V2_USERNAME_ASCII_BYTES =
293             hexStringToByteArray(MSCHAP_V2_USERNAME_HEX);
294     public static final String MSCHAP_V2_PASSWORD = "clientPass";
295     public static final byte[] MSCHAP_V2_PASSWORD_UTF_BYTES =
296             hexStringToByteArray("63006C00690065006E0074005000610073007300");
297     public static final String MSCHAP_V2_AUTHENTICATOR_CHALLENGE_STRING =
298             "5B5D7C7D7B3F2F3E3C2C602132262628";
299     public static final byte[] MSCHAP_V2_AUTHENTICATOR_CHALLENGE =
300             hexStringToByteArray(MSCHAP_V2_AUTHENTICATOR_CHALLENGE_STRING);
301     public static final String MSCHAP_V2_PEER_CHALLENGE_STRING = "21402324255E262A28295F2B3A337C7E";
302     public static final byte[] MSCHAP_V2_PEER_CHALLENGE =
303             hexStringToByteArray(MSCHAP_V2_PEER_CHALLENGE_STRING);
304     public static final byte[] MSCHAP_V2_CHALLENGE = hexStringToByteArray("D02E4386BCE91226");
305     public static final byte[] MSCHAP_V2_PASSWORD_HASH =
306             hexStringToByteArray("44EBBA8D5312B8D611474411F56989AE");
307     public static final byte[] MSCHAP_V2_PASSWORD_HASH_HASH =
308             hexStringToByteArray("41C00C584BD2D91C4017A2A12FA59F3F");
309     public static final String MSCHAP_V2_NT_RESPONSE_STRING =
310             "82309ECD8D708B5EA08FAA3981CD83544233114A3D85D6DF";
311     public static final byte[] MSCHAP_V2_NT_RESPONSE =
312             hexStringToByteArray(MSCHAP_V2_NT_RESPONSE_STRING);
313     public static final byte[] MSCHAP_V2_AUTHENTICATOR_RESPONSE =
314             hexStringToByteArray("407A5589115FD0D6209F510FE9C04566932CDA56");
315     public static final byte[] MSCHAP_V2_MASTER_KEY =
316             hexStringToByteArray("FDECE3717A8C838CB388E527AE3CDD31");
317 
318     // generated based on RFC 3079#3.5.3 params
319     public static final String SEND_KEY = "D5F0E9521E3EA9589645E86051C82226";
320     public static final byte[] MSCHAP_V2_SEND_START_KEY = hexStringToByteArray(SEND_KEY);
321 
322     // This value is labeled 'send key' in RFC 3079#3.5.3. However, it's used as 'receive key' here,
323     // because send and receive keys are swapped for peers relative to authenticators.
324     public static final String RECEIVE_KEY = "8B7CDC149B993A1BA118CB153F56DCCB";
325     public static final byte[] MSCHAP_V2_RECEIVE_START_KEY = hexStringToByteArray(RECEIVE_KEY);
326 
327     // MSK: MSCHAP_V2_SEND_START_KEY + MSCHAP_V2_RECEIVE_START_KEY, padded to 64B
328     public static final byte[] MSCHAP_V2_MSK =
329             hexStringToByteArray(
330                     SEND_KEY
331                             + RECEIVE_KEY
332                             + "0000000000000000000000000000000000000000000000000000000000000000");
333     public static final int MSCHAP_V2_EMSK_LEN = 64;
334     public static final byte[] MSCHAP_V2_EMSK = new byte[MSCHAP_V2_EMSK_LEN];
335 
336     public static final String MSCHAP_V2_ID = "42";
337     public static final int MSCHAP_V2_ID_INT = Integer.parseInt(MSCHAP_V2_ID, 16 /* radix */);
338     public static final byte[] EAP_MSCHAP_V2_CHALLENGE_RESPONSE =
339             hexStringToByteArray("02" + ID + "003F" // EAP-Response | ID | length in bytes
340                     + "1A02" + MSCHAP_V2_ID // EAP-MSCHAPv2 | Response | MSCHAPv2 ID
341                     + "003A31" // MS length | Value Size (0x31)
342                     + MSCHAP_V2_PEER_CHALLENGE_STRING
343                     + "0000000000000000" // 8B (reserved)
344                     + MSCHAP_V2_NT_RESPONSE_STRING
345                     + "00" // Flags (always 0)
346                     + MSCHAP_V2_USERNAME_HEX);
347 
348     public static final byte[] EAP_MSCHAP_V2_SUCCESS_RESPONSE =
349             hexStringToByteArray("02" + ID + "0006" // EAP-Response | ID | length in bytes
350                     + "1A03"); // EAP-MSCHAPv2 | Success
351 
352     public static final byte[] INVALID_AUTHENTICATOR_RESPONSE = new byte[20];
353 
354     public static final byte[] EAP_MSCHAP_V2_FAILURE_RESPONSE =
355             hexStringToByteArray("02" + ID + "0006" // EAP-Response | ID | length in bytes
356                     + "1A04"); // EAP-MSCHAPv2 | Failure
357 
358     public static final byte[] EAP_AKA_PRIME_REQUEST =
359             hexStringToByteArray("01" + ID + "000832050000");
360     public static final byte[] EAP_AKA_PRIME_CLIENT_ERROR_UNABLE_TO_PROCESS =
361             hexStringToByteArray("02" + ID + "000C320E000016010000");
362     public static final String EAP_AKA_PRIME_IDENTITY = "36313233343536373839303132333435";
363     public static final byte[] EAP_AKA_PRIME_IDENTITY_BYTES =
364             hexStringToByteArray(EAP_AKA_PRIME_IDENTITY);
365     public static final byte[] EAP_AKA_PRIME_IDENTITY_RESPONSE =
366             hexStringToByteArray(
367                     "02" + ID + "001C" // EAP-Response | ID | length in bytes
368                             + "32050000" // EAP-AKA' | Identity | 2B padding
369                             + "0E050010" + EAP_AKA_PRIME_IDENTITY); // AT_IDENTITY ("6" + IMSI)
370     public static final byte[] EAP_AKA_PRIME_AUTHENTICATION_REJECT =
371             hexStringToByteArray(
372                     "02" + ID + "0008" // EAP-Response | ID | length in bytes
373                             + "32020000"); // EAP-AKA' | Authentication Reject | 2B padding
374 
375     // EAP-TTLS test vectors
376     public static final String EAP_DUMMY_REQUEST = "011000051A";
377     public static final String EAP_DUMMY_RESPONSE = "021000051A";
378     public static final String EAP_TTLS_DUMMY_DATA =
379             "17010160301000E050010a516030100a010000a151603010036313233343"
380                     + "5363738393031323334003A31316030100a55a51603320500000100a516030100a50";
381     public static final String EAP_TTLS_DUMMY_DATA_INITIAL_FRAGMENT =
382             "36313233343536373839303132333435030100a010000a151603010036313"
383                     + "2333435363738393031323334003A31316030100a55a51603320500000100a51603";
384     public static final String EAP_TTLS_DUMMY_DATA_FINAL_FRAGMENT =
385             "010000a10E050010320200000000000000000000";
386     public static final String EAP_TTLS_DUMMY_DATA_ASSEMBLED_FRAGMENT =
387             EAP_TTLS_DUMMY_DATA_INITIAL_FRAGMENT + EAP_TTLS_DUMMY_DATA_FINAL_FRAGMENT;
388 
389     public static final byte[] EAP_DUMMY_REQUEST_BYTES = hexStringToByteArray(EAP_DUMMY_REQUEST);
390     public static final byte[] EAP_DUMMY_RESPONSE_BYTES = hexStringToByteArray(EAP_DUMMY_RESPONSE);
391     public static final byte[] EAP_TTLS_DUMMY_DATA_BYTES =
392             hexStringToByteArray(EAP_TTLS_DUMMY_DATA);
393     public static final byte[] EAP_TTLS_DUMMY_DATA_ASSEMBLED_FRAGMENT_BYTES =
394             hexStringToByteArray(EAP_TTLS_DUMMY_DATA_ASSEMBLED_FRAGMENT);
395     public static final byte[] EAP_TTLS_DUMMY_DATA_INITIAL_FRAGMENT_BYTES =
396             hexStringToByteArray(EAP_TTLS_DUMMY_DATA_INITIAL_FRAGMENT);
397     public static final byte[] EAP_TTLS_DUMMY_DATA_FINAL_FRAGMENT_BYTES =
398             hexStringToByteArray(EAP_TTLS_DUMMY_DATA_FINAL_FRAGMENT);
399 
400     public static final byte[] EAP_REQUEST_TTLS_START =
401             hexStringToByteArray(
402                     "01" + ID + "0006" // EAP-REQUEST | ID | length in bytes
403                             + "1520"); // EAP-TTLS | flags
404     public static final byte[] EAP_RESPONSE_TTLS_WITH_LENGTH =
405             hexStringToByteArray(
406                     "02" + ID + "004A" // EAP-RESPONSE | ID | length in bytes
407                             + "158000000040" // EAP-TTLS | flags | message length in bytes
408                             + EAP_TTLS_DUMMY_DATA);
409     public static final byte[] EAP_RESPONSE_TTLS_WITHOUT_LENGTH =
410             hexStringToByteArray(
411                     "02" + ID + "0046" // EAP-RESPONSE | ID | length in bytes
412                             + "1500" // EAP-TTLS | flags
413                             + EAP_TTLS_DUMMY_DATA);
414     public static final byte[] EAP_RESPONSE_TTLS_INITIAL_FRAGMENT =
415             hexStringToByteArray(
416                     "02" + ID + "004A" // EAP-RESPONSE | ID | length in bytes
417                             + "15C000000054" // EAP-TTLS | flags | message length in bytes
418                             + EAP_TTLS_DUMMY_DATA_INITIAL_FRAGMENT);
419     public static final byte[] EAP_RESPONSE_TTLS_FINAL_FRAGMENT =
420             hexStringToByteArray(
421                     "02" + ID + "001A" // EAP-RESPONSE | ID | length in bytes
422                             + "1500" // EAP-TTLS | flags
423                             + EAP_TTLS_DUMMY_DATA_FINAL_FRAGMENT);
424     public static final byte[] EAP_RESPONSE_TTLS_ACK =
425             hexStringToByteArray(
426                     "02" + ID + "0006" // EAP-RESPONSE | ID | length in bytes
427                             + "1500"); // EAP-TTLS | flags
428     public static final byte[] EAP_MESSAGE_AVP_EAP_REQUEST =
429             hexStringToByteArray(
430                     "0000004F"
431                             + "40"
432                             + "00000D" // AVP Code | AVP Flags | Avp Length
433                             + EAP_DUMMY_REQUEST // EAP-REQUEST
434                             + "000000"); // Padding
435     public static final byte[] EAP_MESSAGE_AVP_EAP_RESPONSE =
436             hexStringToByteArray(
437                     "0000004F"
438                             + "40"
439                             + "00000D" // AVP Code | AVP Flags | Avp Length
440                             + EAP_DUMMY_RESPONSE // EAP-RESPONSE
441                             + "000000"); // Padding
442 }
443