public class ASN1Header extends java.lang.Object implements Streamable, ASN1
Represents the header (tag, encoding method, and length) of an ASN.1 object encoding.
APPLICATION, BIT_STRING, BMP_STRING, BOOLEAN, CONSTRUCTED, CONSTRUCTED_DEFINITE, CONSTRUCTED_INDEFINITE, CONTEXT_SPECIFIC, END_OF_CONTENTS, ENUMERATED, EXTERNAL, GENERAL_STRING, GENERALIZED_TIME, GRAPHIC_STRING, IA5STRING, INTEGER, ISO646_STRING, NULL, NUMERIC_STRING, OBJECT_DESCRIPTOR, OBJECT_IDENTIFIER, OCTET_STRING, PRIMITIVE, PRINTABLE_STRING, PRIVATE, REAL, SEQUENCE, SET, T61STRING, TAG, TAG_CLASS, TELETEX_STRING, UNIVERSAL, UNIVERSAL_STRING, UTCTIME, UTF8_STRING, VIDEOTEX_STRING, VISIBLE_STRING| Constructor and Description |
|---|
ASN1Header()
Creates an uninitialized ASN.1 header.
|
ASN1Header(java.io.InputStream is) |
ASN1Header(int t, int c)
Creates an ASN1 Header of the specified tag and tag class.
|
ASN1Header(int t, int c, int m, int l)
Creates an ASN1 Header of the specified tag, tag class, encoding method, and length.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkEncodingMethod(int encodingMethod) |
void |
checkTag(int tag) |
void |
checkTagClass(int tagClass) |
java.lang.String |
encodingMethodToString(int encodingMethod) |
int |
getBodyLength()
Returns the length of the body of this ASN.1 object.
|
int |
getEncodingMethod() |
int |
getTag() |
int |
getTagClass() |
byte[] |
headerAndBody(java.io.InputStream is) |
void |
input(java.io.InputStream is)
Reads this header from the specified input stream.
|
int |
length()
Returns the length of the DER encoding of this ASN.1 header.
|
void |
output(java.io.OutputStream os)
Writes this header to the specified output stream.
|
byte[] |
readBody(java.io.InputStream is)
Reads in the body from the specified input stream and returns it as a byte array.
|
void |
skipBody(java.io.InputStream is) |
java.lang.String |
tagClassToString(int tagClass) |
java.lang.String |
tagToString(int tag) |
java.lang.String |
toString() |
int |
totalLength()
Returns the total length of the ASN.1 object corresponding to this header.
|
public ASN1Header()
public ASN1Header(int t,
int c)
t - The universal-class tag for this type (e.g., ASN1.IA5STRING)c - The tag class (e.g., ASN1.UNIVERSAL).
public ASN1Header(int t,
int c,
int m,
int l)
t - The universal-class tag for this type (e.g., ASN1.IA5STRING)c - The tag class (e.g., ASN1.UNIVERSAL).m - The encoding method.l - The body length.
public ASN1Header(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic int getTag()
public int getTagClass()
public int getEncodingMethod()
public int getBodyLength()
-1 is returned.public int length()
length in interface Streamablepublic int totalLength()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String tagClassToString(int tagClass)
public java.lang.String tagToString(int tag)
public java.lang.String encodingMethodToString(int encodingMethod)
public void checkTagClass(int tagClass)
throws ASN1FormatException
ASN1FormatException
public void checkTag(int tag)
throws ASN1FormatException
ASN1FormatException
public void checkEncodingMethod(int encodingMethod)
throws ASN1FormatException
ASN1FormatException
public void output(java.io.OutputStream os)
throws java.io.IOException
output in interface Streamablejava.io.IOException
public void input(java.io.InputStream is)
throws java.io.IOException
input in interface Streamablejava.io.IOException
public void skipBody(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
public byte[] readBody(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
public byte[] headerAndBody(java.io.InputStream is)
throws java.io.IOException
java.io.IOException