org.metastatic.jessie.pki.der
Class DERReader
java.lang.Objectorg.metastatic.jessie.pki.der.DERReader
- DER
public class DERReader
extends java.lang.Object
This class decodes DER sequences into Java objects. The methods of
this class do not have knowledge of higher-levels of structure in the
DER stream -- such as ASN.1 constructions -- and it is therefore up
to the calling application to determine if the data are structured
properly by inspecting the
DERValue that is returned.
- Casey Marshall (rsdio@metastatic.org)
protected ByteArrayOutputStream | encBuf
|
protected InputStream | in
|
ANY, APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CONSTRUCTED, CONSTRUCTED_VALUE, CONTEXT, ENUMERATED, GENERALIZED_TIME, GENERAL_STRING, GRAPHIC_STRING, IA5_STRING, INTEGER, ISO646_STRING, NULL, NUMERIC_STRING, OBJECT_IDENTIFIER, OCTET_STRING, PRE_ENCODED, PRINTABLE_STRING, PRIVATE, REAL, RELATIVE_OID, SEQUENCE, SET, T61_STRING, UNIVERSAL, UNIVERSAL_STRING, UTC_TIME, UTF8_STRING, VIDEOTEX_STRING |
DERReader(InputStream in)- Create a new DER readed from an input stream.
|
DERReader(byte[] in)- Create a new DER reader from a byte array.
|
DERValue | read()- Decode a single value from the input stream, returning it in a new
DERValue.
|
static DERValue | read(byte[] encoded)- Convenience method for reading a single primitive value from the
given byte array.
|
void | skip(int len)
|
encBuf
protected final ByteArrayOutputStream encBuf
in
protected InputStream in
DERReader
public DERReader(InputStream in)
Create a new DER readed from an input stream.
DERReader
public DERReader(byte[] in)
Create a new DER reader from a byte array.
read
public DERValue read()
throws IOException Decode a single value from the input stream, returning it in a new
DERValue. By "single value" we mean any single type in its
entirety -- including constructed types such as SEQUENCE and all
the values they contain. Usually it is sufficient to call this
method once to parse and return the top-level structure, then to
inspect the returned value for the proper contents.
- The parsed DER structure.
read
public static DERValue read(byte[] encoded)
throws IOException Convenience method for reading a single primitive value from the
given byte array.
encoded - The encoded bytes.
skip
public void skip(int len)
throws IOException