ASN1C C# Runtime Library  7.8
Classes | Public Member Functions | Protected Attributes | List of all members
Asn1OpenType Class Reference
Inheritance diagram for Asn1OpenType:
Asn1OctetString Asn1Type Asn1TypeIF Asn1ChoiceExt Asn1XerOpenType

Classes

class  SaxHandler
 

Public Member Functions

 Asn1OpenType ()
 
 Asn1OpenType (byte[] data)
 
 Asn1OpenType (byte[] data, int encoding)
 
 Asn1OpenType (byte[] data, int offset, int nbytes)
 
 Asn1OpenType (byte[] data, int offset, int nbytes, int encoding)
 
 Asn1OpenType (Asn1EncodeBuffer buffer)
 
 Asn1OpenType (string data, int encoding)
 
 Asn1OpenType (char[] data, int encoding)
 
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
 
override void Decode (Asn1PerDecodeBuffer buffer)
 
override void Decode (Asn1OerDecodeBuffer buffer)
 
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
 
override void Encode (Asn1PerEncodeBuffer buffer)
 
override void Encode (Asn1OerEncodeBuffer buffer)
 
override void Encode (Asn1XmlEncoder buffer, String elemName, String nsPrefix)
 
override void Encode (Asn1XmlEncoder buffer)
 
override void Encode (Asn1XerEncoder buffer, String elemName)
 
override void Encode (Asn1XerEncoder buffer)
 
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
 
override void Encode (Asn1PerOutputStream outs)
 
void EncodeAsExtension (Asn1XmlEncoder buffer)
 
void EncodeAsExtension (Asn1XerEncoder buffer)
 
char [] GetCharData ()
 
int GetDataEncoding ()
 
virtual Asn1XerSaxHandler GetSaxHandler ()
 
virtual Asn1XerSaxHandler GetSaxHandler (bool captureOuterElem)
 
void SetBinaryData (byte[] data, int encoding)
 
void SetCharData (String data, int encoding)
 
void SetCharData (char[] data, int encoding)
 
override System.String ToString ()
 
- Public Member Functions inherited from Asn1OctetString
 Asn1OctetString ()
 
 Asn1OctetString (byte[] data)
 
 Asn1OctetString (byte[] data, int offset, int nbytes)
 
 Asn1OctetString (System.String value)
 
virtual int CompareTo (System.Object octstr)
 
virtual void Decode (Asn1PerDecodeBuffer buffer, long lower, long upper)
 
override void Decode (Asn1MderDecodeBuffer buffer)
 
void Decode (Asn1MderDecodeBuffer buffer, int constrainedLength)
 
void DecodeContent (Asn1OerDecodeBuffer buffer, int numOctets)
 
virtual void DecodeXER (System.String buffer, System.String attrs, bool base64)
 
override void DecodeXML (System.String buffer, System.String attrs)
 
virtual void Encode (Asn1PerEncodeBuffer buffer, long lower, long upper)
 
override void Encode (Asn1MderOutputStream outs)
 
void Encode (Asn1MderOutputStream outs, int constrainedLength)
 
override void Encode (Asn1XerEncoder buffer, System.String elemName)
 
override void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix)
 
virtual void Encode (Asn1XmlEncoder buffer, System.String elemName, System.String nsPrefix, bool base64)
 
virtual void Encode (Asn1PerOutputStream outs, long lower, long upper)
 
override void EncodeAttribute (Asn1XmlEncoder buffer, System.String attrName)
 
void EncodeContent (Asn1OerEncodeBuffer buffer)
 
bool Equals (byte[] value)
 
bool Equals (String s)
 
override bool Equals (System.Object value)
 
override int GetHashCode ()
 
int GetMderLength ()
 
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 (Asn1XmlEncodeBuffer buffer)
 
virtual void Encode (Asn1MderOutputStream buffer, bool useCachedLength)
 
virtual void Encode (Asn1CerOutputStream outs, bool explicitTagging)
 
void EncodeAsOpenType (Asn1OerEncodeBuffer buffer)
 
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 ()
 

Protected Attributes

int dataEncoding
 

Additional Inherited Members

- Static Public Member Functions inherited from Asn1OctetString
static System.String EncodeBase64Binary (byte[] data)
 
static void Skip (Asn1PerDecodeBuffer buffer)
 
static void Skip (Asn1PerDecodeBuffer buffer, long lower, long upper)
 
