org.jasn
Class DerDecoder

java.lang.Object
  extended byorg.jasn.BerDecoder
      extended byorg.jasn.DerDecoder
All Implemented Interfaces:
Asn1Decoder

public class DerDecoder
extends BerDecoder

A decoder for parsing DER encoded ASN.1 value from an input stream.

Author:
Nicolas Vraux
To do:
implements decodeUTF8 with its own decoding method, implements decodeGeneralizedTime

Constructor Summary
DerDecoder(InputStream in)
          Creates a decoder for parsing BER encoded ASN.1 values from the specified input stream.
DerDecoder(InputStream in, int bufSize)
          Creates a decoder for parsing BER encoded ASN.1 values from the specified input stream.
 
Method Summary
 BitString decodeBitString(BitString set)
          Decodes an ASN.1 BIT STRING value from the underlying stream and appends its bit values to the specified BitString.
 boolean decodeBoolean()
          Decodes an ASN.1 BOOLEAN value from the underlying stream and returns it as a boolean value.
 
Methods inherited from class org.jasn.BerDecoder
decodeAny, decodeAny, decodeBitString, decodeBMPString, decodeBMPString, decodeChoice, decodeConstructed, decodeEndOf, decodeEnumerated, decodeEnumeratedAsInt, decodeEnumeratedAsLong, decodeExplicit, decodeGeneralizedTime, decodeIA5String, decodeIA5String, decodeImplicit, decodeInteger, decodeIntegerAsInt, decodeIntegerAsLong, decodeNull, decodeNumericString, decodeNumericString, decodeObjectIdentifier, decodeOctetString, decodeOctetString, decodePrintableString, decodePrintableString, decodeSequence, decodeSequenceOf, decodeSet, decodeSetOf, decodeString, decodeTeletexString, decodeTeletexString, decodeUTCTime, decodeUTF8String, decodeUTF8String, decodeVisibleString, decodeVisibleString, endOf, isNextConstructed, isNextTag, matchTag, setInputStream, skipNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerDecoder

public DerDecoder(InputStream in,
                  int bufSize)
Creates a decoder for parsing BER encoded ASN.1 values from the specified input stream. An internal buffer array of length bufSize will be used for decoding.

Parameters:
in - the underlying input stream.

DerDecoder

public DerDecoder(InputStream in)
Creates a decoder for parsing BER encoded ASN.1 values from the specified input stream.

Parameters:
in - the underlying input stream.
Method Detail

decodeBoolean

public boolean decodeBoolean()
                      throws IOException
Decodes an ASN.1 BOOLEAN value from the underlying stream and returns it as a boolean value.

Specified by:
decodeBoolean in interface Asn1Decoder
Overrides:
decodeBoolean in class BerDecoder
Returns:
the decoded boolean value.
Throws:
IOException - if an I/O error occurs.
DecodingException - if the bytes read do not represent a valid BER encoded BOOLEAN value.

decodeBitString

public BitString decodeBitString(BitString set)
                          throws IOException
Decodes an ASN.1 BIT STRING value from the underlying stream and appends its bit values to the specified BitString. The first bit of the decode BIT STRING value corresponds to the bit at index set.length() + 1 of the BitString.

The total number of bit contained in the decoded BIT STRING may be retrieved by invoking the length method of the returned BitString.

Specified by:
decodeBitString in interface Asn1Decoder
Overrides:
decodeBitString in class BerDecoder
Parameters:
set - the BitString to which the decoded bits are appended.
Returns:
a BitString instance representing the content of the decoded BIT STRING.
Throws:
IOException - if an I/O error occurs.
DecodingException - if the bytes read do not represent a valid BER encoded BIT STRING value.


Copyright © 2004 Nicolas Vraux. All Rights Reserved.