ASN1C C# Runtime Library  7.8
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Asn1BigInteger Class Reference
Inheritance diagram for Asn1BigInteger:
Asn1Type Asn1TypeIF

Public Member Functions

 Asn1BigInteger ()
 
 Asn1BigInteger (BigInteger value)
 
 Asn1BigInteger (System.String value)
 
 Asn1BigInteger (System.String value, int radix)
 
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
 
override void Decode (Asn1PerDecodeBuffer buffer)
 
void Decode (Asn1PerDecodeBuffer buffer, BigInteger lower, BigInteger upper)
 
override void Decode (Asn1OerDecodeBuffer buffer)
 
void DecodeSigned (Asn1OerDecodeBuffer buffer)
 
void DecodeSigned (Asn1OerDecodeBuffer buffer, int octets)
 
void DecodeUnsigned (Asn1OerDecodeBuffer buffer)
 
void DecodeUnsigned (Asn1OerDecodeBuffer buffer, int octets)
 
BigInteger DecodeValue (Asn1DecodeBuffer buffer, int length)
 
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)
 
void Encode (Asn1PerEncodeBuffer buffer, BigInteger lower, BigInteger upper)
 
override void Encode (Asn1OerEncodeBuffer buffer)
 
override void Encode (Asn1XerEncoder buffer, System.String elemName)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
 
override void Encode (Asn1PerOutputStream outs)
 
override void EncodeAttribute (Asn1XmlEncoder buffer, String attrName)
 
void EncodeSigned (Asn1OerEncodeBuffer buffer, int octets)
 
void EncodeSigned (Asn1OerEncodeBuffer buffer)
 
void EncodeUnsigned (Asn1OerEncodeBuffer buffer)
 
void EncodeUnsigned (Asn1OerEncodeBuffer buffer, int octets)
 
virtual bool Equals (long value)
 
override bool Equals (System.Object value)
 
override int GetHashCode ()
 
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 Decode (Asn1MderDecodeBuffer buffer)
 
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 (Asn1XmlEncodeBuffer buffer)
 
virtual void Encode (Asn1MderOutputStream buffer)
 
virtual void Encode (Asn1MderOutputStream buffer, bool useCachedLength)
 
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
 
void EncodeAsOpenType (Asn1OerEncodeBuffer buffer)
 
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

BigInteger mValue
 
- 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 = new Asn1Tag(Asn1Tag.UNIV, Asn1Tag.PRIM, Asn1Type.INTEGER)
 
- Static Public Attributes inherited from Asn1Type
static readonly Asn1Tag _TAG
 

Additional Inherited Members

- Static Public Member Functions inherited from Asn1Type
static void _SetKey2 (byte[] rtkey)
 
static void _SetLicLocation (String path)
 
static Asn1Type Decode (Asn1BerDecodeBuffer buffer, Asn1OpenTypeField openTypeField, bool explicitTag, int implicitLength)
 