- 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)
 
- Public Attributes inherited from Asn1OctetString
byte [] 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 inherited from Asn1OctetString
static new readonly Asn1Tag _TAG
 
- Static Public Attributes inherited from Asn1Type
static readonly Asn1Tag _TAG
 
- Properties inherited from Asn1OctetString
override int Length [get]
 
- Properties inherited from Asn1Type
virtual String AsnTypeName [get]
 
virtual int Length [get]
 

Detailed Description

This is a container class for holding an ASN.1 open type value.

Where the data is internally stored and how it is interpreted is controlled by a "dataEncoding" field. You can specify the data encoding when creating the object. It will also be set when decoding. The following explains the possible data encodings:

Note especially that the data encoding indicates the encoding rules used to encode the actual value. That result is typically encoded as part of some larger encoding. The data encoding does NOT indicate the rules used for that larger encoding. For example, using an xmlhstring representation, XER and JSON will encode an open type that was previously encoded using any arbitrary encoding rules. When decoding such data, the data encoding will be UNKNOWN, not XER nor JSON.

Constructor & Destructor Documentation

◆ Asn1OpenType() [1/8]

This constructor creates an empty type that can be used in a Decode method call to receive an encoded value. The data encoding is UNKNOWN.

◆ Asn1OpenType() [2/8]

Asn1OpenType ( byte []  data)

This constructor initializes an open type from the given byte array. The array is assumed to contain a previously encoded message component. The data encoding is UNKNOWN.

Parameters
dataByte array containing a previously encoded message component.

◆ Asn1OpenType() [3/8]

Asn1OpenType ( byte []  data,
int  encoding 
)

This constructor initializes an open type from the given byte array. The array is assumed to contain a previously encoded message component.

Parameters
dataByte array containing a previously encoded value.
encodingThe encoding that describes the meaning of data. Any of the encodings other than JSON.

◆ Asn1OpenType() [4/8]

Asn1OpenType ( byte []  data,
int  offset,
int  nbytes 
)

This constructor initializes the open type from a portion of the given byte array. A new byte array is created starting at the given offset and consisting of the given number of bytes. The encoding is UNKNOWN.

Parameters
dataByte array containing a previously encoded value.
offsetThe offset in array at which to begin copy.
nbytesNumber of bytes to copy from target array

◆ Asn1OpenType() [5/8]

Asn1OpenType ( byte []  data,
int  offset,
int  nbytes,
int  encoding 
)

This constructor initializes the open type from a portion of the given byte array. A new byte array is created starting at the given offset and consisting of the given number of bytes. /p>

Parameters
dataByte array containing a previously encoded value.
encodingStarting offset in data from which to copy bytes
nbytesNumber of bytes to copy from target array
offsetThe encoding that describes the meaning of data. Any of the encodings other than JSON.

◆ Asn1OpenType() [6/8]

This constructor initializes an open type using an encoded component. This can be used if a header (for example, a ROSE header) is being prepended to a pre-encoded component. The data encoding is derived from the type of Asn1EncodeBuffer given, and is possibly UNKNOWN.

Parameters
bufferReference to encode buffer into which component type was encoded.

References Asn1EncodeBuffer.MsgCopy, and Asn1EncodeBuffer.MsgLength.

◆ Asn1OpenType() [7/8]

Asn1OpenType ( string  data,
int  encoding 
)

Convenience constructor. Same as Asn1OpenType(data.ToCharArray(), encoding)

◆ Asn1OpenType() [8/8]

Asn1OpenType ( char []  data,
int  encoding 
)

Create Asn1OpenType on the given character data. /p>

Parameters
dataThe character data array.
encodingThe encoding. Either XER or JSON. If JSON, data is taken to be the JSON encoding of the actual value. The array is not copied, so beware using it after passing it here. The "mValue" field will be assigned null. If XER, data is taken to be the XER encoding of the actual value. The "mValue" field will be assigned the UTF-8 character encoding of the given characters.

Member Function Documentation

◆ Decode() [1/3]

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

This method decodes an ASN.1 open type value. The data encoding will be set to BER.

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

Reimplemented from Asn1OctetString.

Referenced by Asn1OpenExt.DecodeComponent(), Asn1OpenExt.DecodeOpenType(), Asn1OpenExt.SetOpenType(), and Asn1OpenExt.ShrinkArray().

◆ Decode() [2/3]

