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().
- UTCTime
UTCTime values are expressed as Greenwich Mean Time (Zulu) and include
seconds (i.e., times are YYMMDDHHMMSSZ), even where the number of seconds
is zero.Conforming systems shall interpret the year field (YY) as follows:
- Where YY is greater than 50, the year shall be interpreted as 19YY; and
- Where YY is less than or equal to 50, the year shall be interpreted as 20YY.
- GeneralizedTime
GeneralizedTime values are expressed as Greenwich Mean Time (Zulu) and
include seconds (i.e.,times are YYYYMMDDHHMMSSZ), even where the number
of seconds is zero.GeneralizedTime values shall not include fractional seconds.
-
ChoiceOfTime(ASN1Object)
- Creates a new ChoiceOfTime from an ASN1Object.
-
ChoiceOfTime(Date)
- Creates a new ChoiceOfTime from an Date.
-
ChoiceOfTime(String, ASN)
- Constructor for a String containing the date.
-
getDate()
- Returns the date.
-
getEncodingType()
- Returns the encoding type.
-
setEncodingType(ASN)
- Sets the encoding type.
-
toASN1Object()
- Returns the value of this object as an ASN1Object.
-
toString()
- Returns a string that represents the contents of the extensions.
ChoiceOfTime
public ChoiceOfTime(Date date)
- Creates a new ChoiceOfTime from an Date.
- Parameters:
- date - the desired date
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
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
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
getEncodingType
public ASN getEncodingType()
- Returns the encoding type.
- Returns:
- the encoding type
setEncodingType
public void setEncodingType(ASN encodingType)
- Sets the encoding type.
- Parameters:
- encodingType - the encoding type
getDate
public Date getDate()
- Returns the date.
- Returns:
- the date
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