Asn1CerOutputStream Class Reference

Inheritance diagram for Asn1CerOutputStream:
Asn1BerOutputStream Asn1OutputStream

List of all members.

Public Member Functions

 Asn1CerOutputStream (System.IO.Stream os, int bufSize)
 Asn1CerOutputStream (System.IO.Stream os)
override void Encode (Asn1Type type, bool explicitTagging)
override void EncodeBitString (byte[] value, int numbits, bool explicitTagging, Asn1Tag tag)
override void EncodeBMPString (System.String value, bool explicitTagging, Asn1Tag tag)
override void EncodeCharString (System.String value, bool explicitTagging, Asn1Tag tag)
override void EncodeOctetString (byte[] value, bool explicitTagging, Asn1Tag tag)
virtual void EncodeStringTag (int nbytes, short tagClass, short tagForm, int tagIDCode)
virtual void EncodeStringTag (int nbytes, Asn1Tag tag)
override void EncodeUnivString (int[] value, bool explicitTagging, Asn1Tag tag)

Detailed Description

This class implements the output stream to encode ASN.1 messages as specified in the Canonical Encoding Rules (CER) 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

Asn1CerOutputStream ( System.IO.Stream  os  ) 

This constructor creates a buffered CER output stream object with default size of buffer. Whenever the buffer becomes full, the buffer will be flushed to the stream.

Parameters:
os The underlying System.IO.Stream object.
Asn1CerOutputStream ( System.IO.Stream  os,
int  bufSize 
)

This constructor creates a buffered CER output stream object. Whenever the buffer becomes full, the buffer will be flushed to the stream.

Parameters:
os The underlying System.IO.Stream object.
bufSize The buffer size. If it is 0 then the output stream is used as unbuffered one.

Member Function Documentation

override void Encode ( Asn1Type  type,
bool  explicitTagging 
) [virtual]

This method encodes and writes to the stream ASN.1 types. The UNIVERSAL tag value and length is also encoded if explicit tagging is specified (the universal identifier must be provided by the caller).

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
type The object to be written
explicitTagging Flag indicating explicit tagging should be done

Reimplemented from Asn1BerOutputStream.

override void EncodeBitString ( byte[]  value,
int  numbits,
bool  explicitTagging,
Asn1Tag  tag 
) [virtual]

This method writes the given array of bytes as bit string value.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
value Byte array containing data to encode.
numbits Number of bits to encode
explicitTagging Flag indicating explicit tagging should be done
tag Universal tag to apply
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

override void EncodeBMPString ( System.String  value,
bool  explicitTagging,
Asn1Tag  tag 
) [virtual]

This method writes the given string as BMP string value.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
value String containing data to encode.
explicitTagging Flag indicating explicit tagging should be done
tag Universal tag to apply
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

override void EncodeCharString ( System.String  value,
bool  explicitTagging,
Asn1Tag  tag 
) [virtual]

This method encodes and writes to the stream an ASN.1 8-bit character string types including IA5String, PrintableString, NumericString, etc. The UNIVERSAL tag value and length is also encoded if explicit tagging is specified (the universal identifier must be provided by the caller).

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
value The string object to be written
explicitTagging Flag indicating explicit tagging should be done
tag Universal tag to apply
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

override void EncodeOctetString ( byte[]  value,
bool  explicitTagging,
Asn1Tag  tag 
) [virtual]

This method writes the given array of bytes as octet string value.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
value Byte array containing data to encode.
explicitTagging Flag indicating explicit tagging should be done
tag Universal tag to apply
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

virtual void EncodeStringTag ( int  nbytes,
short  tagClass,
short  tagForm,
int  tagIDCode 
) [virtual]

This method encodes and writes both a tag and length value to the stream.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
nbytes The number of bytes in string to be encoded.
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.
virtual void EncodeStringTag ( int  nbytes,
Asn1Tag  tag 
) [virtual]

This method encodes and writes both a tag and length value to the stream.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
nbytes The number of bytes in string to be encoded.
tag The tag to be encoded.
override void EncodeUnivString ( int[]  value,
bool  explicitTagging,
Asn1Tag  tag 
) [virtual]

This method writes the given array of integers as UniversalString value.

Throws, exception thrown by the underlying System.IO.Stream object.

Parameters:
value Array containing data to encode.
explicitTagging Flag indicating explicit tagging should be done
tag Universal tag to apply
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.