Asn1BerDecodeBuffer Class Reference

Inheritance diagram for Asn1BerDecodeBuffer:
Asn1DecodeBuffer Asn1MessageBuffer Asn1MessageBufferBase Asn1BerInputStream Asn1DerDecodeBuffer Asn1CerInputStream Asn1DerInputStream

List of all members.

Public Member Functions

 Asn1BerDecodeBuffer (System.IO.Stream istream)
 Asn1BerDecodeBuffer (byte[] msgdata)
int DecodeEnumValue (Asn1Tag tag, bool explicitTagging, int implicitLength)
int DecodeEnumValue (bool explicitTagging, int implicitLength)
virtual int DecodeLength ()
virtual byte[] DecodeOpenType (bool saveData)
virtual byte[] DecodeOpenType ()
virtual void DecodeTag (Asn1Tag tag)
virtual int DecodeTagAndLength (Asn1Tag tag)
virtual bool MatchTag (Asn1Tag tag)
virtual bool MatchTag (Asn1Tag tag, Asn1Tag parsedTag, IntHolder parsedLen)
virtual bool MatchTag (short tagClass, short tagForm, int tagIDCode, Asn1Tag parsedTag, IntHolder parsedLen)
virtual void Parse (Asn1TaggedEventHandler handler)
virtual Asn1Tag PeekTag ()
virtual void PeekTag (Asn1Tag parsedTag)
override int ReadByte ()

Static Public Member Functions

static int CalcIndefLen (byte[] data, int offset, int len)

Protected Member Functions

internal void MovePastEOC (bool saveData)

Properties

virtual Asn1Tag LastTag [get]

Detailed Description

This class handles the decoding of ASN.1 messages as specified in the Basic Encoding Rules (BER) as documented in the ITU-T X.690 standard.


Constructor & Destructor Documentation

Asn1BerDecodeBuffer ( byte[]  msgdata  ) 

This constructor creates a BER Decode buffer object that references an encoded ASN.1 message.

Parameters:
msgdata Byte array containing an encoded ASN.1 message.
Asn1BerDecodeBuffer ( System.IO.Stream  istream  ) 

This constructor creates a BER Decode buffer object that references an encoded ASN.1 message. In this case, the message is passed in using an System.IO.Stream object.

Parameters:
istream Input stream containing an encoded ASN.1 message.

Member Function Documentation

static int CalcIndefLen ( byte[]  data,
int  offset,
int  len 
) [static]

This function calculates the actual length of an indefinite length message component.

Parameters:
data Buffer with the indefinite length message component.
offset The start offset in the array
len Length of the buffer (begining from the offset)
Returns:
calculated length
int DecodeEnumValue ( Asn1Tag  tag,
bool  explicitTagging,
int  implicitLength 
)

This method decodes an enumerated value from the buffer.

Parameters:
tag An Asn1Tag value for enumerated values that are tagged other than UNIVERSAL 10.
explicitTagging A flag that indicates the element is explicitly tagged.
implicitLength The length of the contents if implicitly tagged.
Returns:
The decoded integer value.
int DecodeEnumValue ( bool  explicitTagging,
int  implicitLength 
)

This method decodes an enumerated value from the buffer.

Parameters:
explicitTagging A flag that indicates the element is explicitly tagged.
implicitLength The length of the contents if implicitly tagged.
Returns:
The decoded integer value.
virtual int DecodeLength (  )  [virtual]

This method decodes a length value.

Returns:
Decoded length value
virtual byte [] DecodeOpenType ( bool  saveData  )  [virtual]

This method decodes an ASN.1 BER open type value. This is a fully encoded message component of any type. This version of the method allows the option of saving or discarding the open type data.

Parameters:
saveData True if data should be captured and returned
Returns:
Reference to byte array containing component.
virtual byte [] DecodeOpenType (  )  [virtual]

This method decodes an ASN.1 BER open type value. This is a fully encoded message component of any type. The component is captured in the Decode capture buffer and a reference to a byte array is returned containing the component.

Returns:
Reference to byte array containing component.
virtual void DecodeTag ( Asn1Tag  tag  )  [virtual]

This method decodes a tag value.

Parameters:
tag Tag object to receive decoded tag fields.
Returns:
status value (see Asn1Status.java)
virtual int DecodeTagAndLength ( Asn1Tag  tag  )  [virtual]

This method decodes a tag and length value.

Parameters:
tag Tag object to receive decoded tag fields.
Returns:
Decoded length value.
virtual bool MatchTag ( Asn1Tag  tag  )  [virtual]

This overloaded version of MatchTag will just test for a match and not return parsed tag and length values

Parameters:
tag Tag value to be matched.
Returns:
True if given tag matches tag at Decode cursor
virtual bool MatchTag ( Asn1Tag  tag,
Asn1Tag  parsedTag,
IntHolder  parsedLen 
) [virtual]

This overloaded version of MatchTag allows the tag value to be matched to be passed using an Asn1Tag object.

Parameters:
tag Tag value to be matched.
parsedTag Holder object to receive parsed tag value
parsedLen Holder object to receive parsed length value
Returns:
True if given tag matches tag at Decode cursor
virtual bool MatchTag ( short  tagClass,
short  tagForm,
int  tagIDCode,
Asn1Tag  parsedTag,
IntHolder  parsedLen 
) [virtual]

This method decodes the next tag value and checks for a match with the given tag value. If the match is successful, the Decode cursor will be psoitioned at the contents field; otherwise, it will be reset to point to the start of the tag field.

Parameters:
tagClass Class value of tag to match
tagForm Form value of tag to match
tagIDCode ID code of tag to match
parsedTag Holder object to receive parsed tag value
parsedLen Holder object to receive parsed length value
Returns:
True if given tag matches tag at Decode cursor
internal void MovePastEOC ( bool  saveData  )  [protected]

This method skips or saves the data/bytes of the current tag in this DecodeBuffer. If current tag has indefinite length, than index will moved to end of the indifinite length. If tag has definite length, than that many bytes are moved.

Parameters:
saveData True if data should be captured
virtual void Parse ( Asn1TaggedEventHandler  handler  )  [virtual]

This method parses the complete message and invokes the event handler callback methods as various items are encountered.

Parameters:
handler Object implementing the Asn1EventHandler interface.
Returns:
Status value
virtual Asn1Tag PeekTag (  )  [virtual]

This overloaded version of the PeekTag method will return a reference to a newly created tag object.

Returns:
Parsed tag object value reference
virtual void PeekTag ( Asn1Tag  parsedTag  )  [virtual]

This method will Parse and return the next tag in the Decode stream without advancing the Decode cursor.

Parameters:
parsedTag Holder object to receive parsed tag value
override int ReadByte (  )  [virtual]

This method returns the next available 8-bit value from the input stream. It is implemented differently for BER/DER and PER to take into account odd alignments in PER.

Returns:
Next 8-bit byte value from input stream

Implements Asn1DecodeBuffer.


Property Documentation

virtual Asn1Tag LastTag [get]

Gets the last tag parsed within this decode buffer object.

Value: Last parsed tag object reference