Note that, like BER/1, DER streams are streams of explicitly tagged data values. Accordingly, this programming interface does not expose any variant of the java.io.InputStream interface, since that kind of input stream holds untagged data values and using that I/O model could prevent correct parsing of the DER data.
At this time, this class supports only a subset of the types of DER data encodings which are defined. That subset is sufficient for parsing most X.509 certificates.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean | |
| pack-priv final byte[] | |
| pack-priv final int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| public | DerInputStream(byte[] data, int start, int length, boolean allowBER)
Constructs a DerInputStream by assigning all its fields. |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | |
| private boolean | Returns: true if matches, false if not or stream is at end.the rule to check for the tag. rule)Checks if the tag of the next DerValue matches the rule. |
| private boolean | Returns: true if matches, false if not or stream is at end.the expected tag tag)Detect if the tag of the next DerValue is the specified one. |
| public BigInteger | |
| public byte[] | |
| public String | |
| pack-priv static int | |
| public DerValue | |
| public int | |
| public Date | |
| public String | |
| public String | |
| public int | |
| pack-priv static int | Returns: the length or -1 if indefinite length found.Get a length from the input stream, allowing for at most 32 bits of encoding to be used. |
| public void | |
| public byte[] | |
| public ObjectIdentifier | |
| public Optional | Returns: the next DerValue, or empty if not found or stream at endthe expected tag tag)Returns the next DerValue if its tag is the given one. |
| public Optional | Returns: the inner DerValue, or empty if not found or stream at endthe expected tag n)Returns the inner DerValue if the next DerValue is
an EXPLICIT context-specific value tagged by |
| public Optional | Returns: the restored DerValue, or empty if not found or stream at endthe expected tag n, byte the real tag for the IMPLICIT type tag)Returns the restored DerValue if the next DerValue is
an IMPLICIT context-specific value tagged by |
| public BigInteger | |
| public String | |
| public DerValue[] | |
| public DerValue[] | |
| public DerValue[] | |
| public String | |
| public Date | |
| public BitArray | |
| public Date | |
| public String | |
| public void | mark(int readAheadLimit)
Mark the current position in the buffer, so that
a later call to |
| public int | |
| public void | |
| public boolean | Returns: true if matches, false if not or stream is at end.the expected tag n)Detect if the next DerValue is a context-specific value
tagged by |
| public byte[] |
| allowBER | back to summary |
|---|---|
| pack-priv final boolean allowBER | |
| data | back to summary |
|---|---|
| pack-priv final byte[] data | |
| end | back to summary |
|---|---|
| pack-priv final int end | |
| mark | back to summary |
|---|---|
| pack-priv int mark | |
| pos | back to summary |
|---|---|
| pack-priv int pos | |
| start | back to summary |
|---|---|
| pack-priv final int start | |
| DerInputStream | back to summary |
|---|---|
| public DerInputStream(byte[] data, int start, int length, boolean allowBER) Constructs a DerInputStream by assigning all its fields.
No checking on arguments since all callers are internal.
| |
| DerInputStream | back to summary |
|---|---|
| public DerInputStream(byte[] data) throws IOException | |
| DerInputStream | back to summary |
|---|---|
| public DerInputStream(byte[] data, int offset, int len) throws IOException | |
| atEnd | back to summary |
|---|---|
| public void atEnd() throws IOException Ensures there is no more data. This can be called when the last expected field is parsed, and we need to make sure no unread is left.
| |
| available | back to summary |
|---|---|
| public int available() Returns the number of bytes available for reading. This is most useful for testing whether the stream is empty. | |
| checkNextTag | back to summary |
|---|---|
| private boolean checkNextTag(Predicate<Byte> rule) Checks if the tag of the next DerValue matches the rule. | |
| checkNextTag | back to summary |
|---|---|
| private boolean checkNextTag(byte tag) Detect if the tag of the next DerValue is the specified one.
| |
| getBigInteger | back to summary |
|---|---|
| public BigInteger getBigInteger() throws IOException | |
| getBitString | back to summary |
|---|---|
| public byte[] getBitString() throws IOException | |
| getBMPString | back to summary |
|---|---|
| public String getBMPString() throws IOException | |
| getDefiniteLength | back to summary |
|---|---|
| pack-priv static int getDefiniteLength(InputStream in) throws IOException | |
| getDerValue | back to summary |
|---|---|
| public DerValue getDerValue() throws IOException Reads a DerValue from this stream. After the call, the data pointer is right after this DerValue so that the next call will read the next DerValue.
| |
| getEnumerated | back to summary |
|---|---|
| public int getEnumerated() throws IOException | |
| getGeneralizedTime | back to summary |
|---|---|
| public Date getGeneralizedTime() throws IOException | |
| getGeneralString | back to summary |
|---|---|
| public String getGeneralString() throws IOException | |
| getIA5String | back to summary |
|---|---|
| public String getIA5String() throws IOException | |
| getInteger | back to summary |
|---|---|
| public int getInteger() throws IOException | |
| getLength | back to summary |
|---|---|
| pack-priv static int getLength(InputStream in) throws IOException Get a length from the input stream, allowing for at most 32 bits of encoding to be used. (Not the same as getting a tagged integer!)
| |
| getNull | back to summary |
|---|---|
| public void getNull() throws IOException | |
| getOctetString | back to summary |
|---|---|
| public byte[] getOctetString() throws IOException | |
| getOID | back to summary |
|---|---|
| public ObjectIdentifier getOID() throws IOException | |
| getOptional | back to summary |
|---|---|
| public Optional Returns the next DerValue if its tag is the given one.
| |
| getOptionalExplicitContextSpecific | back to summary |
|---|---|
| public Optional Returns the inner DerValue if the next DerValue is
an EXPLICIT context-specific value tagged by
| |
| getOptionalImplicitContextSpecific | back to summary |
|---|---|
| public Optional Returns the restored DerValue if the next DerValue is
an IMPLICIT context-specific value tagged by
| |
| getPositiveBigInteger | back to summary |
|---|---|
| public BigInteger getPositiveBigInteger() throws IOException | |
| getPrintableString | back to summary |
|---|---|
| public String getPrintableString() throws IOException | |
| getSequence | back to summary |
|---|---|
| public DerValue[] getSequence(int startLen) throws IOException | |
| getSet | back to summary |
|---|---|
| public DerValue[] getSet(int startLen) throws IOException | |
| getSet | back to summary |
|---|---|
| public DerValue[] getSet(int startLen, boolean implicit) throws IOException | |
| getT61String | back to summary |
|---|---|
| public String getT61String() throws IOException | |
| getTime | back to summary |
|---|---|
| public Date getTime() throws IOException | |
| getUnalignedBitString | back to summary |
|---|---|
| public BitArray getUnalignedBitString() throws IOException | |
| getUTCTime | back to summary |
|---|---|
| public Date getUTCTime() throws IOException | |
| getUTF8String | back to summary |
|---|---|
| public String getUTF8String() throws IOException | |
| mark | back to summary |
|---|---|
| public void mark(int readAheadLimit) Mark the current position in the buffer, so that
a later call to | |
| peekByte | back to summary |
|---|---|
| public int peekByte() throws IOException | |
| reset | back to summary |
|---|---|
| public void reset() Return to the position of the last | |
| seeOptionalContextSpecific | back to summary |
|---|---|
| public boolean seeOptionalContextSpecific(int n) throws IOException Detect if the next DerValue is a context-specific value
tagged by
| |
| toByteArray | back to summary |
|---|---|
| public byte[] toByteArray() Returns the remaining unread bytes, or, all bytes if none read yet. | |