use of com.beanit.asn1bean.compiler.pedefinitions.PEGenericFileManagement in project jasn1 by openmuc.
the class MobileTest method genericFileManagement.
@Test
public void genericFileManagement() throws Exception {
ProfileElement genericFileManagementProfileElement = new ProfileElement();
List<FileManagement.CHOICE> choices = new ArrayList<>();
choices.add(createDf((short) 0x3f00, "7821", (byte) 0x0e, "01020A"));
choices.addAll(createEf((short) 0x2f05, "4121", (byte) 0x0F, (short) 3, (short) 0x28));
choices.addAll(createEf((short) 0x2fe2, "4121", (byte) 0x0B, (short) 0x0A, null, "98109909002143658739", null));
choices.addAll(createEf((short) 0x2f00, "42210026", (byte) 0x0A, (short) 0x98, (short) 0xF0, "61184F10A0000000871002FF33FF01890000010050045553494D", null));
choices.addAll(createEf((short) 0x2f06, "42210025", (byte) 0x0A, (short) 0x01EF, null, Arrays.asList(new FileRecordContent(null, "8001019000800102A406830101950108800158A40683010A950108"), new FileRecordContent(10, "800101A40683010195010880015AA40683010A950108"), new FileRecordContent(15, "80015BA40683010A950108"), new FileRecordContent(26, "800101900080015A9700"), new FileRecordContent(27, "800103A406830101950108800158A40683010A950108"), new FileRecordContent(15, "800111A40683010195010880014AA40683010A950108"), new FileRecordContent(15, "800103A406830101950108800158A40683010A950108840132A406830101950108"), new FileRecordContent(4, "800101A406830101950108800102A406830181950108800158A40683010A950108"), new FileRecordContent(4, "800101900080011AA406830101950108800140A40683010A950108"), new FileRecordContent(10, "800101900080015AA40683010A950108"), new FileRecordContent(21, "8001019000800118A40683010A9501088001429700"), new FileRecordContent(14, "800101A40683010195010880015A9700"), new FileRecordContent(21, "800113A406830101950108800148A40683010A950108"), new FileRecordContent(13, "80015EA40683010A950108"), new FileRecordContent(26, "8001019000800102A010A406830101950108A406830102950108800158A40683010A950108"))));
choices.addAll(createEf((short) 0x2f08, "4121", (byte) 0x0A, (short) 5));
genericFileManagementProfileElement.genericFileManagement = new PEGenericFileManagement(new PEHeader(new BerNull(), new UInt15(1)), new PEGenericFileManagement.FileManagementCMD(Collections.singletonList(new FileManagement(choices))));
ReverseByteArrayOutputStream reverseOutputStream = new ReverseByteArrayOutputStream(2048, true);
genericFileManagementProfileElement.encode(reverseOutputStream);
byte[] code = reverseOutputStream.getArray();
ProfileElement rereadProfileElement = new ProfileElement();
rereadProfileElement.decode(new ByteArrayInputStream(code), null);
ReverseByteArrayOutputStream reverseOutputStream2 = new ReverseByteArrayOutputStream(2048, true);
rereadProfileElement.encode(reverseOutputStream2);
byte[] code2 = reverseOutputStream2.getArray();
assertArrayEquals(code, code2);
String expected = "A1 820237 A0 05 80 00 81 01 01 A1 82022C 30 820228 62 10 82 02 7821 83 02 3F00 8B 01 0E C6 03 01020A 62 11 82 02 4121 83 02 2F05 8B 01 0F 80 01 03 88 01 28 62 0E 82 02 4121 83 02 2FE2 8B 01 0B 80 01 0A 81 0A 98109909002143658739 62 14 82 04 4221002683 02 2F00 8B 01 0A 80 02 0098 88 01 F0 81 1A 61184F10A0000000871002FF33FF01890000010050045553494D 62 11 82 04 42210025 83 02 2F06 8B 01 0A 80 02 01EF 81 1B 8001019000800102A406830101950108800158A40683010A950108 02 01 0A 81 16 800101A40683010195010880015AA40683010A950108 02 01 0F 81 0B 80015BA40683010A950108 02 01 1A 81 0A 800101900080015A9700 02 01 1B 81 16 800103A406830101950108800158A40683010A950108 02 01 0F 81 16 800111A40683010195010880014AA40683010A950108 02 01 0F 81 21 800103A406830101950108800158A40683010A950108840132A406830101950108 02 01 04 81 21 800101A406830101950108800102A406830181950108800158A40683010A950108 02 01 04 81 1B 800101900080011AA406830101950108800140A40683010A950108 02 01 0A 81 10 800101900080015AA40683010A950108 02 01 15 81 15 8001019000800118A40683010A9501088001429700 02 01 0E 81 10 800101A40683010195010880015A9700 02 01 15 81 16 800113A406830101950108800148A40683010A950108 02 01 0D 81 0B 80015EA40683010A950108 02 01 1A81 25 8001019000800102A010A406830101950108A406830102950108800158A40683010A950108 62 0E 82 02 4121 83 02 2F08 8B 01 0A 80 01 05".replaceAll("\\s", "");
assertEquals(expected, HexString.fromBytes(code));
}
Aggregations