All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.asn1.ASN1Object

java.lang.Object
   |
   +----iaik.asn1.ASN1Object

public abstract class ASN1Object
extends Object
This abstract class defines the external interface for ASN.1 values, both primitive and constructed. The subclasses of this class are assumed to define the application specific methods for accessing the data stored in the ASN.1 data structure.

This class also implements a number of abstract factory methods that create components of appropriate subclasses. In this way, this class acts as a concrete factory an Abstract Factory pattern.


Variable Index

 o asnType
The ASN.1 type of this ASN.1 object.

Constructor Index

 o ASN1Object()

Method Index

 o countComponents()
Returns the number of components in this ASN1Object.
 o decode(int, int, DerDecodeInputStream)
Decodes an ASN1Object by reading the encoding from a DerDecodeInputStream.
 o encode(DerEncodeOutputStream)
Encodes this ASN1Object as a binary DER byte array and writes the result to the DerEncodeOutputStream.
 o getAsnType()
Returns the ASN.1 type of this ASN.1 object.
 o getComponentAt(int)
Returns the ASN1Object at index if the ASN1Object is a SEQUENCE or a SET.
 o getValue()
Returns the value of this ASN1Object.
 o indefiniteLength()
Returns wether the length of this ASN1Object uses indefinite encoding.
 o isA(ASN)
Tests if this object is an instance of given ASN.1 type.
 o isConstructed()
Returns wether this ASN1Object is constructed or primitive.
 o setValue(Object)
Sets the value of this ASN1Object.
 o toString()
Returns a string that represents the contents of this ASN1Object.

Variables

 o asnType
 protected ASN asnType
The ASN.1 type of this ASN.1 object.

Constructors

 o ASN1Object
 public ASN1Object()

Methods

 o getAsnType
 public ASN getAsnType()
Returns the ASN.1 type of this ASN.1 object.

Returns:
the ASN.1 type of this ASN.1 object
 o indefiniteLength
 public boolean indefiniteLength()
Returns wether the length of this ASN1Object uses indefinite encoding.

Returns:
true, if indefinite length is used for encoding, false otherwise
 o isConstructed
 public boolean isConstructed()
Returns wether this ASN1Object is constructed or primitive.

Returns:
true, if constructed, false otherwise
 o isA
 public boolean isA(ASN type)
Tests if this object is an instance of given ASN.1 type.

 o getComponentAt
 public ASN1Object getComponentAt(int index) throws CodingException
Returns the ASN1Object at index if the ASN1Object is a SEQUENCE or a SET.

Parameters:
index - position in the sequence
Returns:
the ASN1Object at this position
Throws: CodingException
if this ASN1Object does not support getComponentAt(int) or to indicate that the index is illegal
 o countComponents
 public int countComponents() throws CodingException
Returns the number of components in this ASN1Object. Only useful with a SEQUENCE or a SET.

Returns:
the number of components in this ASN1Object
Throws: CodingException
if this ASN1Object does not support countComponents()
 o getValue
 public abstract Object getValue()
Returns the value of this ASN1Object. Implemented by the subclass.

 o setValue
 public abstract void setValue(Object object)
Sets the value of this ASN1Object. Implemented by the subclass.

 o encode
 protected abstract void encode(DerEncodeOutputStream os)
Encodes this ASN1Object as a binary DER byte array and writes the result to the DerEncodeOutputStream. Implemented by the subclass.

 o decode
 protected abstract void decode(int tag,
                                int length,
                                DerDecodeInputStream is) throws CodingException, IOException
Decodes an ASN1Object by reading the encoding from a DerDecodeInputStream. Implemented by the subclass.

Parameters:
tag - the tag read from is
length - the already decoded length of this ASN1Object
is - the InputStream with the encoded ASN1Object
Throws: CodingException
if the ASN1Object can not be decoded
Throws: IOException
if there is a problem with the InputStream
 o toString
 public String toString()
Returns a string that represents the contents of this ASN1Object. All subclasses use this method for a common output form.

Returns:
the string representation
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index