override void Decode ( Asn1PerDecodeBuffer  buffer)
virtual

This method decodes an ASN.1 open type value using the packed encoding rules (PER). The data encoding will be set to PER.

Parameters
bufferDecode message buffer object

Reimplemented from Asn1OctetString.

◆ Decode() [3/3]

override void Decode ( Asn1OerDecodeBuffer  buffer)
virtual

This method decodes an ASN.1 open type value using the Octet Encoding Rules (OER). This object will subsequently contain the encoding of the open type (which should be OER).

Reimplemented from Asn1OctetString.

◆ Encode() [1/9]

override int Encode ( Asn1BerEncodeBuffer  buffer,
bool  explicitTagging 
)
virtual

This method encodes an ASN.1 open type value. The value is assumed to be an already-encoded BER message component and will be copied to the encoded buffer. An optimization is available in which no copy will performed if the encoded component is already present in the encode buffer. This is done if the form of constructor specifiying only a component length is used.

Parameters
bufferEncode message buffer object
explicitTaggingFlag indicating element is explicitly tagged
Returns
Length of encoded component

Reimplemented from Asn1OctetString.

Referenced by Asn1OpenExt.Encode(), and Asn1OpenExt.ToString().

◆ Encode() [2/9]

override void Encode ( Asn1PerEncodeBuffer  buffer)
virtual

This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER). The data should be the value pre-encoded encoded in PER.

Parameters
bufferEncode message buffer object

Reimplemented from Asn1OctetString.

References Asn1PerEncodeBuffer.EncodeOpenType().

◆ Encode() [3/9]

override void Encode ( Asn1OerEncodeBuffer  buffer)
virtual

This method encodes an ASN.1 open type value using the Octet Encoding Rules (OER). The data should be the value pre-encoded in OER.

Parameters
bufferEncode message buffer object

Reimplemented from Asn1OctetString.

References Asn1XmlXerEncoder.Copy(), Asn1EncodeBuffer.Copy(), Asn1OerEncodeBuffer.EncodeLength(), Asn1XmlXerEncoder.Indent(), and Asn1Util.ToHexString().

◆ Encode() [4/9]

override void Encode ( Asn1XmlEncoder  buffer,
String  elemName,
String  nsPrefix 
)

This method encodes an ASN.1 open type value using the XML Encoding as specified in the XML schema standard(asn2xsd). If the data encoding is XER, the data is written as-is. Otherwise, the data's hexadecimal representation is encoded (i.e. xmlhstring).

Parameters
bufferEncode message buffer object
elemNameIgnored
nsPrefixIgnored

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

◆ Encode() [5/9]

override void Encode ( Asn1XmlEncoder  buffer)
virtual

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

If the data encoding is XER, the data is written as-is. Otherwise, the data's hexadecimal representation is encoded (i.e. xmlhstring).

Parameters
bufferEncode message buffer object

Reimplemented from Asn1Type.

References Asn1XmlXerEncoder.Copy(), and Asn1XmlXerEncoder.EncodeHexStrValue().

◆ Encode() [6/9]

override void Encode ( Asn1XerEncoder  buffer,
String  elemName 
)

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

If the data encoding is XER, the data is written as-is. Otherwise, the data's hexadecimal representation is encoded (i.e. xmlhstring).

Parameters
bufferEncode message buffer object
elemNameIgnored

References Asn1XerEncoder.EncodeEndElement(), and Asn1XerEncoder.EncodeStartElement().

◆ Encode() [7/9]

override void Encode ( Asn1XerEncoder  buffer)
virtual

This method encodes an ASN.1 open type value using the XML Encoding Rules (XER).

If the data encoding is XER, the data is written as-is. Otherwise, the data's hexadecimal representation is encoded (i.e. xmlhstring).

Parameters
bufferEncode message buffer object

Reimplemented from Asn1Type.

References Asn1XmlXerEncoder.Copy(), Asn1XmlXerEncoder.EncodeHexStrValue(), Asn1XmlXerEncoder.Indent(), Asn1XerEncoder.State, and Asn1XerEncoder_Fields.XEREND.

◆ Encode() [8/9]

override void Encode ( Asn1BerOutputStream  outs,
bool  explicitTagging 
)
virtual

This method encodes and writes to the stream an ASN.1 open type value including the UNIVERSAL tag value and length if explicit tagging is specified. This overloaded version uses the Basic Encoding Rules (BER). The data should be the value pre-encoded in BER.

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

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

