Asn1Integer Class Reference

Inheritance diagram for Asn1Integer:
Asn1Type Asn1TypeIF

List of all members.

Public Member Functions

 Asn1Integer (long value)
 Asn1Integer ()
virtual void Decode (Asn1JsonDecodeBuffer buffer)
virtual void Decode (Asn1PerDecodeBuffer buffer, Object lower, Object upper)
virtual void Decode (Asn1PerDecodeBuffer buffer, long lower, Object upper)
virtual void Decode (Asn1PerDecodeBuffer buffer, Object lower, long upper)
virtual void Decode (Asn1PerDecodeBuffer buffer, long lower, long upper)
override void Decode (Asn1PerDecodeBuffer buffer)
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
void Decode16Bit (Asn1MderDecodeBuffer buffer, bool signed)
void Decode32Bit (Asn1MderDecodeBuffer buffer, bool signed)
void Decode8Bit (Asn1MderDecodeBuffer buffer, bool signed)
virtual void DecodeXER (System.String buffer, System.String attrs)
override void DecodeXML (System.String buffer, System.String attrs)
virtual void Encode (Asn1PerOutputStream outs, Object lower, Object upper)
virtual void Encode (Asn1PerOutputStream outs, long lower, Object upper)
virtual void Encode (Asn1PerOutputStream outs, Object lower, long upper)
virtual void Encode (Asn1PerOutputStream outs, long lower, long upper)
override void Encode (Asn1PerOutputStream outs)
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
virtual void Encode (Asn1JsonOutputStream outs)
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
override void Encode (Asn1XerEncoder buffer, System.String elemName)
virtual void Encode (Asn1PerEncodeBuffer buffer, Object lower, Object upper)
virtual void Encode (Asn1PerEncodeBuffer buffer, long lower, Object upper)
virtual void Encode (Asn1PerEncodeBuffer buffer, Object lower, long upper)
virtual void Encode (Asn1PerEncodeBuffer buffer, long lower, long upper)
override void Encode (Asn1PerEncodeBuffer buffer)
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
void Encode16Bit (Asn1MderOutputStream outs, bool signed)
void Encode32Bit (Asn1MderOutputStream outs, bool signed)
void Encode8Bit (Asn1MderOutputStream outs, bool signed)
override void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
override bool Equals (System.Object value)
virtual bool Equals (long value)
virtual int GetBitCount ()
override int GetHashCode ()
virtual int GetUnsignedBitCount ()
override System.String ToString ()

Static Public Member Functions

static long DecodeValue (Asn1PerDecodeBuffer buffer, long lower, long upper)
static long DecodeValue (Asn1PerDecodeBuffer buffer)
static void EncodeValue (Asn1PerEncoder encoder, long val, long lower, long upper)
static int GetBitCount (long ivalue)
static int GetUnsignedBitCount (long ivalue)

Public Attributes

long mValue

Static Public Attributes

static new readonly Asn1Tag _TAG

Detailed Description

This class represents the ASN.1 INTEGER built-in type.


Constructor & Destructor Documentation

Asn1Integer (  ) 

The default constructor sets the integer value to zero.

Asn1Integer ( long  value  ) 

This constructor creates an integer object from a integer value.

Parameters:
value Integer value

Member Function Documentation

virtual void Decode ( Asn1JsonDecodeBuffer  buffer  )  [virtual]

Decode ASN.1 INTEGER from JSON.

virtual void Decode ( Asn1PerDecodeBuffer  buffer,
Object  lower,
Object  upper 
) [virtual]

This method decodes a unconstrained ASN.1 integer value using the Packed Encoding Rules (PER). The decoded result is stored in the public member 'mValue' in this object.

Parameters:
buffer PER Decode message buffer object
lower Lower bound equal MIN
upper Upper bound equal MAX
virtual void Decode ( Asn1PerDecodeBuffer  buffer,
long  lower,
Object  upper 
) [virtual]

This method decodes a semi-constrained ASN.1 integer value using the Packed Encoding Rules (PER). The decoded result is stored in the public member 'mValue' in this object.

