ASN1C C# Runtime Library
7.3
|
Public Types | |
enum | StringFormat |
Public Member Functions | |
Asn1BitString () | |
Asn1BitString (int numbits_, byte[] data) | |
Asn1BitString (byte[] data) | |
Asn1BitString (bool[] bitValues) | |
Asn1BitString (System.String value_) | |
Asn1BitString (System.Collections.BitArray bitArray) | |
virtual void | Clear (int bitno) |
override void | Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength) |
override void | Decode (Asn1PerDecodeBuffer buffer) |
virtual void | Decode (Asn1PerDecodeBuffer buffer, long lower, long upper) |
virtual void | DecodeXER (System.String buffer, System.String attrs) |
override void | DecodeXML (System.String buffer, System.String attrs) |
override int | Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging) |
override void | Encode (Asn1PerEncodeBuffer buffer) |
virtual void | Encode (Asn1PerEncodeBuffer buffer, long lower, long upper) |
override void | Encode (Asn1XerEncoder buffer, System.String elemName) |
virtual void | Encode (Asn1XerEncoder buffer, System.String elemName, System.String[] namedbits, int[] namedbitindex) |
virtual void | Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix, System.String[] namedbits, int[] namedbitindex) |
override void | Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix) |
override void | Encode (Asn1BerOutputStream outs, bool explicitTagging) |
override void | Encode (Asn1PerOutputStream outs) |
virtual void | Encode (Asn1PerOutputStream outs, long lower, long upper) |
virtual bool | Equals (int nbits, byte[] value) |
override bool | Equals (System.Object value) |
virtual bool | Get (int bitno) |
override int | GetHashCode () |
virtual bool | IsNamedBitStr (System.String buffer) |
virtual void | Set (int bitno, bool value) |
virtual void | Set (int bitno) |
virtual bool [] | ToBoolArray () |
virtual System.String | ToHexString () |
virtual System.IO.Stream | toInputStream () |
override System.String | ToString () |
Public Member Functions inherited from Asn1Type | |
void | _SetKey (byte[] rtkey) |
virtual void | Decode (Asn1BerDecodeBuffer buffer) |
virtual void | Decode (System.Object reader, System.String xmlURI) |
virtual void | Decode (System.Object reader, System.IO.Stream byteStream) |
virtual void | DecodeXML (String buffer, String attrs) |
virtual int | Encode (Asn1BerEncodeBuffer buffer) |
virtual void | Encode (Asn1XerEncoder buffer) |
virtual void | Encode (Asn1XmlEncoder buffer) |
virtual void | Encode (Asn1CerOutputStream outs, bool explicitTagging) |
virtual void | EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName) |
virtual bool | Equals (Asn1Type obj) |
String | GetNonParameterizedTypeName () |
virtual void | Indent (System.IO.TextWriter outs, int level) |
virtual bool | IsOpenType () |
virtual bool | MatchTypeName (System.String typeName) |
virtual void | Pdiag (System.String s) |
virtual void | Print (System.IO.TextWriter outs, System.String varName, int level) |
virtual void | Print (System.String varName) |
void | SetNonParameterizedTypeName (String value) |
virtual void | SetOpenType () |
Public Attributes | |
byte [] | mValue |
int | numbits |
bool | trimZeroBits |
Public Attributes inherited from Asn1Type | |
const short | BIT_STRING = 3 |
const short | BMPString = 30 |
const short | BOOLEAN = 1 |
const short | DATE = 31 |
const short | ENUMERATED = 10 |
const short | EOC = 0 |
const short | EXTERNAL = 8 |
const short | GeneralString = 27 |
const short | GeneralTime = 24 |
const short | GraphicString = 25 |
const short | IA5String = 22 |
const short | INTEGER = 2 |
const short | NULL = 5 |
const short | NumericString = 18 |
const short | OBJECT_IDENTIFIER = 6 |
const short | ObjectDescriptor = 7 |
const short | OCTET_STRING = 4 |
const short | OpenType = 99 |
const short | PrintableString = 19 |
const short | REAL = 9 |
const short | RELATIVE_OID_IRI = 36 |
const short | RelativeOID = 13 |
const short | SEQUENCE = 16 |
const short | SET = 17 |
const short | T61String = TeletexString |
const short | TeletexString = 20 |
const short | TIME = 14 |
const short | UniversalString = 28 |
const short | UTCTime = 23 |
const short | UTF8String = 12 |
const short | VideotexString = 21 |
const short | VisibleString = 26 |
Static Public Attributes | |
static new readonly Asn1Tag | _TAG |
static StringFormat | mStringFormat = StringFormat.HEXBIN |
Static Public Attributes inherited from Asn1Type | |
static readonly Asn1Tag | _TAG |
Protected Member Functions | |
virtual int | GetOerEffectiveMin () |
Properties | |
override int | Length [get] |
virtual bool | this[int bitno] [get, set] |
Properties inherited from Asn1Type | |
virtual String | AsnTypeName [get] |
virtual int | Length [get] |
Additional Inherited Members | |
Static Public Member Functions inherited from Asn1Type | |
static void | _SetKey2 (byte[] rtkey) |
static Asn1Type | Decode (Asn1BerDecodeBuffer buffer, Asn1OpenTypeField openTypeField, bool explicitTag, int implicitLength) |
static Asn1Type | Decode (Asn1PerDecodeBuffer buffer, Asn1OpenTypeField openTypeField) |
static System.String | GetTypeName (short typeCode) |
This is a container class for holding the components of an ASN.1 bit string value.
|
strong |
Defines possible string fomrats.
The HEX
constant describes the string format as hex digit value (e.g. 0123456789ABCDEF).
The BITS
constant describes the string format as binary digit value (e.g. only 0 and 1 digits).
The ASN1VALUE
constant describes the string format as hex or binary digit value. The binary string value will end with letter 'B' and hex string value will end with letter 'H' (e.g. '0101'B or '11'H ). If the number of bits is less than or equal to 16, than it will be printed as Binary digits, else as Hex digits.
Asn1BitString | ( | ) |
This constructor creates an empty bit string that can be used in a Decode method call to receive a bit string value.
Asn1BitString | ( | int | numbits_, |
byte [] | data | ||
) |
This constructor initializes a bit string with the given number of bits and data.
numbits_ | Number of bits |
data | Binary bit string contents |
Asn1BitString | ( | byte [] | data | ) |
This constructor initializes a bit string with the given bytes, using all 8 bits of each byte.
data | Binary bit string contents |
Asn1BitString | ( | bool [] | bitValues | ) |
This constructor initializes a bit string from the given boolean array. Each array position corresponds to a bit in the bit string.
bitValues | The boolean array |
Asn1BitString | ( | System.String | value_ | ) |
This constructor parses the given ASN.1 value text (either a binary or hex data string) and assigns the values to the internal bit string.
Examples of valid value formats are as follows:
Binary string: '11010010111001'B
Hex string: '0fa56920014abc'H
value_ | The ASN.1 value specification text |
References IntHolder.mValue, and Asn1Value.ParseString().
Asn1BitString | ( | System.Collections.BitArray | bitArray | ) |
This constructor initializes a bit string from the given BitSet object.
bitArray | C# BitArray object |
|
virtual |
This method clears the given bit in the bit string.
bitno | The zero-based index of the bit to clear. The bit numbers start at zero and with the MSB of the first byte and progress from left to right. |
References Asn1Type.BIT_STRING, Asn1PerDecodeBuffer.ByteAlign(), Asn1Tag.Constructed, Asn1EncodeBuffer.Copy(), Asn1PerDecodeBuffer.DecodeBitsToOctetArray(), Asn1PerDecodeBuffer.DecodeLength(), Asn1BerEncodeBuffer.EncodeTagAndLength(), Asn1Tag.EOC, Asn1BerDecodeContext.Expired(), Asn1Status.INDEFLEN, Asn1BerDecodeBuffer.LastTag, Diag.Prtln(), Asn1DecodeBuffer.Read(), and Asn1MessageBufferBase.TypeCode.
|
virtual |
This method decodes an ASN.1 bit string value using the BER or DER encoding rules. The UNIVERSAL tag value and length are decoded if explicit tagging is specified.
buffer | Decode message buffer object |
explicitTagging | Flag indicating element is explicitly tagged |
implicitLength | Length of contents if implicit |
Reimplemented from Asn1Type.
|
virtual |
This method decodes an ASN.1 bit string value using the packed encoding rules (PER). The string is assumed to not contain a size constraint.
buffer | Decode message buffer object |
Reimplemented from Asn1Type.
|
virtual |
This method decodes a sized ASN.1 bit string value using the packed encoding rules (PER).
buffer | Decode message buffer object |
lower | Lower bound (inclusive) of size constraint |
upper | Upper bound (inclusive) of size constraint |
References Asn1Type.BIT_STRING, Asn1PerDecodeBuffer.ByteAlign(), Asn1PerDecodeBuffer.DecodeBitsToOctetArray(), Asn1PerDecodeBuffer.DecodeLength(), and Asn1MessageBufferBase.TypeCode.
|
virtual |
This method decodes ASN.1 bit string type using the XML encoding rules (XER).
buffer | String containing data to be decoded |
attrs | Attributes string from element tag |
References Asn1XmlXerEncoder.Copy(), Asn1XmlXerEncoder.EncodeBinStrValue(), Asn1XmlEncoder.EncodeEmptyElement(), Asn1XmlEncoder.EncodeEndElement(), Asn1XmlXerEncoder.EncodeNamedValueElement(), Asn1XmlEncoder.EncodeStartElement(), and Asn1XmlXerEncoder.Indent().
override void DecodeXML | ( | System.String | buffer, |
System.String | attrs | ||
) |
This method decodes ASN.1 bit string type using the XML decoding as specified in the XML Schema standard.
buffer | String containing data to be decoded |
attrs | Attributes string from element tag |
|
virtual |
This method encodes an ASN.1 bit string value using the BER or DER encoding rules. The UNIVERSAL tag value and length are encoded if explicit tagging is specified.
buffer | Encode message buffer object |
explicitTagging | Flag indicating explicit tagging should be done |
Reimplemented from Asn1Type.
|
virtual |
This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER). The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.
buffer | Encode message buffer object |
Reimplemented from Asn1Type.
References Asn1PerEncodeBuffer.ByteAlign(), Asn1PerEncodeBuffer.EncodeBits(), Asn1PerEncodeBuffer.EncodeLength(), and Asn1PerEncodeBuffer.EncodeLengthEOM().
|
virtual |
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER). The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.
buffer | Encode message buffer object |
lower | Lower bound (inclusive) of size constraint |
upper | Upper bound (inclusive) of size constraint |
References Asn1Type.BIT_STRING, Asn1PerEncodeBuffer.ByteAlign(), Asn1PerEncodeBuffer.EncodeBits(), and Asn1PerEncodeBuffer.EncodeLength().
|
virtual |
This method encodes ASN.1 bit string type using the XML encoding rules (XER).
buffer | Encode message buffer object |
elemName | XML element name used to wrap string |
Reimplemented from Asn1Type.
|
virtual |
This method encodes ASN.1 bit string type using the XML Encoding as specified in the itu-t XER standard.
buffer | Encode message buffer object |
elemName | XML element name used to wrap string |
namedbits | Array of named bits |
namedbitindex | Arrat of named bits index values |
References Asn1XmlXerEncoder.Copy(), Asn1XmlXerEncoder.EncodeBinStrValue(), Asn1XerEncoder.EncodeEmptyElement(), Asn1XerEncoder.EncodeEndElement(), Asn1XmlXerEncoder.EncodeNamedValueElement(), Asn1XerEncoder.EncodeStartElement(), and Asn1XmlXerEncoder.Indent().
|
virtual |
This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML Schema standard.
buffer | Encode message buffer object |
elemName | XML element name used to wrap string |
nsPrefix | XML element namespace name |
namedbits | Array of named bits |
namedbitindex | Arrat of named bits index values |
|
virtual |
This method encodes ASN.1 bit string type using the XML Encoding as specified in the XML Schema standard.
buffer | Encode message buffer object |
elemName | XML element name used to wrap string |
nsPrefix | XML element namespace name |
Reimplemented from Asn1Type.
References Asn1XmlXerEncoder.EncodeBinStrValue(), Asn1XmlEncoder.EncodeEmptyElement(), Asn1XmlEncoder.EncodeEndElement(), Asn1XmlEncoder.EncodeStartElement(), and Asn1XmlXerEncoder.Indent().
|
virtual |
This method encodes and writes to the stream an ASN.1 bit string value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).
Throws, exception thrown by the underlying System.IO.Stream object.
outs | BER Output Stream object |
explicitTagging | Flag indicating explicit tagging should be done |
Asn1Exception | Thrown, if operation is failed. |
Reimplemented from Asn1Type.
|
virtual |
This method encodes an unconstrained ASN.1 bit string value using the packed encoding rules (PER)into the stream. The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.
Also throws any exception thrown by the underlying Asn1PerOutputStream.
outs | PER Output Stream object |
Asn1Exception | Thrown, if operation is failed. |
Reimplemented from Asn1Type.
|
virtual |
This method encodes a size-constrained ASN.1 bit string value using the packed encoding rules (PER) into the stream. The value to be encoded is stored in the 'numbits' and 'mValue' public member variables within this class.
Also throws any exception thrown by the underlying Asn1PerOutputStream.
outs | PER Output Stream object |
lower | Lower bound (inclusive) of size constraint |
upper | Upper bound (inclusive) of size constraint |
Asn1Exception | Thrown, if operation is failed. |
References Asn1Tag.PRIM, and Asn1Tag.UNIV.
|
virtual |
This method compares this bit string value to the given value for equality.
This method assumes all unused bits in the last byte are set to zero.
nbits | The number of bits to compare from the byte array. |
value | The byte array to compare with the current Object. |
true
if the specified bit array is equal to the current Object; otherwise, false
. override bool Equals | ( | System.Object | value | ) |
This method compares this bit string value to the given value for equality. This method assumes all unused bits in the last byte are set to zero.
value | The Object to compare with the current Object. Object should be instance of Asn1BitString. |
true
if the specified Object is equal to the current Object; otherwise, false
. References Asn1BitString.mValue, and Asn1BitString.numbits.
|
virtual |
Gets the value of the bit at a specific position in the bit array.
bitno | The zero-based index of the bit to get. The bit numbers start at zero and with the MSB of the first byte and progress from left to right. |
true
if bit is set; otherwise false
. Referenced by Asn1DerEncodeBuffer.TrimBitString().
override int GetHashCode | ( | ) |
Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
|
protectedvirtual |
Return the lower bound for the OER effective size constraint. When trimZeroBits is set, this controls the trimming done for OER encoding.
Subclasses must override this to return the correct value if the BIT STRING has named bits and the effective size constraint has a lower bound other than zero.
References Asn1XmlXerEncoder.EncodeBinStrValue(), Asn1XerEncoder.EncodeEmptyElement(), Asn1XerEncoder.EncodeEndElement(), Asn1XerEncoder.EncodeStartElement(), and Asn1XmlXerEncoder.Indent().
|
virtual |
This method determines is the input character string represented as named bit string or as bits sequence. It is used for XML decoding.
buffer | Bit string as string to be tested. |
|
virtual |
This method sets the given bit number in the bit string with given value. It will expand the existing bit array if it needs to.
bitno | The zero-based index of the bit to set. The bit numbers start at zero and with the MSB of the first byte and progress from left to right. |
value | The Boolean value to assign to the bit. |
|
virtual |
This method will set the given bit number to one (1). It will expand the existing bit array if it needs to.
bitno | The zero-based index of the bit to set. The bit numbers start at zero and with the MSB of the first byte and progress from left to right. |
|
virtual |
This method converts the bit string stored in this object to a boolean array.
|
virtual |
This method will return a hex string representation of the bit string value. The output format is a string of hex bytes with no extra delimiting characters (ex. 0D56EF).
References Asn1Util.ToHexString().
|
virtual |
This method will return a byte array input stream representation of the bit string value.
override System.String ToString | ( | ) |
This method will return a string representation of the bit string value. The output format is a string of hex digits/binary digits according to the value set for mStringFormat variable.
References Asn1BerOutputStream.EncodeBitString(), and Diag.Prtln().
|
static |
The _TAG
constant describes the universal tag for this data type (UNIVERSAL 3).
Referenced by Asn1CerOutputStream.EncodeBitString().
|
static |
The mStringFormat variable can be used to set the string format for print() or event handler calls or toString() functions. The possible options are: HEX, BITS, ASN1VALUE HEX is the default format.
byte [] mValue |
This variable holds the bit string value. These are the bits that are encoded when encode is invoked. It is also where the decoded bit string is stored after a Decode operation.
Referenced by Asn1BitString.Equals().
int numbits |
This variable contains the number of bits in the bit string value.
Referenced by Asn1BitString.Equals(), Asn1DerEncodeBuffer.TrimBitString(), and Asn1BerEncodeBuffer.TrimBitString().
bool trimZeroBits |
This variable describes whether trailing zero bits should be truncated. This is required when encoding a named bit string using CER, DER, PER, or C-OER. By default, no trimming is done.
|
get |
Gets the length of the BIT STRING in bits.
Value:
Number of bits.
|
getset |
Gets or Sets the given bit in the bit string. It will expand the existing bit array if it needs to set the bit value.
bitno | The position of the bit in bit array |
Value:
true if bit is set; otherwise false.