public class DERParser
extends java.io.FilterInputStream
Modifier and Type | Field and Description |
---|---|
private byte[] |
lenBytes |
static int |
MAX_DER_VALUE_LENGTH
Maximum size of data allowed by
readLength() - it is a bit
arbitrary since one can encode 32-bit length data, but it is good
enough for the keys |
Constructor and Description |
---|
DERParser(byte... bytes) |
DERParser(byte[] bytes,
int offset,
int len) |
DERParser(java.io.InputStream s) |
Modifier and Type | Method and Description |
---|---|
java.math.BigInteger |
readBigInteger() |
int |
readLength()
Decode the length of the field.
|
ASN1Object |
readObject() |
public static final int MAX_DER_VALUE_LENGTH
readLength()
- it is a bit
arbitrary since one can encode 32-bit length data, but it is good
enough for the keysprivate final byte[] lenBytes
public DERParser(byte... bytes)
public DERParser(byte[] bytes, int offset, int len)
public DERParser(java.io.InputStream s)
public int readLength() throws java.io.IOException
Short form - One octet. Bit 8 has value "0" and bits 7-1 give the length.
Long form - Two to 127 octets (only 4 is supported here). Bit 8 of first octet has value "1" and bits 7-1 give the number of additional length octets. Second and following octets give the length, base 256, most significant digit first.
java.io.IOException
- If invalid format foundpublic ASN1Object readObject() throws java.io.IOException
java.io.IOException
public java.math.BigInteger readBigInteger() throws java.io.IOException
java.io.IOException