ASN1C C# Runtime Library  7.3
Public Member Functions | List of all members
Asn1CerOutputStream Class Reference
Inheritance diagram for Asn1CerOutputStream:
Asn1BerOutputStream Asn1OutputStream

Public Member Functions

 Asn1CerOutputStream (System.IO.Stream os)
 
 Asn1CerOutputStream (System.IO.Stream os, int bufSize)
 
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, Asn1Tag tag)
 
virtual void EncodeStringTag (int nbytes, short tagClass, short tagForm, int tagIDCode)
 
override void EncodeUnivString (int[] value, bool explicitTagging, Asn1Tag tag)
 
- Public Member Functions inherited from Asn1BerOutputStream
 Asn1BerOutputStream (System.IO.Stream os)
 
 Asn1BerOutputStream (System.IO.Stream os, int bufSize)
 
virtual void EncodeEOC ()
 
virtual void EncodeIdentifier (long ident)
 
virtual void EncodeIntValue (long data, bool encodeLen)
 
virtual void EncodeLength (int len)
 
virtual void EncodeTag (Asn1Tag tag)
 
virtual void EncodeTag (short tagClass, short tagForm, int tagIDCode)
 
virtual void EncodeTagAndIndefLen (Asn1Tag tag)
 
virtual void EncodeTagAndIndefLen (short tagClass, short tagForm, int tagIDCode)
 
virtual void EncodeTagAndLength (Asn1Tag tag, int len)
 
virtual void EncodeUnsignedBinaryNumber (long data)
 
- Public Member Functions inherited from Asn1OutputStream
 Asn1OutputStream (System.IO.Stream os)
 
override void Close ()
 
override void Flush ()
 
override int Read (byte[] buffer, int offset, int count)
 
override long Seek (long offset, System.IO.SeekOrigin origin)
 
override void SetLength (long value)
 
virtual void Write (byte[] b)
 
override void Write (System.Byte[] b, int off, int len)
 
void Write2Bytes (int value)
 
void Write4Bytes (int value)
 
virtual void WriteByte (int b)
 
override void WriteByte (byte b)
 

Additional Inherited Members

- Properties inherited from Asn1OutputStream
override bool CanRead [get]
 
override bool CanSeek [get]
 
override bool CanWrite [get]
 
Asn1Context Context [get]
 
override long Length [get]
 
override long Position [get, set]
 

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() [1/2]

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
osThe underlying System.IO.Stream object.

◆ Asn1CerOutputStream() [2/2]

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
osThe underlying System.IO.Stream object.
bufSizeThe buffer size. If it is 0 then the output stream is used as unbuffered one.

Member Function Documentation

◆ Encode()

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
typeThe object to be written
explicitTaggingFlag indicating explicit tagging should be done

Reimplemented from Asn1BerOutputStream.

References Asn1Type.Encode().

◆ EncodeBitString()

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
valueByte array containing data to encode.
numbitsNumber of bits to encode
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

References Asn1BitString._TAG, Asn1Tag.CONS, Asn1Tag.mClass, and Asn1Tag.mIDCode.

◆ EncodeBMPString()

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
valueString containing data to encode.
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

References Asn1OctetString._TAG, Asn1BMPString._TAG, Asn1Tag.CONS, Asn1Tag.mClass, and Asn1Tag.mIDCode.

◆ EncodeCharString()

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
valueThe string object to be written
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

References Asn1Tag.CONS, Asn1Tag.mClass, Asn1Tag.mIDCode, and Asn1Util.ToByteArray().

◆ EncodeOctetString()

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
valueByte array containing data to encode.
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

References Asn1OctetString._TAG, Asn1Tag.CONS, Asn1Tag.mClass, and Asn1Tag.mIDCode.

◆ EncodeStringTag() [1/2]

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
nbytesThe number of bytes in string to be encoded.
tagThe tag to be encoded.

References Asn1Tag.CONS, Asn1Tag.mClass, and Asn1Tag.mIDCode.

◆ EncodeStringTag() [2/2]

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
nbytesThe number of bytes in string to be encoded.
tagClassThe class of the tag to be encoded.
tagFormThe form of the tag to be encoded.
tagIDCodeThe ID code of the tag to be encoded.

References Asn1Tag.CONS.

◆ EncodeUnivString()

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
valueArray containing data to encode.
explicitTaggingFlag indicating explicit tagging should be done
tagUniversal tag to apply
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1BerOutputStream.

References Asn1OctetString._TAG, Asn1UniversalString._TAG, Asn1Tag.CONS, Asn1Tag.mClass, Asn1Tag.mIDCode, and Asn1Util.URShift().