Asn1Type Class Reference

Inheritance diagram for Asn1Type:
Asn1TypeIF Asn1ArrayType Asn1BigInteger Asn1BitString Asn1Boolean Asn1CharString Asn1Choice Asn1Enumerated Asn1Integer Asn1Null Asn1ObjectIdentifier Asn1OctetString Asn1OpenExt Asn1Real Asn1SeqOrSet Asn1SeqSetOf Asn1UniversalString Asn1X694OrderElement

List of all members.

Public Member Functions

virtual void Decode (System.Object reader, System.IO.Stream byteStream)
virtual void Decode (System.Object reader, System.String xmlURI)
virtual void Decode (Asn1PerDecodeBuffer buffer)
virtual void Decode (Asn1BerDecodeBuffer buffer)
virtual void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
virtual void DecodeXML (String buffer, String attrs)
virtual void Encode (Asn1PerOutputStream outs)
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
virtual void Encode (Asn1BerOutputStream outs, bool explicitTagging)
virtual void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
virtual void Encode (Asn1XmlEncoder buffer)
virtual void Encode (Asn1XerEncoder buffer, System.String elemName)
virtual void Encode (Asn1XerEncoder buffer)
virtual void Encode (Asn1PerEncodeBuffer buffer)
virtual int Encode (Asn1BerEncodeBuffer buffer)
virtual int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
virtual void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
virtual bool Equals (Asn1Type obj)
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.String varName)
virtual void Print (System.IO.TextWriter outs, System.String varName, int level)
void SetKey (byte[] rtkey)
virtual void SetOpenType ()

Static Public Member Functions

static Asn1Type Decode (Asn1PerDecodeBuffer buffer, Object decoder)
static Asn1Type Decode (Asn1BerDecodeBuffer buffer, Object decoder, bool explicitTag, int implicitLength)
static System.String GetTypeName (short typeCode)
static void SetKey2 (byte[] rtkey)

Public Attributes

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 readonly Asn1Tag _TAG

Static Protected Member Functions

static internal int MatchTag (Asn1BerDecodeBuffer buffer, Asn1Tag tag)
static internal int MatchTag (Asn1BerDecodeBuffer buffer, short tagClass, short tagForm, int tagIDCode)

Properties

virtual String AsnTypeName [get]
virtual int Length [get]

Detailed Description

This is the base class for all ASN.1 built-in types.


Member Function Documentation

virtual void Decode ( System.Object  reader,
System.IO.Stream  byteStream 
) [virtual]

This method declaration is the signature of the standard XML Encoding Rules (XER) Decode method.

Also throws any IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

Parameters:
reader XML reader object
byteStream Input byte stream object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

virtual void Decode ( System.Object  reader,
System.String  xmlURI 
) [virtual]

This method declaration is the signature of the standard XML Encoding Rules (XER) Decode method.

Also throws any IO exception from the parser, possibly from a byte stream or character stream supplied by the application.

Parameters:
reader XML reader object
xmlURI URI of a source
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

virtual void Decode ( Asn1PerDecodeBuffer  buffer  )  [virtual]

This method is the base implementation of the standard Packed Encoding Rules (PER) Decode method. It throws an exception because it should never be invoked. Inherited class implementes this method in Compiler generated code.

Parameters:
buffer PER Encode message buffer object
Exceptions:
Asn1Exception if invoked directly

Implements Asn1TypeIF.

Reimplemented in Asn18BitCharString, Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1Duration, Asn1Integer, Asn1Null, Asn1NumericString, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1Time, Asn1TimeOfDay, Asn1UniversalString, Asn1UTF8String, and Asn1VarWidthCharString.

static Asn1Type Decode ( Asn1PerDecodeBuffer  buffer,
Object  decoder 
) [static]

Decode a value from the given buffer, using the given decoder.

Parameters:
buffer Decode message buffer object
decoder One of the following: An Asn1PerDecoder. In this case, decoding will be performed using the Asn1PerDecoder interface. The Type for a subclass of Asn1Type. In this case, the class will be instantiated and used to perform decoding.

The instantiated object is returned.

static Asn1Type Decode ( Asn1BerDecodeBuffer  buffer,
Object  decoder,
bool  explicitTag,
int  implicitLength 
) [static]

Decode a value from the given buffer, using the given decoder.

Parameters:
buffer Decode message buffer object
decoder One of the following: An Asn1BerDecoder. In this case, decoding will be performed using the Asn1BerDecoder interface. The Type for a subclass of Asn1Type. In this case, the class will be instantiated and used to perform decoding.

The instantiated object is returned.

Parameters:
explicitTag if true, the value to be decoded is preceded by a tag and length, which must first be decoded. Otherwise, implicitLength provides the length of the value to be decoded.
implicitLength The length of the value to be decoded if explicitTag was given as false.
virtual void Decode ( Asn1BerDecodeBuffer  buffer  )  [virtual]

