IAIK TSP
version 2.01

iaik.tsp
Class PKIFreeText

java.lang.Object
  extended byiaik.tsp.PKIFreeText

public class PKIFreeText
extends Object

This class implements the TSP ASN.1 type PKIFreeText as it is specified in RFC 3161.

 PKIFreeText ::= SEQUENCE {
     SIZE (1..MAX) OF UTF8String
     -- text encoded as UTF-8 String (note: each UTF8String SHOULD
     -- include an RFC 1766 language tag to indicate the language -- of the contained text)
 }
 

This class handles the ASN.1 structure and the DER encoding and decoding of this structure.


Constructor Summary
PKIFreeText(iaik.asn1.ASN1Object component)
          This constructor tries to reconstruct a PKIFreeText object from the given ASN.1 structure.
PKIFreeText(String text)
          To construct a new PKIFreeText object with the given String.
 
Method Summary
 void addString(String text)
          This method adds a new string to the end of the structure.
 byte[] getEncoded()
          This method DER encodes the ASN.1 PKIFreeText object.
 int getSize()
          Returns the number of string elements.
 String getStringAt(int position)
          This method returns the string at the specified index.
 void setStringAt(String text, int position)
          This method sets a string at the specified index.
 iaik.asn1.ASN1Object toASN1Object()
          Returns the ASN.1 structure of the PKIFreeText object.
 String toString()
          This method returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PKIFreeText

public PKIFreeText(String text)
            throws NullPointerException
To construct a new PKIFreeText object with the given String.

Parameters:
text - A message string.
Throws:
NullPointerException - Thrown if the argument is null.

PKIFreeText

public PKIFreeText(iaik.asn1.ASN1Object component)
            throws iaik.asn1.CodingException
This constructor tries to reconstruct a PKIFreeText object from the given ASN.1 structure.

Parameters:
component - The ASN.1 structure.
Throws:
iaik.asn1.CodingException - Thrown if the given ASN1Object is not a PKIFreeText ASN.1 object.
Method Detail

getEncoded

public byte[] getEncoded()
This method DER encodes the ASN.1 PKIFreeText object.

Returns:
DER encoded PKIFreeText object.

toASN1Object

public iaik.asn1.ASN1Object toASN1Object()
Returns the ASN.1 structure of the PKIFreeText object.

Returns:
ASN1Object of the PKIFreeText object.

addString

public void addString(String text)
This method adds a new string to the end of the structure.

Parameters:
text - Text to be added.

setStringAt

public void setStringAt(String text,
                        int position)
                 throws ArrayIndexOutOfBoundsException
This method sets a string at the specified index. This method overwrites an existing text string. To add a new string you must use the addString method.

Parameters:
text - Text to be set.
position - Position of the text.
Throws:
ArrayIndexOutOfBoundsException - Thrown if the index is invalid.

getSize

public int getSize()
Returns the number of string elements.

Returns:
The number of the string elements.

getStringAt

public String getStringAt(int position)
                   throws ArrayIndexOutOfBoundsException
This method returns the string at the specified index.

Parameters:
position - The position of the desired text.
Returns:
The string at the specified index
Throws:
ArrayIndexOutOfBoundsException - Thrown if the index is invalid.

toString

public String toString()
This method returns a string representation of this object.

Returns:
A string representing the PKIFreeText object.

This Javadoc may contain text parts from IETF Internet Standard specifications (see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note).

IAIK TSP, © 2002-2004 IAIK, © 2004 Stiftung SIC