/** * Read next object. If it's constructed, the value holds * encoded content and it should be parsed by a new * parser from <code>Asn1Object.getParser</code>. * * @return A object * @throws IOException */ public Asn1Object read() throws IOException { int tag = in.read(); if (tag == -1) throw new IOException("Invalid DER: stream too short, missing tag"); //$NON-NLS-1$ int length = getLength(); byte[] value = new byte[length]; int n = in.read(value); if (n < length) throw new IOException("Invalid DER: stream too short, missing value"); //$NON-NLS-1$ Asn1Object o = new Asn1Object(tag, length, value); return o; }