This method is used to Decode a message that is encoded in BER or DER format. This version of the method sets tagging to explicit (Asn1Tag.EXPL) and implicit length to zero.

Parameters:
buffer Decode message buffer object
virtual void Decode ( Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength 
) [virtual]

This method is used to Decode a message that is encoded in BER or DER format.

Parameters:
buffer Decode message buffer object
explicitTagging Flag indicating explicit tag should be parsed from the encoded type.
implicitLength Length of the contents field (only required if explicitTagging is false).

Implements Asn1TypeIF.

Reimplemented in Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1GeneralizedTime, Asn1GeneralString, Asn1GraphicString, Asn1IA5String, Asn1Integer, Asn1Null, Asn1NumericString, Asn1ObjectDescriptor, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1PrintableString, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1T61String, Asn1UniversalString, Asn1UTCTime, Asn1UTF8String, Asn1VideotexString, Asn1VisibleString, and Asn1X694OrderElement.

virtual void DecodeXML ( String  buffer,
String  attrs 
) [virtual]

This method decodes the XML content of a simple type.

Parameters:
buffer String containing data to be decoded
attrs Attributes string from element tag
virtual void Encode ( Asn1PerOutputStream  outs  )  [virtual]

This method is the base implementation of the standard Packed Encoding Rules (PER) encode method using output stream. It throws an exception because it should never be invoked by compiler generated code.

Also throws any exception thrown by the Asn1PerOutputStream.

Parameters:
outs PER Output Stream object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

Reimplemented in Asn18BitCharString, Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1Duration, Asn1Integer, Asn1Null, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1Time, Asn1TimeOfDay, Asn1UniversalString, Asn1UTF8String, Asn1VarWidthCharString, and Asn1X694OrderElement.

virtual void Encode ( Asn1CerOutputStream  outs,
bool  explicitTagging 
) [virtual]

This method writes to the stream an encoded ASN.1 type value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Cer Encoding Rules (CER).

Throws, Exception thrown by C# System.IO.Stream for I/O error

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

Reimplemented in Asn1Real10.

virtual void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging 
) [virtual]

This method writes to the stream an encoded ASN.1 type 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.

Implements Asn1TypeIF.

Reimplemented in Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1Duration, Asn1Enumerated, Asn1GeneralizedTime, Asn1GeneralString, Asn1GraphicString, Asn1IA5String, Asn1Integer, Asn1Null, Asn1NumericString, Asn1ObjectDescriptor, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1PrintableString, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1T61String, Asn1TimeOfDay, Asn1UniversalString, Asn1UTCTime, Asn1UTF8String, Asn1VideotexString, Asn1VisibleString, and Asn1X694OrderElement.

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

This method is the base implementation of the standard XML Encoding as specified in the XML schema standard(asn2xsd). It throws an exception because it should never be invoked. Inherited class implementes this method in Compiler generated code.

Also throws any exception thrown by the underlying stream.

Parameters:
buffer XML Encode message buffer object
elemName XML element name of item
nsPrefix Element namespace value
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

Reimplemented in Asn1Base64BinaryString, Asn1BigInteger, Asn1BitString, Asn1Boolean, Asn1CharString, Asn1Enumerated, Asn1Integer, Asn1Null, Asn1ObjectIdentifier, Asn1OctetString, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1Time, and Asn1UniversalString.

virtual void Encode ( Asn1XmlEncoder  buffer  )  [virtual]

This method is the base implementation of the standard XML Encoding as specified in the XML schema standard(asn2xsd). This method invokes the generated method with element name and attribute name set to null. This will cause the ASN.1 type name to be used as the top-level element name.

Also throws any exception thrown by the underlying stream.

Parameters:
buffer XML Encode message buffer object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

Reimplemented in Asn1OpenExt, and Asn1OpenType.

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

This method is the base implementation of the standard XML Encoding Rules (XER) encode method. It throws an exception because it should never be invoked by compiler generated code.

Also throws any exception thrown by the underlying stream.

Parameters:
buffer XER Encode message buffer object
elemName XML element name of item
Exceptions:
Asn1Exception if invoked directly

Implements Asn1TypeIF.

Reimplemented in Asn1BigInteger, Asn1BitString, Asn1Boolean, Asn1CharString, Asn1Enumerated, Asn1Integer, Asn1Null, Asn1ObjectIdentifier, Asn1OctetString, Asn1Real, Asn1Real10, Asn1RelativeOID, and Asn1UniversalString.

virtual void Encode ( Asn1XerEncoder  buffer  )  [virtual]