static Asn1Type Decode (Asn1OerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static Asn1Type Decode (Asn1PerDecodeBuffer buffer, Asn1OpenTypeField openTypeField)
 
static System.String GetTypeName (short typeCode)
 
- Properties inherited from Asn1Type
virtual String AsnTypeName [get]
 
virtual int Length [get]
 

Detailed Description

This class represents an ASN.1 INTEGER built-in type. In this case, the values can be greater than 64 bits in size. This class is used in generated source code if the <bigInteger> qualifier is specified in a compiler configuration file.

Constructor & Destructor Documentation

◆ Asn1BigInteger() [1/4]

The default constructor sets the big integer value object reference to null.

◆ Asn1BigInteger() [2/4]

This constructor assigns a big integer object.

Parameters
valueBigInteger value

◆ Asn1BigInteger() [3/4]

Asn1BigInteger ( System.String  value)

This constructor creates a new big integer object and sets it to the string value passed in. String value may contain the prefix that describes the radix: 0x - hexadecimal, 0o - octal, 0b - binary. The string value without prefix assumes decimal value. The optional sign '-' may be specified at the beginning of the string to specify the negative value.

Parameters
valueString value

◆ Asn1BigInteger() [4/4]

Asn1BigInteger ( System.String  value,
int  radix 
)

This constructor creates a new big integer object and sets it to the string value passed in. String value may contain the prefix that describes the radix: 0x - hexadecimal, 0o - octal, 0b - binary. The string value without prefix assumes decimal value. The optional sign '-' may be specified at the beginning of the string to specify the negative value.

Parameters
valueString value
radixCan be 16 for hexadecimal, 8 for octal, 2 for binary or 10 for decimal

Member Function Documentation

◆ Decode() [1/4]

override void Decode ( Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength 
)
virtual

This method decodes an ASN.1 integer value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Parameters
bufferDecode message buffer object
explicitTaggingFlag indicating element is explicitly tagged
implicitLengthLength of contents if implicit

Reimplemented from Asn1Type.

◆ Decode() [2/4]

override void Decode ( Asn1PerDecodeBuffer  buffer)
virtual

This method decodes an unconstrained ASN.1 integer value using the Packed Encoding Rules (PER). The length and contents components of the message are decoded. The decoded result is stored in the public mValue member variable.

Parameters
bufferPER Decode message buffer object

Reimplemented from Asn1Type.

◆ Decode() [3/4]

void Decode ( Asn1PerDecodeBuffer  buffer,
BigInteger  lower,
BigInteger  upper 
)

This method decodes an ASN.1 integer value using Packed Encoding Rules (PER). The length and contents components of the message are decoded. The decoded result is stored in the public mValue member variable.

Parameters
bufferPER Decode message buffer object
lowerThe PER-visible lower bound; null if there is not a lower bound.
upperThe PER-visible upper bound; null if there is not an upper bound.

References BigInteger.Add(), BigInteger.BitLength(), Asn1PerDecodeBuffer.ByteAlign(), BigInteger.CompareTo(), Asn1PerDecodeBuffer.DecodeBitsToOctetArray(), Asn1PerDecodeBuffer.DecodeConsWholeNumber(), Asn1PerDecodeBuffer.DecodeLength(), BigInteger.Equals(), Asn1PerDecodeBuffer.IsAligned(), BigInteger.LongValue(), BigInteger.Subtract(), and BigInteger.ToString().

◆ Decode() [4/4]

override void Decode ( Asn1OerDecodeBuffer  buffer)
virtual

Decode this value as if unconstrained. Subclasses may override this method to decode according to the constraints on the respective ASN.1 type.

Reimplemented from Asn1Type.

◆ DecodeSigned() [1/2]

void DecodeSigned ( Asn1OerDecodeBuffer  buffer)

Decode a variable-size signed integer, encoded with a length, into this object, following OER.

References Asn1OerDecodeBuffer.DecodeLength().

◆ DecodeSigned() [2/2]

void DecodeSigned ( Asn1OerDecodeBuffer  buffer,
int  octets 
)

Decode a signed integer (2's complement form), of the given length, into this object.

Parameters
octetsThe number of octets in which the value was encoded.

References Asn1DecodeBitBuffer.DecodeBitsToOctetArray(), Asn1OerDecodeBuffer.DecodeIntSigned(), and BigInteger.SetData().

◆ DecodeUnsigned() [1/2]

void DecodeUnsigned ( Asn1OerDecodeBuffer  buffer)

Decode a variable-size unsigned integer, encoded with a length, into this object, following OER.

References Asn1OerDecodeBuffer.DecodeLength().

◆ DecodeUnsigned() [2/2]

void DecodeUnsigned ( Asn1OerDecodeBuffer  buffer,
int  octets 
)

Decode an unsigned integer (a binary integer, not 2's complement form), of the given length, into this object.

Parameters
octetsThe number of octets in which the value was encoded.

References Asn1DecodeBitBuffer.DecodeBitsToInt(), Asn1DecodeBitBuffer.DecodeBitsToOctetArray(), Asn1OerDecodeBuffer.DecodeIntUnsigned(), and BigInteger.SetData().

◆ DecodeValue()

BigInteger DecodeValue ( Asn1DecodeBuffer  buffer,
int  length 
)

This method decodes the contents of an ASN.1 integer value using either the Basic Encoding Rules (BER) or the Packed Encoding Rules (PER).

Parameters
bufferDecode message buffer object
lengthLength of encoded contents
Returns
Decoded integer value

References Asn1EncodeBuffer.Copy(), BigInteger.GetData(), Asn1Type.INTEGER, Diag.Prtln(), Asn1DecodeBuffer.ReadByte(), BigInteger.SetData(), and Asn1MessageBufferBase.TypeCode.

◆ DecodeXER()

virtual void DecodeXER ( System.String  buffer,
System.String  attrs 
)
virtual

This method decodes an ASN.1 integer value using the XML encoding rules (XER).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

References Asn1XmlXerEncoder.Copy(), Asn1XmlEncoder.EncodeEndElement(), and Asn1XmlEncoder.EncodeStartElement().

◆ DecodeXML()

override void DecodeXML ( System.String  buffer,
System.String  attrs 
)

This method decodes an ASN.1 integer value using the XML schema encoding rules(asn2xsd).

Parameters
bufferString containing data to be decoded
attrsAttributes string from element tag

References Asn1BerOutputStream.EncodeLength(), Asn1BerOutputStream.EncodeTag(), and Asn1OutputStream.Write().

◆ Encode() [1/8]

override int Encode ( Asn1BerEncodeBuffer  buffer,
bool  explicitTagging 
)
virtual

This method encodes an ASN.1 integer value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER).

Parameters
bufferEncode message buffer object
explicitTaggingFlag indicating explicit tagging should be done
Returns
Length of component or negative status value

Reimplemented from Asn1Type.

References Asn1PerDecodeBuffer.ByteAlign(), Asn1PerDecodeBuffer.DecodeLength(), Asn1BerEncodeBuffer.EncodeTagAndLength(), Asn1Type.INTEGER, Asn1PerTraceHandler.NewBitField(), Asn1PerDecodeBuffer.TraceHandler, and Asn1MessageBufferBase.TypeCode.

◆ Encode() [2/8]

override void Encode ( Asn1PerEncodeBuffer  buffer)
virtual

This method encodes an unconstrained ASN.1 integer value using the Packed Encoding Rules (PER). The length and contents components of the message are encoded.

Parameters
bufferPER Encode message buffer object
Returns
Length of component or negative status value

Reimplemented from Asn1Type.

References Asn1PerEncodeBuffer.EncodeBits(), Asn1PerEncodeBuffer.EncodeLength(), Asn1PerEncodeBuffer.IsAligned(), Asn1PerTraceHandler.NewBitField(), and Asn1PerEncodeBuffer.TraceHandler.

◆ Encode() [3/8]

void Encode ( Asn1PerEncodeBuffer  buffer,
BigInteger  lower,
BigInteger  upper 
)

This method encodes an ASN.1 integer value using Packed Encoding Rules (PER).

The length and contents components of the message are encoded.

Parameters
bufferPER Encode message buffer object
lowerThe PER-visible lower bound; null if there is not a lower bound.
upperThe PER-visible upper bound; null if there is not an upper bound.
Returns
Length of component or negative status value

References BigInteger.Add(), BigInteger.BitLength(), Asn1PerEncodeBuffer.ByteAlign(), BigInteger.CompareTo(), Asn1PerEncodeBuffer.EncodeBits(), Asn1PerEncodeBuffer.EncodeConsWholeNumber(), Asn1PerEncodeBuffer.EncodeLength(), BigInteger.Equals(), BigInteger.GetData(), Asn1PerEncodeBuffer.IsAligned(), BigInteger.LongValue(), Asn1PerTraceHandler.NewBitField(), BigInteger.Subtract(), and BigInteger.ToString().

◆ Encode() [4/8]

override void Encode ( Asn1OerEncodeBuffer  buffer)
virtual

Encode this value as if unconstrained. Subclasses may override this method to encode it according to the constraints on the respective ASN.1 type.

Reimplemented from Asn1Type.

◆ Encode() [5/8]

override void Encode ( Asn1XerEncoder  buffer,
System.String  elemName 
)
virtual

This method encodes an ASN.1 integer value using the XML encoding rules (XER).

Parameters
bufferEncode message buffer object
elemNameElement name

Reimplemented from Asn1Type.

◆ Encode() [6/8]

override void Encode ( Asn1XmlEncoder  buffer,
System.String  elemName,
System.String  nsPrefix 
)
virtual

This method encodes an ASN.1 integer value using the XML Encoding as specified in the XML schema standard.

Parameters
bufferEncode message buffer object
elemNameElement name
nsPrefixElement namespace prefix name

Reimplemented from Asn1Type.

◆ Encode() [7/8]

override void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging 
)
virtual

This method encodes and writes to the stream an ASN.1 integer 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.

Parameters
outsBER Output Stream object
explicitTaggingFlag indicating explicit tagging should be done
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

◆ Encode() [8/8]

override void Encode ( Asn1PerOutputStream  outs)
virtual

This method encodes an unconstrained ASN.1 integer value using the Packed Encoding Rules (PER). The length and contents components of the message are encoded.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

Parameters
outsPER Output Stream object
Exceptions
Asn1ExceptionThrown, if operation is failed.

Reimplemented from Asn1Type.

◆ EncodeAttribute()

override void EncodeAttribute ( Asn1XmlEncoder  buffer,
String  attrName 
)

This method encodes an ASN.1 integer value using the XML Encoding as specified in the XML schema standard.

Parameters
bufferEncode message buffer object
elemNameElement name
attributeAttribute name

References Asn1XmlXerEncoder.Copy().

◆ EncodeSigned() [1/2]

void EncodeSigned ( Asn1OerEncodeBuffer  buffer,
int  octets 
)

Encode integer value as a signed value (2's complement) in the given number of octets.

The value must fit in the given number of octets.

Parameters
bufferThe buffer.
octetsThe number of octets to encode in; 0 < octets <= 8

References BigInteger.BitLength(), Asn1OerEncodeBuffer.EncodeIntSigned(), and BigInteger.LongValue().

◆ EncodeSigned() [2/2]

void EncodeSigned ( Asn1OerEncodeBuffer  buffer)

Encode this value as a variable-size signed integer, with length, according to OER.

References Asn1OerEncodeBuffer.EncodeLength(), and BigInteger.GetData().

◆ EncodeUnsigned() [1/2]

void EncodeUnsigned ( Asn1OerEncodeBuffer  buffer)

Encode this value as a variable-size unsigned integer, with length, according to OER.

References BigInteger.CompareTo(), Asn1OerEncodeBuffer.EncodeLength(), and BigInteger.GetData().

◆ EncodeUnsigned() [2/2]

void EncodeUnsigned ( Asn1OerEncodeBuffer  buffer,
int  octets 
)

Encode integer value as an unsigned value (binary integer) in the given number of octets.

The value must be non-negative and fit in the given number of octets.

Parameters
bufferThe buffer.
octetsThe number of octets to encode in; 0 < octets <= 8.

References BigInteger.BitLength(), BigInteger.CompareTo(), Asn1XmlXerEncoder.Copy(), Asn1XerEncoder.EncodeEndElement(), Asn1OerEncodeBuffer.EncodeIntSigned(), Asn1OerEncodeBuffer.EncodeIntUnsigned(), Asn1XerEncoder.EncodeStartElement(), and BigInteger.LongValue().

◆ Equals() [1/2]

virtual bool Equals ( long  value)
virtual

This method compares this value to the given integer value for equality.

Parameters
valueThe long value to compare with the current Object.
Returns
true if the specified long value is equal to the current Object; otherwise, false.

References BigInteger.Equals().

◆ Equals() [2/2]

override bool Equals ( System.Object  value)

This method compares this value to the given Asn1BigInteger value for equality.

Parameters
valueThe Object to compare with the current Object. Object should be instance of Asn1BigInteger.
Returns
true if the specified Object is equal to the current Object; otherwise, false.

References BigInteger.Equals(), and Asn1BigInteger.mValue.

◆ GetHashCode()

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.

Returns
A hash code for the current Object.

References BigInteger.GetHashCode().

◆ ToString()

override System.String ToString ( )

This method will return a string representation of the integer value. The format is the ASN.1 value format for this type..

Returns
Stringified representation of the value

References BigInteger.ToString().

Member Data Documentation

◆ _TAG

new readonly Asn1Tag _TAG = new Asn1Tag(Asn1Tag.UNIV, Asn1Tag.PRIM, Asn1Type.INTEGER)
static

The _TAG constant describes the universal tag for this data type (UNIVERSAL 2).

◆ mValue

BigInteger mValue

The magnitude of this Asn1BigInteger, in big-endian order: the zeroth element of this array is the most-significant int of the magnitude. The magnitude must be "minimal" in that the most-significant int (mValue[0]) must be non-zero. This is necessary to ensure that there is exactly one representation for each Asn1BigInteger value. Note that this implies that the Asn1BigInteger zero has a zero-length mValue array.

Referenced by Asn1BigInteger.Equals().