Parameters:
buffer PER Decode message buffer object
lower Lower bound of the integer range
upper Upper bound equal MAX
virtual void Decode ( Asn1PerDecodeBuffer  buffer,
Object  lower,
long  upper 
) [virtual]

This method decodes a unconstrained ASN.1 integer value using the Packed Encoding Rules (PER). The decoded result is stored in the public member 'mValue' in this object.

Parameters:
buffer PER Decode message buffer object
lower Lower bound equal MIN
upper Upper bound of the integer range
virtual void Decode ( Asn1PerDecodeBuffer  buffer,
long  lower,
long  upper 
) [virtual]

This method decodes a constrained ASN.1 integer value using the Packed Encoding Rules (PER). The decoded result is stored in the public member 'mValue' in this object.

Parameters:
buffer PER Decode message buffer object
lower Lower bound of the integer range
upper Upper bound of the integer range
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 member 'mValue' in this object.

Parameters:
buffer PER Decode message buffer object

Reimplemented from Asn1Type.

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:
buffer Decode message buffer object
explicitTagging Flag indicating element is explicitly tagged
implicitLength Length of contents if implicit

Reimplemented from Asn1Type.

void Decode16Bit ( Asn1MderDecodeBuffer  buffer,
bool  signed 
)

Decode a signed or unsigned 16-bit integer from an MDER encoding. This should be used to decode integer types that are constrained to exactly the value space of a signed/unsigned 16 bit integer.

void Decode32Bit ( Asn1MderDecodeBuffer  buffer,
bool  signed 
)

Decode a signed or unsigned 32-bit integer from an MDER encoding. This should be used to decode integer types that are constrained to exactly the value space of a signed/unsigned 32 bit integer.

void Decode8Bit ( Asn1MderDecodeBuffer  buffer,
bool  signed 
)

Decode a signed or unsigned 8-bit integer from an MDER encoding. This should be used to decode integer types that are constrained to exactly the value space of a signed/unsigned 8 bit integer.

static long DecodeValue ( Asn1PerDecodeBuffer  buffer,
long  lower,
long  upper 
) [static]

This method decodes a constrained ASN.1 integer value using the Packed Encoding Rules (PER). The decoded result is returned.

Parameters:
buffer PER Decode message buffer object
lower Lower bound of the integer range
upper Upper bound of the integer range
static long DecodeValue ( Asn1PerDecodeBuffer  buffer  )  [static]

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 returned.

Parameters:
buffer PER Decode message buffer object
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:
buffer String containing data to be decoded
attrs Attributes string from element tag
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:
buffer String containing data to be decoded
attrs Attributes string from element tag
virtual void Encode ( Asn1PerOutputStream  outs,
Object  lower,
Object  upper 
) [virtual]

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

Parameters:
outs PER Encode message buffer object
lower Lower bound equal MIN
upper Upper bound equal MAX
virtual void Encode ( Asn1PerOutputStream  outs,
long  lower,
Object  upper 
) [virtual]

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

Parameters:
outs PER Encode message buffer object
lower Lower bound (inclusive) of integer being encoded
upper Upper bound equal MAX
virtual void Encode ( Asn1PerOutputStream  outs,
Object  lower,
long  upper 
) [virtual]

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

Parameters:
outs PER Encode message buffer object
lower Lower bound equal MIN
upper Upper bound (inclusive) of integer being encoded
virtual void Encode ( Asn1PerOutputStream  outs,
long  lower,
long  upper 
) [virtual]

This method encodes a constrained 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:
outs PER Encode message buffer object
lower Lower bound (inclusive) of integer being encoded
upper Upper bound (inclusive) of integer being encoded
Exceptions:
Asn1Exception Thrown, if operation is failed.
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:
outs PER Encode message buffer object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1Type.

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 C# System.IO.Stream for I/O error

Parameters:
outs BER Output Stream object
explicitTagging Flag indicating explicit tagging should be done
Exceptions:
Asn1Exception Thrown, if operation is failed.

Reimplemented from Asn1Type.

virtual void Encode ( Asn1JsonOutputStream  outs  )  [virtual]

Encode the value of this object as a JSON number.

Parameters:
out 
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(asn2xsd).

Parameters:
buffer Encode message buffer object
elemName Element name
nsPrefix Element namespace value