This method is the base implementation of the standard XML Encoding Rules (XER) encode method. This method invokes the generated method with element name set to null. This will cause the ASN.1 type name to be used as the top-level element name.

Also throws any exception thrown by the underlying stream.

Parameters:
buffer XER Encode message buffer object
Exceptions:
Asn1Exception Thrown, if operation is failed.

Implements Asn1TypeIF.

Reimplemented in Asn1OpenExt, and Asn1OpenType.

virtual void Encode ( Asn1PerEncodeBuffer  buffer  )  [virtual]

This method is the base implementation of the standard Packed Encoding Rules (PER) encode method. It throws an exception because it should never be invoked. Inherited class implementes this method in Compiler generated code.

Parameters:
buffer PER Encode message buffer object
Exceptions:
Asn1Exception if invoked directly

Implements Asn1TypeIF.

Reimplemented in Asn18BitCharString, Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1Duration, Asn1Integer, Asn1Null, Asn1NumericString, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1Time, Asn1TimeOfDay, Asn1UniversalString, Asn1UTF8String, and Asn1VarWidthCharString.

virtual int Encode ( Asn1BerEncodeBuffer  buffer  )  [virtual]

This method is used to encode a message in BER or DER format. This version of the method sets tagging to explicit (Asn1Tag.EXPL).

Parameters:
buffer Decode message buffer object
Returns:
Length of component or negative status value
virtual int Encode ( Asn1BerEncodeBuffer  buffer,
bool  explicitTagging 
) [virtual]

This method is used to encode this data type in BER or DER format.

Parameters:
buffer Encode message buffer object
explicitTagging Flag indicating explicit tag should be added to the encoded type.
Returns:
Length of component or negative status value

Implements Asn1TypeIF.

Reimplemented in Asn1BigInteger, Asn1BitString, Asn1BMPString, Asn1Boolean, Asn1ChoiceExt, Asn1Date, Asn1DateTime, Asn1Duration, Asn1Enumerated, Asn1GeneralizedTime, Asn1GeneralString, Asn1GraphicString, Asn1IA5String, Asn1Integer, Asn1Null, Asn1NumericString, Asn1ObjectDescriptor, Asn1ObjectIdentifier, Asn1OctetString, Asn1OID_IRI, Asn1OpenExt, Asn1OpenType, Asn1PrintableString, Asn1Real, Asn1Real10, Asn1RelativeOID, Asn1T61String, Asn1TimeOfDay, Asn1UniversalString, Asn1UTCTime, Asn1UTF8String, Asn1VideotexString, Asn1VisibleString, and Asn1X694OrderElement.

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

This method is the base implementation of the standard XML Encoding as specified in the XML schema standard(asn2xsd). It throws an exception because it should never be invoked by compiler generated code.

Parameters:
buffer XML Encode message buffer object
attrName XML attribute name of item
attribute Element attribute value

<throws> IOException Any exception thrown by the underlying stream. </throws> <throws> Asn1Exception Thrown, if operation is failed. </throws>

Reimplemented in Asn1Base64BinaryString, Asn1Boolean, Asn1Integer, Asn1OctetString, Asn1Real, and Asn1Real10.

virtual bool Equals ( Asn1Type  obj  )  [virtual]

Return true if the two objects are equal. /p> Note: in generated code, we will implement Equals(Asn1Type) rather than Equals(Object) to avoid the need to also implement HashCode. The default implementation here is to invoke Equals(Object). This is acceptable for the runtime classes, which have overridden Equals(Object).

static System.String GetTypeName ( short  typeCode  )  [static]

This method will convert a type code into a type name as defined in the X.680 standard..

Parameters:
typeCode Type code to be converted
Returns:
ASN.1 type name
virtual void Indent ( System.IO.TextWriter  outs,
int  level 
) [virtual]

This method will indent three spaces in the given print stream. It is used by the print methods to provide a formatted output of an encoded element value.

Parameters:
outs Print stream
level Indentation level (no of spaces is 3 x this number)
virtual bool IsOpenType (  )  [virtual]

Returns open type mode for XML encoding/decoding.

Returns:
true if open type mode is on.

Implements Asn1TypeIF.

static internal int MatchTag ( Asn1BerDecodeBuffer  buffer,
Asn1Tag  tag 
) [static, protected]

This method will compare the next parsed tag with the given tag value. If they do not match, an exception will be thrown.

Parameters:
buffer Decode message buffer object
tag Tag value to compare
Returns:
Decoded length value
Exceptions:
Asn1TagMatchFailedException Tag is not equal to expected value
static internal int MatchTag ( Asn1BerDecodeBuffer  buffer,
short  tagClass,
short  tagForm,
int  tagIDCode 
) [static, protected]

This method will compare the next parsed tag with the given tag value. If they do not match, an exception will be thrown.

