iaik.asn1
Class UNIString

java.lang.Object
  |
  +--iaik.asn1.ASN1Object
        |
        +--iaik.asn1.ASN1String
              |
              +--iaik.asn1.UNIString
All Implemented Interfaces:
Cloneable

public class UNIString
extends ASN1String

This class implements the native ASN.1 type "UniveralString". UNIString is a simple ASN.1 string type identified by the UNIVERSAL TAG number 28.

UniversalString is defined in ASN.1:1993.

When creating a new UNIString object the value to be represented has to be supplied as Java String type:

 String s = ...;
 UNIString uniString = new UNIString(s);
 
Attention: When supplying the string value to be represented, no check is performed if it actually is composed only of characters belonging to UniversalString character set! An application itself has to take care for supplying a proper UniversalString value.

When calling the getValue method for getting the inherent string value from an ASN.1 UNIString instance, a Java object of type String is returned:

 String s = (String)uniString.getValue();
 
DER en/decoding generally is done by means of the several methods of the DerCoder class; decoding alternatively may be performed by using the DerInputStream utility.

Attention! Since Java characters are UNICODE (16 bit), but UNIVERSAL STRING uses 32 bit, wrong (de)coding results may occur when charcaters occupy more than 16 bits!

Version:
File Revision 26
See Also:
ASN1Object, ASN

Fields inherited from class iaik.asn1.ASN1String
value
 
Fields inherited from class iaik.asn1.ASN1Object
asnType, constructed, encode_listener, indefinite_length, isStringType, stream_mode
 
Constructor Summary
protected UNIString()
          Creates an empty UNIString.
  UNIString(String value)
          Creates a new ASN.1 UNIString object for the given String value.
 
Method Summary
 Object getValue()
          Returns the value of this UNIString as a String object.
 void setValue(Object object)
          Sets the value of this UNIString.
 
Methods inherited from class iaik.asn1.ASN1String
clone, decode, encode, equals, hashCode, toString
 
Methods inherited from class iaik.asn1.ASN1Object
addComponent, addEncodeListener, countComponents, encodeObject, getAsnType, getComponentAt, indefiniteLength, isA, isConstructed, isStringType, setIndefiniteLength
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UNIString

protected UNIString()
Creates an empty UNIString.

UNIString

public UNIString(String value)
Creates a new ASN.1 UNIString object for the given String value.

Attention: No check is performed if the supplied String value actually is composed only of characters belonging to the UniversalString character set! An application itself has to take care for supplying a proper UniversalString value.

Parameters:
value - the String value this UNIString object should be initialized with
Method Detail

getValue

public Object getValue()
Returns the value of this UNIString as a String object.
Overrides:
getValue in class ASN1Object
Returns:
the value of this UNIString as a String object

setValue

public void setValue(Object object)
Sets the value of this UNIString.

The supplied value has to be a Java object of type String. Attention: No check is performed if the supplied String value actually is composed only of characters belonging to UniversalString character set! An application itself has to take care for supplying a proper UniversalString value.

Overrides:
setValue in class ASN1Object
Parameters:
object - the Java String value to be set for this UNIString

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