Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Open Source
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

Asn1OctetString Class Reference

Inheritance diagram for Asn1OctetString:

Asn1Type Asn1TypeIF Asn1OpenType Asn1XerBase64OctetString Asn1ChoiceExt Asn1XerOpenType List of all members.

Detailed Description

This is a container class for holding the components of an ASN.1 octet string value.


Public Member Functions

 Asn1OctetString (System.String value)
 Asn1OctetString (byte[] data, int offset, int nbytes)
 Asn1OctetString (byte[] data)
 Asn1OctetString ()
virtual int CompareTo (System.Object octstr)
virtual void Decode (Asn1PerDecodeBuffer buffer, long lower, long upper)
override void Decode (Asn1PerDecodeBuffer buffer)
override void Decode (Asn1BerDecodeBuffer buffer, bool explicitTagging, int implicitLength)
virtual void DecodeXER (System.String buffer, System.String attrs)
virtual void DecodeXML (System.String buffer, System.String attrs)
virtual void Encode (Asn1PerOutputStream outs, long lower, long upper)
override void Encode (Asn1PerOutputStream outs)
override void Encode (Asn1BerOutputStream outs, bool explicitTagging)
override void Encode (Asn1XerEncoder buffer, System.String elemName, System.String attribute)
override void Encode (Asn1XerEncoder buffer, System.String elemName)
virtual void Encode (Asn1PerEncodeBuffer buffer, long lower, long upper)
override void Encode (Asn1PerEncodeBuffer buffer)
override int Encode (Asn1BerEncodeBuffer buffer, bool explicitTagging)
override bool Equals (System.Object value)
bool Equals (byte[] value)
override int GetHashCode ()
virtual System.IO.Stream toInputStream ()
override System.String ToString ()

Public Attributes

byte[] mValue

Static Public Attributes

static new readonly Asn1Tag _TAG

Properties

override int Length


Constructor & Destructor Documentation

Asn1OctetString  ) 
 

This constructor creates an empty octet string that can be used in a Decode method call to receive an octet string value.

Asn1OctetString byte[]  data  ) 
 

This constructor initializes an octet string from the given byte array.

Parameters:
data Byte array containing an octet string in binary form.

Asn1OctetString byte[]  data,
int  offset,
int  nbytes
 

This constructor initializes an octet string 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.

Parameters:
data Byte array containing an octet string in binary form.
offset The offset in array at which to begin copy.
nbytes Number of bytes to copy from target array

Asn1OctetString 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

Char string: 'abcdefg'

Parameters:
value The ASN.1 value specification text


Member Function Documentation

virtual int CompareTo System.Object  octstr  )  [virtual]
 

This method compares two Asn1OctetString objects for equality. The OCTET STRING's are equal if a) all octets are equal, and b) the lengths are the same.

This method is required to implement the Comparable interface used for sorting.

Parameters:
octstr Asn1OctetString to compare
Returns:
0 if equal, 1 if this string is greater than supplied string, -1 if this string is less than supplied string.

virtual void Decode Asn1PerDecodeBuffer  buffer,
long  lower,
long  upper
[virtual]
 

This method decodes a sized ASN.1 octet string value using the packed encoding rules (PER).

Parameters:
buffer Decode message buffer object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint

override void Decode Asn1PerDecodeBuffer  buffer  )  [virtual]
 

This method decodes an ASN.1 octet string value using the packed encoding rules (PER). The string is assumed to not contain a size constraint.

Parameters:
buffer Decode message buffer object

Reimplemented from Asn1Type.

Reimplemented in Asn1ChoiceExt, and Asn1XerOpenType.

override void Decode Asn1BerDecodeBuffer  buffer,
bool  explicitTagging,
int  implicitLength
[virtual]
 

This method decodes an ASN.1 octet string value including the UNIVERSAL tag value and length if explicit tagging is specified.

Parameters:
buffer Decode message buffer object
explicitTagging Flag indicating element is explicitly tagged
implicitLength Length of contents if implicit

Reimplemented from Asn1Type.

Reimplemented in Asn1ChoiceExt, Asn1OpenType, and Asn1XerOpenType.

virtual void DecodeXER System.String  buffer,
System.String  attrs
[virtual]
 

This method decodes ASN.1 octet string type using the XML encoding rules (XER).

Parameters:
buffer String containing data to be decoded
attrs Attributes string from element tag

Reimplemented in Asn1XerBase64OctetString.

virtual void DecodeXML System.String  buffer,
System.String  attrs
[virtual]
 