Parameters:
buffer Decode message buffer object
tagClass Tag class value (UNIV, APPL, CTXT, or PRIV)
tagForm Tag form value (PRIM or CONS)
tagIDCode Tag identifier code
Returns:
Decoded length value
Exceptions:
Asn1TagMatchFailedException Tag is not equal to expected value
virtual bool MatchTypeName ( System.String  typeName  )  [virtual]

This method is used to check the outer level tag in an XER message to verify it matches the expected value. This method is overridden by generated code. The default implementation always returns true.

Parameters:
typeName Type name to compare.
Returns:
True if name matches internal name.
virtual void Pdiag ( System.String  s  )  [virtual]

This is a diagnostics print method. It is a shorthand way to invoke the Diag object's println method.

Parameters:
s diagnostics message to be printed.
virtual void Print ( System.String  varName  )  [virtual]

This method will format and output a primitive value to the standard console output.

Parameters:
varName Name of variable
virtual void Print ( System.IO.TextWriter  outs,
System.String  varName,
int  level 
) [virtual]

This method will format and output a primitive value to the given print stream.

Parameters:
outs Print output stream
varName Name of variable
level Indentation level

Implements Asn1TypeIF.

Reimplemented in Asn1ArrayType, and Asn1X694OrderElement.

void SetKey ( byte[]  rtkey  ) 

This method is used with the limited run-time to set a run-time key value generated by the compiler to allow the run-time to operate on the licensed hosts. This is not used in the unlimited redistribution versions.

Parameters:
rtkey Run-time key generated by ASN1C
static void SetKey2 ( byte[]  rtkey  )  [static]

This method is used with the limited run-time to set a run-time key value generated by the compiler to allow the run-time to operate on the licensed hosts. This is not used in the unlimited redistribution versions. This is the static version of SetKey.

Parameters:
rtkey Run-time key generated by ASN1C
virtual void SetOpenType (  )  [virtual]

Sets open type mode for XML encoding/decoding.

Implements Asn1TypeIF.


Member Data Documentation

const short BIT_STRING = 3

BIT_STRING type code = 3

const short BMPString = 30

BMPString type code = 30

const short BOOLEAN = 1

BOOLEAN type code = 1

const short DATE = 31

DATE type code = 31

const short ENUMERATED = 10

ENUMERATED type code = 10

const short EOC = 0

EOC type code = 0

const short EXTERNAL = 8

EXTERNAL type code = 8

const short GeneralString = 27

GeneralString type code = 27

const short GeneralTime = 24

GeneralTime type code = 24

const short GraphicString = 25

GraphicString type code = 25

const short IA5String = 22

IA5String type code = 22

const short INTEGER = 2

INTEGER type code = 2

const short NULL = 5

NULL type code = 5

const short NumericString = 18

NumericString type code = 18

const short OBJECT_IDENTIFIER = 6

OBJECT_IDENTIFIER type code = 6

const short ObjectDescriptor = 7

ObjectDescriptor type code = 7

const short OCTET_STRING = 4

OCTET_STRING type code = 4

const short OpenType = 99

OpenType type code = 99

const short PrintableString = 19

PrintableString type code = 19

const short REAL = 9

REAL type code = 9

const short RELATIVE_OID_IRI = 36

RELATIVE-OID-IRI type code = 35

const short RelativeOID = 13

RELATIVE_OID type code = 13

const short SEQUENCE = 16

SEQUENCE type code = 16

const short SET = 17

SET type code = 17

const short T61String = TeletexString

T61String type code = TeletexString

const short TeletexString = 20

TeletexString type code = 20

const short TIME = 14

TIME type code = 14

const short UniversalString = 28

UniversalString type code = 28

const short UTCTime = 23

UTCTime type code = 23

const short UTF8String = 12

UTF8String type code = 12

const short VideotexString = 21

VideotexString type code = 21

const short VisibleString = 26

VisibleString type code = 26


Property Documentation

virtual String AsnTypeName [get]

Gets the ASN.1 type name that is associated with this type. The ASN.1 type name is derived from the input specification and cannot be set by users of the class.

Value: The ASN.1 type name for this type.

Reimplemented in Asn1OpenExt, and Asn1OpenType.

virtual int Length [get]

Gets the length of types that can be bound by a size constraint (BIT STRING, OCTET STRING, character string, and SEQUENCE OF/SET OF). An attempt to invoke it on any other type will cause an exception to be thrown.

Value: Length of item in units (for example, bits for BIT STRING, octets for OCTET STRING, etc.)

Exceptions:
Asn1InvalidLengthException if called by type rather than size constrainted (BIT STRING, OCTET STRING, character string, or SEQUENCE OF/SET OF)

Reimplemented in Asn1BitString, Asn1CharString, Asn1OctetString, and Asn1UniversalString.