use of com.beanit.asn1bean.ber.ReverseByteArrayOutputStream in project sandbox-java by stIncMale.
the class InAppReceipt method encodeAndSave.
public void encodeAndSave(int encodingSizeGuess) throws IOException {
ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
encode(reverseOS, false);
code = reverseOS.getArray();
}
use of com.beanit.asn1bean.ber.ReverseByteArrayOutputStream in project sandbox-java by stIncMale.
the class Payload method encodeAndSave.
public void encodeAndSave(int encodingSizeGuess) throws IOException {
ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
encode(reverseOS, false);
code = reverseOS.getArray();
}
use of com.beanit.asn1bean.ber.ReverseByteArrayOutputStream 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.ber.ReverseByteArrayOutputStream in project jasn1 by openmuc.
the class TaggingTest method implicitlyRetaggedTaggedChoiceTest.
@Test
public void implicitlyRetaggedTaggedChoiceTest() throws Exception {
ImplicitlyRetaggedTaggedChoice choice = new ImplicitlyRetaggedTaggedChoice();
choice.setMyInteger(new BerInteger(1));
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
choice.encode(os);
assertArrayEquals(toBytes("A305A403020101"), os.getArray());
}
use of com.beanit.asn1bean.ber.ReverseByteArrayOutputStream in project jasn1 by openmuc.
the class TaggingTest method seqOfExplicitlyTaggedTypeTest.
@Test
public void seqOfExplicitlyTaggedTypeTest() throws Exception {
SeqOfExplicitlyTaggedType seqOf = new SeqOfExplicitlyTaggedType();
List<BerInteger> integerList = seqOf.getBerInteger();
integerList.add(new BerInteger(3));
integerList.add(new BerInteger(4));
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
seqOf.encode(os);
assertArrayEquals(toBytes("300AA303020103A303020104"), os.getArray());
seqOf = new SeqOfExplicitlyTaggedType();
seqOf.decode(new ByteArrayInputStream(os.getArray()));
}
Aggregations