This method decodes an ASN.1 octet string type using the XML schema encoding rules(asn2xsd).

Parameters:
buffer String containing data to be decoded
attrs Attributes string from element tag

Reimplemented in Asn1XerBase64OctetString.

virtual void Encode Asn1PerOutputStream  outs,
long  lower,
long  upper
[virtual]
 

This method encodes a size-constrained ASN.1 octet string value using the packed encoding rules (PER). The value to be encoded is stored in the 'mValue' public member variable within this class.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

Parameters:
outs PER Output Stream object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint
Exceptions:
Asn1Exception Thrown, if operation is failed.

override void Encode Asn1PerOutputStream  outs  )  [virtual]
 

This method encodes an unconstrained ASN.1 octet string value using the packed encoding rules (PER). The value to be encoded is stored in the 'mValue' public member variable within this class.

Also throws any exception thrown by the underlying Asn1PerOutputStream.

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

Reimplemented from Asn1Type.

Reimplemented in Asn1ChoiceExt, and Asn1OpenType.

override void Encode Asn1BerOutputStream  outs,
bool  explicitTagging
[virtual]
 

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

Reimplemented in Asn1ChoiceExt, and Asn1OpenType.

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

This method encodes ASN.1 octet string type using the XML Encoding as specified in the XML schema standard(asn2xsd).

Parameters:
buffer Encode message buffer object
elemName XML element name used to wrap string
attribute Element attribute value

Reimplemented from Asn1Type.

Reimplemented in Asn1XerBase64OctetString, and Asn1XerOpenType.

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

This method encodes ASN.1 octet string type using the XML encoding rules (XER).

Parameters:
buffer Encode message buffer object
elemName XML element name used to wrap string

Reimplemented from Asn1Type.

Reimplemented in Asn1XerBase64OctetString, and Asn1XerOpenType.

virtual void Encode Asn1PerEncodeBuffer  buffer,
long  lower,
long  upper
[virtual]
 

This method encodes a size-constrained ASN.1 octet string value using the packed encoding rules (PER). The value to be encoded is stored in the 'mValue' public member variable within this class.

Parameters:
buffer Encode message buffer object
lower Lower bound (inclusive) of size constraint
upper Upper bound (inclusive) of size constraint

override void Encode Asn1PerEncodeBuffer  buffer  )  [virtual]
 

This method encodes an unconstrained ASN.1 octet string value using the packed encoding rules (PER). The value to be encoded is stored in the 'mValue' public member variable within this class.

Parameters:
buffer Encode message buffer object

Reimplemented from Asn1Type.

Reimplemented in Asn1ChoiceExt, Asn1OpenType, and Asn1XerOpenType.

override int Encode Asn1BerEncodeBuffer  buffer,
bool  explicitTagging
[virtual]
 

This method encodes an ASN.1 octet string value including the UNIVERSAL tag value and length if explicit tagging is specified.

Parameters:
buffer Encode message buffer object
explicitTagging Flag indicating explicit tagging should be done
Returns:
Length of encoded component

Reimplemented from Asn1Type.

Reimplemented in Asn1ChoiceExt, Asn1OpenType, and Asn1XerOpenType.

override bool Equals System.Object  value  ) 
 

This method compares this octet string value to the given value for equality.

Parameters:
value The Object to compare with the current Object. Object should be instance of Asn1OctetString.
Returns:
true if the specified Object is equal to the current Object; otherwise, false.

bool Equals byte[]  value  ) 
 

This method compares this octet string value to the given value for equality.

Parameters:
value The byte array to compare with the current Object.
Returns:
true if the specified byte array is equal to the current Object; otherwise, false.

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 System.IO.Stream toInputStream  )  [virtual]
 

This method will return a byte array input stream representation of the octet string value.

Returns:
Reference to System.IO.MemoryStream object

override System.String ToString  ) 
 

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

Returns:
Stringified representation of the value

Reimplemented in Asn1OpenType.


Member Data Documentation

new readonly Asn1Tag _TAG [static]
 

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

Reimplemented from Asn1Type.

byte [] mValue
 

This variable holds the octet string value. These are the octets that are encoded when encode is invoked. It is also where the decoded octet string is stored after a Decode operation.


Property Documentation

override int Length [get]
 

Gets the length of the OCTET STRING in octets.

Value: length of the octet string

Reimplemented from Asn1Type.


Copyright © 1997-2005 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 18 Nov 2005.
ASN1C C# Runtime Library, 5.8