org.webdocwf.util.smime.der
Class DERObject

java.lang.Object
  |
  +--org.webdocwf.util.smime.der.DERObject
Direct Known Subclasses:
DERBitString, DERBoolean, DERClassContextSpecificPr, DERIA5String, DERInteger, DERNull, DERObjectIdentifier, DEROctetString, DERPrintableString, DERSequencePr, DERSetPr, DERUTCTime

public class DERObject
extends java.lang.Object

Every element of data represented in ASN.1 notation should be encoded in the process of implementation. It can be done according to BER (Basic Encoding Rules) or according to DER (Distinguish Encoding Rules). DERObject class is the root class (super class) of all classes used in DER encodings of variety elements in data structures used by SMIME.

DER encoding of elements can be performed in two forms: definite form and indefinite form. DERObject class represents definite form of encoding. Every encoded element, according to this rules, involves three parts: Identifier Octet (which represents Tag Type of the encoding data), Length Octets (one or more octets with the information about number of octets (bytes) in the content), and Content Octets (they represent data which have to be DER encoded).

DERObject can be structured or primitive, which depends on his content.


Constructor Summary
DERObject(int identifierOctet0)
          Creates DER Object with defined value for identifier octet.
DERObject(int identifierOctet0, byte[] content0)
          Creates DER Object with defined value for identifier octet and values of content octets
 
Method Summary
 byte[] getContentOctets()
          Return content octets part from DER object.
 int getContentPartSize()
          Returns size of content part in DER object (Number of content octets).
 byte[] getDEREncoded()
          Returns DER encoded object
 int getIdentifierOctet()
          Returns Identifier Octet
 byte[] getLengthOctets()
          Return length octets part from DER object.
 int getLengthPartSize()
          Returns size of length part in DER object (Number of length octets).
 int getTagClassType()
          Returns Class Type
 int getTagComplexity()
          Returns Tag Complexity
 int getTagTypeNumber()
          Returns Tag Type
 int getTotalSize()
          Returns total length of DER object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DERObject

public DERObject(int identifierOctet0)
          throws SMIMEException
Creates DER Object with defined value for identifier octet.
Parameters:
identifierOctet0 - must be in the range 0-255 (whithouth 31)
Throws:
SMIMEException - in case of invalid identifierOctet0 parameter

DERObject

public DERObject(int identifierOctet0,
                 byte[] content0)
          throws SMIMEException
Creates DER Object with defined value for identifier octet and values of content octets
Parameters:
identifierOctet0 - must be in the range 0-255 (whithouth 31)
content0 - content of DER Object
Throws:
SMIMEException - in case of invalid identifierOctet0 parameter, or in case of adding content to DER object of type Null DER object
Method Detail

getDEREncoded

public byte[] getDEREncoded()
                     throws SMIMEException
Returns DER encoded object
Returns:
DERObject as byte array
Throws:
SMIMEException - if content of DER object is absent. Also, it can be caused by non SMIMEException which is: UnsupportedEncodingException.

getIdentifierOctet

public int getIdentifierOctet()
Returns Identifier Octet
Returns:
Identifier Octet in the range 0-255

getTagTypeNumber

public int getTagTypeNumber()
Returns Tag Type
Returns:
Tag Type in the range 0-30

getTagClassType

public int getTagClassType()
Returns Class Type
Returns:
0-Universal, 64-Application, 128-Context, 192-Private (Default 0)

getTagComplexity

public int getTagComplexity()
Returns Tag Complexity
Returns:
0-primitive, 32-structured (Default 0)

getContentPartSize

public int getContentPartSize()
Returns size of content part in DER object (Number of content octets).
Returns:
Number of content octets in DER encoded object

getLengthPartSize

public int getLengthPartSize()
Returns size of length part in DER object (Number of length octets).
Returns:
Number of length octets in DER encoded object

getContentOctets

public byte[] getContentOctets()
                        throws SMIMEException
Return content octets part from DER object.
Returns:
Number of content octets in DER encoded object
Throws:
SMIMEException - caused by non SMIMEException which is: UnsupportedEncodingException .

getLengthOctets

public byte[] getLengthOctets()
                       throws SMIMEException
Return length octets part from DER object.
Returns:
Number of length octets in DER encoded object
Throws:
SMIMEException - caused by non SMIMEException which is: UnsupportedEncodingException.

getTotalSize

public int getTotalSize()
Returns total length of DER object
Returns:
Total length of DER Object (involves identifier octet, length octets and content octets)


Copyright © 2002-2002 Together Teamlösungen. All Rights Reserved.