codec.asn1
Class BERDecoder
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--codec.asn1.DERDecoder
|
+--codec.asn1.BERDecoder
- All Implemented Interfaces:
- Decoder
- public class BERDecoder
- extends DERDecoder
Decodes ASN.1/DER encoded types according to the rules set forth in ITU-T
Recommendation X.690.
Decoders can be operated in two modi. The first mode just reads any ASN.1
type encountered in a stream and returns the instantiated objects. This mode
is used if for instance method readType() is called.
The second mode matches the decoded data against an application-specified
ASN.1 structure. Violations of the structure definition causes an exception
being thrown.
- Version:
- "$Id: BERDecoder.java,v 1.3 2001/01/08 18:47:37 vroth Exp $"
- Author:
- Volker Roth
| Fields inherited from class codec.asn1.DERDecoder |
debug_, indefinite_, length_, limit_, markpos_, oidbuf_, pos_, primitive_, skip_, tag_, tagclass_ |
|
Constructor Summary |
BERDecoder(InputStream in)
Creates an instance that reads from the given input stream. |
| Methods inherited from class codec.asn1.DERDecoder |
available, close, getClass, getInputLimit, isDebug, mark, markSupported, match0, match1, match2, read, read, read, readBase128, readBase256, readBoolean, readChoice, readInteger, readNext, readNull, readObjectIdentifier, readReal, readTime, readType, readType, reset, setDebug, setInputLimit, skip, skipNext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BERDecoder
public BERDecoder(InputStream in)
- Creates an instance that reads from the given input stream.
- Parameters:
in - The input stream to read from.
readTypes
protected void readTypes(ASN1Collection c)
throws ASN1Exception,
IOException
- Reads in a sequence of ASN.1 types and stores them in the given
collection. This method overrides a method in the parent class in order
to handle indefinite length encodings as required by BER. Indefinite
length encodings are detected by checking the
indefinite_ field in this instance. This field is
initialized by method readNext() when the
identifier and length octets of the next ASN.1 type in the stream are
parsed.
- Overrides:
readTypes in class DERDecoder
- Parameters:
c - The ASN.1 collection in which decoded types are stored.- Throws:
ASN1Exception - if a decoding error occurs.IOException - if guess what...
readBitString
public void readBitString(ASN1BitString t)
throws ASN1Exception,
IOException
- Overrides:
readBitString in class DERDecoder
readOctetString
public void readOctetString(ASN1OctetString t)
throws ASN1Exception,
IOException
- Overrides:
readOctetString in class DERDecoder
readString
public void readString(ASN1String t)
throws ASN1Exception,
IOException
- Overrides:
readString in class DERDecoder
readCollection
public void readCollection(ASN1Collection t)
throws ASN1Exception,
IOException
- Overrides:
readCollection in class DERDecoder
readCollectionOf
public void readCollectionOf(ASN1CollectionOf t)
throws ASN1Exception,
IOException
- Overrides:
readCollectionOf in class DERDecoder
readTaggedType
public void readTaggedType(ASN1TaggedType t)
throws ASN1Exception,
IOException
- Description copied from class:
DERDecoder
- This method also reads in
ASN1Opaque types. Opaque
types take on the tag and tag class of the decoded type and read in the
contents octets into an OCTET STRING. The opaque type can seamlessly be
encoded back into the original encoding. No traversal of the inner
structure of the encoded type is required.
- Overrides:
readTaggedType in class DERDecoder
- Following copied from class:
codec.asn1.DERDecoder
- Parameters:
t - The ASN1TaggedType or
ASN1Opaque to decode.
Copyright © Fraunhofer Gesellschaft. All Rights Reserved.