use of com.beanit.asn1bean.compiler.pedefinitions.ProfileElement in project jasn1 by openmuc.
the class MobileTest method puk.
@Test
public void puk() throws Exception {
ProfileElement pukProfileElement = new ProfileElement();
PEPUKCodes.PukCodes pukCodes = new PEPUKCodes.PukCodes(Arrays.asList(createPUK((byte) 1, "3030303030303030", (byte) 9, (byte) 9), createPUK((byte) 2, "3132333435363738"), createPUK((byte) 0x81, "3132333435363738", (byte) 8, (byte) 8)));
pukProfileElement.pukCodes = new PEPUKCodes(new PEHeader(new BerNull(), new UInt15(2)), pukCodes);
ReverseByteArrayOutputStream reverseOutputStream = new ReverseByteArrayOutputStream(2048, true);
pukProfileElement.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 = "A3 3F A0 05 80 00 81 01 02 A1 36 30 11 80 01 01 81 08 3030303030303030 82 02 0099 30 0D 80 01 02 81 08 3132333435363738 30 12 80 02 0081 81 08 3132333435363738 82 02 0088".replaceAll("\\s", "");
assertEquals(expected, HexString.fromBytes(code));
}
use of com.beanit.asn1bean.compiler.pedefinitions.ProfileElement in project jasn1 by openmuc.
the class MobileTest method decodeEncodeTest.
@Test
public void decodeEncodeTest() throws Exception {
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", "");
byte[] code = HexString.toBytes(expected);
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);
}
use of com.beanit.asn1bean.compiler.pedefinitions.ProfileElement 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));
}
use of com.beanit.asn1bean.compiler.pedefinitions.ProfileElement in project jasn1 by openmuc.
the class MobileTest method header.
@Test
public void header() throws Exception {
ProfileElement headerProfileElement = new ProfileElement();
ServicesList servicesList = new ServicesList();
ProfileHeader.EUICCMandatoryGFSTEList GFSTEList = new ProfileHeader.EUICCMandatoryGFSTEList();
GFSTEList.seqOf = Arrays.asList(new BerObjectIdentifier(new int[] { 2, 23, 143, 1, 2, 1 }), new BerObjectIdentifier(new int[] { 2, 23, 143, 1, 2, 4 }));
servicesList.usim = new BerNull();
servicesList.milenage = new BerNull();
servicesList.javacard = new BerNull();
headerProfileElement.header = new ProfileHeader(new UInt8(2), new UInt8(0), new BerUTF8String("SIMalliance Sample Profile"), new BerOctetString(HexString.toBytes("89019990001234567893")), null, servicesList, GFSTEList, null, null);
ReverseByteArrayOutputStream reverseByteArrayOutputStream = new ReverseByteArrayOutputStream(2048, true);
headerProfileElement.encode(reverseByteArrayOutputStream);
byte[] code = reverseByteArrayOutputStream.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 = "A0 48 80 01 02 81 01 00 82 1A 53494D616C6C69616E63652053616D706C652050726F66696C65 83 0A 89019990001234567893 A5 06 81 00 84 00 8B 00 A6 10 06 06 67810F010201 06 06 67810F010204".replaceAll("\\s", "");
assertEquals(expected, HexString.fromBytes(code));
}
Aggregations