use of com.beanit.asn1bean.compiler.pedefinitions.PEPUKCodes 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));
}
Aggregations