@Test public void test_readDEROctetString() throws Exception { byte[] in, expected; in = new byte[] { 0x04, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x05 }; expected = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x05 }; assertEqualByteArrays(expected, Serialization.readDEROctetString(in)); in = new byte[203]; in[0] = 0x04; in[1] = (byte)0x81; in[2] = (byte)200; in[3] = 0x45; expected = new byte[200]; expected[0] = 0x45; assertEqualByteArrays(expected, Serialization.readDEROctetString(in)); try { in = new byte[] { 0x12, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x05 }; Serialization.readDEROctetString(in); fail("SerializationException not thrown on invalid tag."); } catch (SerializationException e) {} try { in = new byte[] { 0x04, 0x06, 0x01, 0x02 }; Serialization.readDEROctetString(in); fail("SerializationException not thrown on invalid length."); } catch (SerializationException e) {} }
public static byte[] readDEROctetString(byte[] input) throws SerializationException { return readDEROctetString(new ByteArrayInputStream(input)); }
Serialization { public static byte[] readDEROctetString(byte[] input) throws SerializationException { return readDEROctetString(new ByteArrayInputStream(input)); } }
Serialization { public static byte[] readDEROctetString(byte[] input) throws SerializationException { return readDEROctetString(new ByteArrayInputStream(input)); } private  Serialization(); }
Serialization { public static byte[] readDEROctetString(byte[] input) throws SerializationException { return readDEROctetString(new ByteArrayInputStream(input)); } private  Serialization(); static byte[] readDEROctetString(byte[] input); static byte[] readDEROctetString(InputStream input); static byte[][] readList(byte[] input, int listWidth, int elemWidth); static byte[][] readList(InputStream input, int listWidth, int elemWidth); static byte[] readVariableBytes(InputStream input, int width); static byte[] readFixedBytes(InputStream input, int length); static int readNumber(InputStream input, int width); static long readLong(InputStream input, int width); static byte readByte(InputStream input); static void writeVariableBytes(OutputStream output, byte[] data, int width); static void writeFixedBytes(OutputStream output, byte[] data); static void writeNumber(OutputStream output, long value, int width); }
Serialization { public static byte[] readDEROctetString(byte[] input) throws SerializationException { return readDEROctetString(new ByteArrayInputStream(input)); } private  Serialization(); static byte[] readDEROctetString(byte[] input); static byte[] readDEROctetString(InputStream input); static byte[][] readList(byte[] input, int listWidth, int elemWidth); static byte[][] readList(InputStream input, int listWidth, int elemWidth); static byte[] readVariableBytes(InputStream input, int width); static byte[] readFixedBytes(InputStream input, int length); static int readNumber(InputStream input, int width); static long readLong(InputStream input, int width); static byte readByte(InputStream input); static void writeVariableBytes(OutputStream output, byte[] data, int width); static void writeFixedBytes(OutputStream output, byte[] data); static void writeNumber(OutputStream output, long value, int width);  }