Asn1BerEncodeBuffer Class Reference

Inheritance diagram for Asn1BerEncodeBuffer:
Asn1DerEncodeBuffer

List of all members.

Public Member Functions

 Asn1BerEncodeBuffer (int sizeIncrement)
 Asn1BerEncodeBuffer ()
virtual void BinDump ()
override void BinDump (System.IO.StreamWriter outs, System.String varName)
virtual int EncodeIdentifier (int ident)
virtual int EncodeIntValue (long ivalue)
virtual int EncodeLength (int len)
virtual int EncodeTag (Asn1Tag tag)
virtual int EncodeTagAndLength (short tagClass, short tagForm, int tagIDCode, int len)
virtual int EncodeTagAndLength (Asn1Tag tag, int len)
virtual int EncodeUnsignedBinaryNumber (long ivalue)
virtual int TrimBitString (Asn1BitString bitstr)

Protected Member Functions

internal override void CheckSize (int bytesRequired)

Detailed Description

This class handles the encoding of ASN.1 messages as specified in the Basic Encoding Rules (BER) as specified in the ITU-T X.690 standard. A reference to an object of this type is passed to each of the ASN.1 type encode methods involved in encoding a particular message type.


Constructor & Destructor Documentation

This constructor creates a BER encode buffer object with the default size increment. Whenever the buffer becomes full, the buffer will be expanded by the sizeIncrement size.

Asn1BerEncodeBuffer ( int  sizeIncrement  ) 

This constructor creates a BER encode buffer object with the given size increment. Whenever the buffer becomes full, the buffer will be expanded by the sizeIncrement size. This size should be large enough to prevent resizing in normal operation.

Parameters:
sizeIncrement The initial size in bytes of an encode buffer. If the buffer becomes full, it will be expanded by the amount.

Member Function Documentation

virtual void BinDump (  )  [virtual]

This method invokes an overloaded version of BinDump to dump the encoded message to standard output.

override void BinDump ( System.IO.StreamWriter  outs,
System.String  varName 
) [virtual]

This method dumps the encoded message in a human-readable format showing tags and contents to the given output stream.

Parameters:
outs StreamWriter where dump will be printed
varName Name of the Decoded ASN1 Type

Implements Asn1EncodeBuffer.

internal override void CheckSize ( int  bytesRequired  )  [protected]

This method determines if the encode buffer can hold the requested number of bytes. If not, the buffer is expanded.

Parameters:
bytesRequired Number of required bytes.
virtual int EncodeIdentifier ( int  ident  )  [virtual]

This method encodes an ASN.1 identifier value such as the ones used in a tags or object identifiers.

Parameters:
ident The identifier to be encoded.
Returns:
Length of the encoded component in octets.
virtual int EncodeIntValue ( long  ivalue  )  [virtual]

This method encodes an ASN.1 integer value's contents according to the ASN.1 Basic Encoding Rules (BER)..

Parameters:
ivalue Integer value to encode
Returns:
Length of encoded component
virtual int EncodeLength ( int  len  )  [virtual]

This method encodes a length value.

Parameters:
len The length to be encoded.
Returns:
Length of encoded component
virtual int EncodeTag ( Asn1Tag  tag  )  [virtual]

This method encodes a tag value.

Parameters:
tag The tag to be encoded.
Returns:
Length of component or negative status value
virtual int EncodeTagAndLength ( short  tagClass,
short  tagForm,
int  tagIDCode,
int  len 
) [virtual]

This overloaded version of encodeTagAndLength allows tag value components to be specified instead of an Asn1Tag object

Parameters:
tagClass The class of the tag to be encoded.
tagForm The form of the tag to be encoded.
tagIDCode The ID code of the tag to be encoded.
len The length to be encoded.
Returns:
status value (see Asn1Status.java)
virtual int EncodeTagAndLength ( Asn1Tag  tag,
int  len 
) [virtual]

This method encodes both a tag and length value.

Parameters:
tag The tag to be encoded.
len The length to be encoded.
Returns:
Length of encoded component
virtual int EncodeUnsignedBinaryNumber ( long  ivalue  )  [virtual]

This method encodes an integer value as unsigned binary number according to the ASN.1 Basic Encoding Rules (BER)..

Parameters:
ivalue Integer value to encode
Returns:
Length of encoded component
virtual int TrimBitString ( Asn1BitString  bitstr  )  [virtual]

This method will trim a BIT STRING for DER encoding by removing all zero trailing bits. The default implementation in Asn1BerEncodeBuffer does nothing. The overriden version in Asn1DerEncodeBuffer will trim the string.

<param name="bitstr> ASN.1 BIT STRING object <return> Adjusted bit count </return>

Reimplemented in Asn1DerEncodeBuffer.