Asn1BerOutputStream Class Reference
Public Member Functions | |
Asn1BerOutputStream (System.IO.Stream os, int bufSize) | |
Asn1BerOutputStream (System.IO.Stream os) | |
virtual void | Encode (Asn1Type type, bool explicitTagging) |
virtual void | EncodeBitString (byte[] data, int numbits, bool explicitTagging, Asn1Tag tag) |
virtual void | EncodeBMPString (System.String data, bool explicitTagging, Asn1Tag tag) |
virtual void | EncodeCharString (System.String data, bool explicitTagging, Asn1Tag tag) |
virtual void | EncodeEOC () |
virtual void | EncodeIdentifier (long ident) |
virtual void | EncodeIntValue (long data, bool encodeLen) |
virtual void | EncodeLength (int len) |
virtual void | EncodeOctetString (byte[] data, bool explicitTagging, Asn1Tag tag) |
virtual void | EncodeTag (short tagClass, short tagForm, int tagIDCode) |
virtual void | EncodeTag (Asn1Tag tag) |
virtual void | EncodeTagAndIndefLen (short tagClass, short tagForm, int tagIDCode) |
virtual void | EncodeTagAndIndefLen (Asn1Tag tag) |
virtual void | EncodeTagAndLength (Asn1Tag tag, int len) |
virtual void | EncodeUnivString (int[] data, bool explicitTagging, Asn1Tag tag) |
virtual void | EncodeUnsignedBinaryNumber (long data) |
Detailed Description
This class implements the output stream to encode 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
Asn1BerOutputStream | ( | System.IO.Stream | os | ) |
This constructor creates a buffered BER 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.
Asn1BerOutputStream | ( | System.IO.Stream | os, | |
int | bufSize | |||
) |
This constructor creates a buffered BER 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
virtual 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 in Asn1CerOutputStream.
virtual void EncodeBitString | ( | byte[] | data, | |
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:
-
data 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 in Asn1CerOutputStream.
virtual void EncodeBMPString | ( | System.String | data, | |
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:
-
data 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 in Asn1CerOutputStream.
virtual void EncodeCharString | ( | System.String | data, | |
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:
-
data 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 in Asn1CerOutputStream.
virtual void EncodeEOC | ( | ) | [virtual] |
This method encodes and writes an End-Of-Contents marker to the stream.
Throws, exception thrown by the underlying System.IO.Stream object.
virtual void EncodeIdentifier | ( | long | ident | ) | [virtual] |
This method encodes and writes to the stream an ASN.1 identifier value such as the ones used in a tags or object identifiers.
Throws, exception thrown by the underlying System.IO.Stream.
- Parameters:
-
ident The identifier to be encoded.
virtual void EncodeIntValue | ( | long | data, | |
bool | encodeLen | |||
) | [virtual] |
This method encodes and writes to the stream an ASN.1 integer value's contents according to the ASN.1 Basic Encoding Rules (BER).
Throws, exception thrown by the underlying System.IO.Stream object.
- Parameters:
-
data Integer value to encode. encodeLen Flag indicating length determinant should be encoded before encoding integer value.
virtual void EncodeLength | ( | int | len | ) | [virtual] |
This method encodes and writes a length value to the stream.
Throws, exception thrown by the underlying System.IO.Stream object.
- Parameters:
-
len The length to be encoded.
virtual void EncodeOctetString | ( | byte[] | data, | |
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:
-
data 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 in Asn1CerOutputStream.
virtual void EncodeTag | ( | short | tagClass, | |
short | tagForm, | |||
int | tagIDCode | |||
) | [virtual] |
This method encodes and writes a tag value to the stream.
Throws, exception thrown by the underlying System.IO.Stream 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.
virtual void EncodeTag | ( | Asn1Tag | tag | ) | [virtual] |
This method encodes and writes a tag value to the stream.
Throws, exception thrown by the underlying System.IO.Stream object.
- Parameters:
-
tag The tag to be encoded.
virtual void EncodeTagAndIndefLen | ( | short | tagClass, | |
short | tagForm, | |||
int | tagIDCode | |||
) | [virtual] |
This overloaded version of EncodeTagAndIndefLen allows tag value components to be specified instead of an Asn1Tag object.
Throws, exception thrown by the underlying System.IO.Stream 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.
virtual void EncodeTagAndIndefLen | ( | Asn1Tag | tag | ) | [virtual] |
This method encodes and writes both a tag and an indefinite length indicator to the stream.
Throws, exception thrown by the underlying System.IO.Stream object.
- Parameters:
-
tag The tag to be encoded.
virtual void EncodeTagAndLength | ( | Asn1Tag | tag, | |
int | len | |||
) | [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:
-
tag The tag to be encoded. len The length to be encoded.
virtual void EncodeUnivString | ( | int[] | data, | |
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:
-
data 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 in Asn1CerOutputStream.
virtual void EncodeUnsignedBinaryNumber | ( | long | data | ) | [virtual] |
This method encodes an integer value as unsigned binary number according to the ASN.1 Basic Encoding Rules (BER).. and writes to the stream
Throws, exception thrown by the underlying System.IO.Stream object.
- Parameters:
-
data Integer value to encode.