All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.asn1.structures.ChoiceOfTime

java.lang.Object
   |
   +----iaik.asn1.structures.ChoiceOfTime

public class ChoiceOfTime
extends Object
This class represents the ASN.1 structure "ChoiceOfTime".

 ChoiceOfTime ::= CHOICE {
       utcTime        UTCTime,
       generalTime    GeneralizedTime }
 

This class handles both possible rules to encode a date. The encoding format depends on the following rules:

Till year 2005 the date is encoded as UTCTime. After 2005 the date is encoded as GeneralizedTime.

The encoding format can also be controlled using the method: @see setEncodingType().


Constructor Index

 o ChoiceOfTime(ASN1Object)
Creates a new ChoiceOfTime from an ASN1Object.
 o ChoiceOfTime(Date)
Creates a new ChoiceOfTime from an Date.
 o ChoiceOfTime(String, ASN)
Constructor for a String containing the date.

Method Index

 o getDate()
Returns the date.
 o getEncodingType()
Returns the encoding type.
 o setEncodingType(ASN)
Sets the encoding type.
 o toASN1Object()
Returns the value of this object as an ASN1Object.
 o toString()
Returns a string that represents the contents of the extensions.

Constructors

 o ChoiceOfTime
 public ChoiceOfTime(Date date)
Creates a new ChoiceOfTime from an Date.

Parameters:
date - the desired date
 o ChoiceOfTime
 public ChoiceOfTime(ASN1Object obj) throws CodingException
Creates a new ChoiceOfTime from an ASN1Object.

Parameters:
obj - the date as ASN1Object
Throws: CodingException
if the ASN1Object could not be parsed
 o ChoiceOfTime
 public ChoiceOfTime(String date,
                     ASN encodingType) throws ParseException
Constructor for a String containing the date.

Parameters:
date - the string containing the date
encodingType - the encoding type
Throws: ParseException
if the format of the date is not correct

Methods

 o toASN1Object
 public ASN1Object toASN1Object()
Returns the value of this object as an ASN1Object. The ASN.1 type used to encode the date is specified through encodingType.

Returns:
the value of this object as an ASN1Object
 o getEncodingType
 public ASN getEncodingType()
Returns the encoding type.

Returns:
the encoding type
 o setEncodingType
 public void setEncodingType(ASN encodingType)
Sets the encoding type.

Parameters:
encodingType - the encoding type
 o getDate
 public Date getDate()
Returns the date.

Returns:
the date
 o toString
 public String toString()
Returns a string that represents the contents of the extensions.

Returns:
the string representation
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index