Reimplemented from Asn1Type.

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

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

Parameters:
buffer Encode message buffer object
elemName Element name

Reimplemented from Asn1Type.

virtual void Encode ( Asn1PerEncodeBuffer  buffer,
Object  lower,
Object  upper 
) [virtual]

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

Parameters:
buffer PER Encode message buffer object
lower Lower bound equal MIN
upper Upper bound equal MAX
virtual void Encode ( Asn1PerEncodeBuffer  buffer,
long  lower,
Object  upper 
) [virtual]

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

Parameters:
buffer PER Encode message buffer object
lower Lower bound (inclusive) of integer being encoded
upper Upper bound equal MAX
virtual void Encode ( Asn1PerEncodeBuffer  buffer,
Object  lower,
long  upper 
) [virtual]

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

Parameters:
buffer PER Encode message buffer object
lower Lower bound equal MIN
upper Upper bound (inclusive) of integer being encoded
virtual void Encode ( Asn1PerEncodeBuffer  buffer,
long  lower,
long  upper 
) [virtual]

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

Parameters:
buffer PER Encode message buffer object
lower Lower bound (inclusive) of integer being encoded
upper Upper bound (inclusive) of integer being encoded
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:
buffer PER Encode message buffer object

Reimplemented from Asn1Type.

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:
buffer Encode message buffer object
explicitTagging Flag indicating explicit tagging should be done
Returns:
Length of component or negative status value

Reimplemented from Asn1Type.

void Encode16Bit ( Asn1MderOutputStream  outs,
bool  signed 
)

This method encodes this ASN.1 INTEGER value to the MDER encoding. The value must fall in the set of 16-bit unsigned integers (if signed is false) or 16-bit signed integers (if signed is true).

void Encode32Bit ( Asn1MderOutputStream  outs,
bool  signed 
)

This method encodes this ASN.1 INTEGER value to the MDER encoding. The value must fall in the set of 32-bit unsigned integers (if signed is false) or 32-bit signed integers (if signed is true).

void Encode8Bit ( Asn1MderOutputStream  outs,
bool  signed 
)

This method encodes this ASN.1 INTEGER value to the MDER encoding. The value must fall in the set of 8-bit unsigned integers (if signed is false) or 8-bit signed integers (if signed is true).

override void EncodeAttribute ( Asn1XmlEncoder  buffer,
System.String  attrName 
) [virtual]

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

Parameters:
buffer Encode message buffer object
elemName Element name
attribute Element attribute value

Reimplemented from Asn1Type.

static void EncodeValue ( Asn1PerEncoder  encoder,
long  val,
long  lower,
long  upper 
) [static]

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

Parameters:
buffer PER Encode message buffer object
lower Lower bound (inclusive) of integer being encoded
upper Upper bound (inclusive) of integer being encoded
override bool Equals ( System.Object  value  ) 

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

Parameters:
value The Object to compare with the current Object. Object should be instance of Asn1Integer.
Returns:
true if the specified Object is equal to the current Object; otherwise, false.
virtual bool Equals ( long  value  )  [virtual]

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

Parameters:
value The long value to compare with the current Object.
Returns:
true if the specified long value is equal to the current Object; otherwise, false.
virtual int GetBitCount (  )  [virtual]

This method calculates the count of bits in the contained integer value.

Returns:
Bit count.
static int GetBitCount ( long  ivalue  )  [static]

This method calculates the count of bits in an integer value.

Parameters:
ivalue Integer value in which to count bits.
Returns:
Bit count.
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.
virtual int GetUnsignedBitCount (  )  [virtual]

This method calculates the count of bits in the contained unsigned integer value.

Returns:
Bit count.
static int GetUnsignedBitCount ( long  ivalue  )  [static]

This method calculates the count of bits in an unsigned integer value.

Parameters:
ivalue Integer value in which to count bits.
Returns:
Bit count.
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

Member Data Documentation

new readonly Asn1Tag _TAG [static]

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

Reimplemented from Asn1Type.

long mValue

This public member variable is where the integer value is stored. This is the value that is encoded when one of the encode methods is called. It is also where the decoded result is stored when a Decode method is called.