iaik.asn1
Class SEQUENCE

java.lang.Object
  |
  +--iaik.asn1.ASN1Object
        |
        +--iaik.asn1.ConstructedType
              |
              +--iaik.asn1.SEQUENCE
All Implemented Interfaces:
Cloneable

public class SEQUENCE
extends ConstructedType

This class implements the ASN.1 native type "SEQUENCE". SEQUENCE is a structered ASN.1 type identified by the UNIVERSAL TAG number 16. An ASN.1 SEQUENCE object is composed of several ordered components. All the components may have the same type or may have different types.

A SEQUENCE object is DER encoded using the constructed encoding practice by splitting it into separately encoded components. Therefore the SEQUENCE class is extended to be a subclass of the ConstructedType class. Each component can be added to the current SEQUENCE object by using a proper addComponent method of the ConstructedType super class.

The constructed form can be recognized by bit 6 of the (first) identifier octet(s) of the DER encoded bit stream, which is set to 1.

When creating a new SEQUENCE object, explicitly may be specified to use indefinite length encoding instead of definite length encodíng. Indefinite length encoding is recognized by a length tag of (hexadecimal) 0x80, and the content octets are concluded by two consecutive octets of all zeros:

 0x30 0x80
           ...
           -- content octets
           ...
 0x00 0x00 -- EOC octets
 
instead of explicitly specifying the number of content octets (definite length encoding):
 0x30 0x07 ... -- seven content octets ...
 
Indefinite length encoding may be preferable when the actual number of content octets is not known at the beginning of the data transfer.

When using indefinite length encoding, the encodeTo method of the DerCoder class shall be used instead of the encode method, in particular when dealing with large amounts of data.

The following example creates a new SEQUENCE object and adds an INTERGER, BOOLEAN, and a PrintableString component:

 SEQUENCE seq = new SEQUENCE();
 seq.addComponent(new INTEGER(3));
 seq.addComponent(new BOOLEAN(true));
 seq.addComponent(new PrintableString("Test"));
 
Of course, sequences may be nested meaning that one SEQUENCE contains another SEQUENCE as one of its components. The nesting may be of any depth.

Version:
File Revision 15
See Also:
ASN1Object, ASN, ConstructedType, ConstructedType.addComponent(iaik.asn1.ASN1Object)

Fields inherited from class iaik.asn1.ConstructedType
content_count, content_data
 
Fields inherited from class iaik.asn1.ASN1Object
asnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode
 
Constructor Summary
SEQUENCE()
          Creates a new SEQUENCE.
SEQUENCE(boolean indefiniteLength)
          Creates a new SEQUENCE and defines the length encoding method to be used.
 
Method Summary
 String toString()
          Returns a String that represents the value of this SEQUENCE.
 
Methods inherited from class iaik.asn1.ConstructedType
addComponent, addComponent, addEncodeListener, clone, countComponents, decode, encode, getComponentAt, getComponents, getValue, removeComponent, removeComponent, setComponent, setValue
 
Methods inherited from class iaik.asn1.ASN1Object
addEncodeListener, encodeObject, getAsnType, indefiniteLength, isA, isConstructed, isStringType, setIndefiniteLength
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SEQUENCE

public SEQUENCE()
Creates a new SEQUENCE.

Components may be added by means of the addComponent method of the ConstructedType super class. Length encoding will be definite.


SEQUENCE

public SEQUENCE(boolean indefiniteLength)
Creates a new SEQUENCE and defines the length encoding method to be used.

Components may be added by means of the addComponent method of the ConstructedType super class. If indefiniteLength is set to true, the indefinte length method will be used when actually DER encoding this SEQUENCE, otherwise the definite length encoding method will be used.

Parameters:
indefiniteLength - whether to use definite or indefinte length encoding when DER encoding this SEQUENCE
Method Detail

toString

public String toString()
Returns a String that represents the value of this SEQUENCE.
Overrides:
toString in class ASN1Object
Returns:
the String representation
See Also:
ASN1Object.toString()

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK