org.mozilla.jss.asn1
public class ASN1Header extends Object
Field Summary | |
---|---|
static Form | CONSTRUCTED |
static Form | PRIMITIVE |
Constructor Summary | |
---|---|
ASN1Header(InputStream istream)
Gets info about the next item in the DER stream, consuming the
identifier and length octets. | |
ASN1Header(Tag tag, Form form, long contentLength)
This constructor is to be called when we are constructing an ASN1Value
rather than decoding it. |
Method Summary | |
---|---|
void | encode(OutputStream ostream) |
byte[] | encode() |
long | getContentLength()
Returns -1 for indefinite length encoding. |
Form | getForm()
Returns the Form, PRIMITIVE or CONSTRUCTED. |
Tag | getTag() |
long | getTotalLength()
Returns the length of the header plus the length of the contents;
the total length of the DER encoding of an ASN1 value. |
boolean | isEOC()
Returns true if this is a BER end-of-contents marker. |
static ASN1Header | lookAhead(InputStream derStream)
Returns information about the next item in the stream, but does not
consume any octets. |
static byte[] | unsignedBigIntToByteArray(BigInteger bi)
Converts an unsigned BigInteger to a minimal-length byte array.
|
void | validate(Tag expectedTag, Form expectedForm)
Verifies that this header has the given tag and form. |
void | validate(Tag expectedTag)
Verifies that this head has the given tag. |
Parameters: contentLength Must be >=0. Although indefinite length decoding is supported, indefinite length encoding is not.
true
if this is a BER end-of-contents marker.Throws: IOException If the input stream does not support look ahead.
Throws: InvalidBERException If the header's tag or form differ from those passed in.
Throws: InvalidBERException If the header's tag differs from that passed in.