Reimplemented from Asn1OctetString.

◆ Encode() [9/9]

override void Encode ( Asn1PerOutputStream  outs)
virtual

This method encodes an ASN.1 open type value using the Packed Encoding Rules (PER). The data should be the value pre-encoded in PER.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

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

Reimplemented from Asn1OctetString.

◆ EncodeAsExtension() [1/2]

void EncodeAsExtension ( Asn1XmlEncoder  buffer)

This method encodes an extension element to XML. If the data encoding is other than XER, the hexadecimal representation of the data is encoded inside an XML comment.

Parameters
bufferEncode message buffer object

References Asn1XmlXerEncoder.Indent().

Referenced by Asn1OpenExt.ShrinkArray().

◆ EncodeAsExtension() [2/2]

void EncodeAsExtension ( Asn1XerEncoder  buffer)

This method encodes an extension element to XML. If the data encoding is other than XER, its hexadecimal representation is encoded inside an XML comment.

Parameters
buffer

References Asn1XmlXerEncoder.Indent(), Asn1XerEncoder.State, and Asn1XerEncoder_Fields.XEREND.

◆ GetCharData()

char [] GetCharData ( )

Returns the character data for the open type. Currently, this is only supported when getDataEncoding() returns JSON.

Returns
The char data. The actual internal array is returned; a copy is not made.
Exceptions
RuntimeExceptionif data encoding indicates there is no char data

◆ GetDataEncoding()

int GetDataEncoding ( )

Return the data encoding of the data.

References Asn1BerDecodeBuffer.DecodeOpenType(), Asn1Type.OpenType, and Asn1MessageBufferBase.TypeCode.

◆ GetSaxHandler() [1/2]

virtual Asn1XerSaxHandler GetSaxHandler ( )
virtual

This method returns the Asn1XerOpenType.SaxHandler class instance used for ASN.1 XER encoding. If this is the first invocation of any of the GetSaxHandler methods on this object, the returned handler will capture the outer element start/end tags. Otherwise, this will simply return the same SAX handler as previously returned.

Returns
Asn1XerOpenType.SaxHandler object

◆ GetSaxHandler() [2/2]

virtual Asn1XerSaxHandler GetSaxHandler ( bool  captureOuterElem)
virtual

This method returns the Asn1XerOpenType.SaxHandler class instance used for ASN.1 XER encoding.

Parameters
captureOuterElemPass true if the outer element start and end tags (if present) should be captured. The outer element is the element for which startElement is called when the level is the start level. Note that this parameter is ignored if you have previously invoked one of the getSaxHandler methods on this object.
Returns
Asn1XerOpenType.SaxHandler object

◆ SetBinaryData()

void SetBinaryData ( byte []  data,
int  encoding 
)

Sets the binary data for the open type and assigns the data encoding to the given encoding.

Parameters
dataThe binary data that make up an encoding of the actual value.
encodingIdentifies the encoding rules for which data is an encoding. This can be any of the encodings except JSON.

◆ SetCharData() [1/2]

void SetCharData ( String  data,
int  encoding 
)

Convenience method; same as SetCharData(mValue.toCharArray(), encoding)

◆ SetCharData() [2/2]

void SetCharData ( char []  data,
int  encoding 
)

Sets the character data for the open type and assigns the data encoding to the given encoding.

Parameters
dataThe character data that make up an encoding of the actual value.
encodingPermissible values are JSON and XER. If XER, the given data will be converted to bytes using UTF-8 and held in the "mValue" field. If JSON, the given data will be held as-is. The array will not be copied. The "mValue" field will be assigned null.

◆ ToString()

override System.String ToString ( )

This method will return a string representation of the open type value. If the data encoding is XER or JSON, the string will consist of the corresponding characters (in the case of XER, the byte data is converted to characters using UTF-8). In all other cases, the hexadecimal representation of the byte data is returned.

Returns
Stringified representation of the value

References Asn1PerOutputStream.EncodeOpenType(), and Asn1OutputStream.Write().

Referenced by Asn1OpenExt.SetOpenType(), and Asn1OpenExt.ToString().

Member Data Documentation

◆ dataEncoding

int dataEncoding
protected

Specifies the nature of the data held by this object. /p>

Referenced by Asn1OpenType.SaxHandler.EndElement().