iaik.asn1
Class UNKNOWN

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

public class UNKNOWN
extends ConstructedType

This class is used to decode unknown PRIVATE or APPLICATION ASN.1 types.

This class only supports decoding facilities for properly handling any DER encoded ASN.1 objects with an unknown tag specification. No encoding mechanism are provided.

Whenever the DerCoder parses a tag it does not know of, it creates a UNKNOWN object and supplies it with the content octets read from the decoding. In this way, an application may ask for the pure content bytes by means of the getValue() method.

Version:
File Revision 22

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
UNKNOWN()
          Creates an empty UNKNOWN ASN.1 type.
 
Method Summary
 Object clone()
          Returns a clone of this UNKNOWN.
protected  void decode(int length, InputStream is)
          Decodes the value of an UMKNOWN ASN.1 object from the given input stream.
protected  void encode(OutputStream os)
          Not implemented.
 ASN getBaseAsnType()
          Returns the base ASN.1 type of this UNKNOWN ASN.1 object.
 Object getValue()
          Returns the value of this UNKNOWN ASN.1 object as a byte array.
 void setValue(Object object)
          Sets the value of this object to value.
 String toString()
          Returns a string that represents the contents of this UNKNOWN ASN.1 type.
 
Methods inherited from class iaik.asn1.ConstructedType
addComponent, addComponent, addEncodeListener, countComponents, getComponentAt, getComponents, removeComponent, removeComponent, setComponent
 
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

UNKNOWN

public UNKNOWN()
Creates an empty UNKNOWN ASN.1 type.
Method Detail

clone

public Object clone()
Returns a clone of this UNKNOWN.
Overrides:
clone in class ConstructedType
Returns:
a clone of this UNKNOWN

setValue

public void setValue(Object object)
Sets the value of this object to value.
Overrides:
setValue in class ConstructedType
Parameters:
value - the new value as a byte array

getValue

public Object getValue()
Returns the value of this UNKNOWN ASN.1 object as a byte array.
Overrides:
getValue in class ConstructedType
Returns:
the value of this UNKNOWN ASN.1 object

getBaseAsnType

public ASN getBaseAsnType()
Returns the base ASN.1 type of this UNKNOWN ASN.1 object.

This method may be used to query for the ASN.1 type (tag class and tag value) of the base ASN1Object this UNKNOWN represents. Note that the DerCoder creates an UNKNOWN object for any ASN.1 object it does not know of (i.e. has no registered implementation for the corresponding ASN.1 type). An UNKNOWN object is allocated the tag value 0 since it is not used in ASN.1 at all. Therefoe, when calling method getAsnType of an UNKNOWN object you anytime will get an ASN1 type representing tag class UNIVERSAL with tag number 0 (since this is the ASN.1 type of the UNKNOWN implementation). To get the ASN.1 type of the base ASN.1 object you may call this getBaseAsnType method.

Returns:
the ASN.1 type of the base ASN.1 object this UNKNOWN represents
See Also:
ASN

encode

protected void encode(OutputStream os)
Not implemented.
Overrides:
encode in class ConstructedType
Following copied from class: iaik.asn1.ConstructedType
Parameters:
os - the output stream to which to write the data
Throws:
IOException - if an error occurs while reading from the stream

decode

protected void decode(int length,
                      InputStream is)
               throws IOException
Decodes the value of an UMKNOWN ASN.1 object from the given input stream. An UNKNOWN ASN.1 object is an ASN.1 object of unknown tag. When during the decoding procedure the DerCoder parses a tag it does not know of, it creates an UNKNOWN object and uses this decode method for reading the raw content octets from the decoding stream.
Overrides:
decode in class ConstructedType
Parameters:
length - the already decoded length, i.e. number of the bytes occupied by the value of the UNKNOWN ASN.1 object to be decoded
is - the input stream from which the der encoded data is read in
Throws:
IOException - if there is a problem with the InputStream

toString

public String toString()
Returns a string that represents the contents of this UNKNOWN ASN.1 type.
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