com.ibm.security.pkcs9
Class SigningTime

java.lang.Object
  |
  +--com.ibm.security.pkcsutil.PKCSDerObject
        |
        +--com.ibm.security.pkcs9.PKCS9DerObject
              |
              +--com.ibm.security.pkcs9.SigningTime

public final class SigningTime
extends PKCS9DerObject
implements Cloneable

Implements the ASN.1 SigningTime attribute type.

The SigningTime object indicates when the signer reportedly performed the signing process. This object is is used with the SignedData object as a signed attribute.

A SigningTime attribute must have a single attribute value.

SigningTime ::= Time Time ::= CHOICE { utcTime UTCTime, generalizedTime GeneralizedTime }

SigningTime objects are immutable; they cannot be changed once created.


Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
SigningTime(byte[] der)
          Create a SigningTime object with a DER byte array.
SigningTime(byte[] der, String provider)
          Create a SigningTime object with a DER byte array.
SigningTime(Date date)
          Create a SigningTime object with a Date object.
SigningTime(Date date, boolean bUTCTime)
          Create a SigningTime object with a Date object and flag to indicate if the date should be encoded as UTCTime or GeneralizedTime.
SigningTime(Date date, boolean bUTCTime, String provider)
          Create a SigningTime object with a Date object and flag to indicate if the date should be encoded as UTCTime or GeneralizedTime.
SigningTime(Date date, String provider)
          Create a SigningTime object with a Date object.
SigningTime(String filename, boolean base64)
          Create a SigningTime with the filename of the DER-encoded or BASE64-encoded object.
SigningTime(String filename, boolean base64, String provider)
          Create a SigningTime with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this SigningTime object.
protected  void decode(com.ibm.security.pkcs9.DerValue encoding)
          Initializes a SigningTime object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object obj)
          Determines if this SigningTime object is equivalent to the input object.
 String getAttributeName()
          Returns a String indicating the name of the attribute.
 Date getDate()
          Returns a copy of the date of this SigningTime object.
 ObjectIdentifier getObjectIdentifier()
          Returns the ObjectIdentifer for the SigningTime attribute.
 Object getValue()
          Calls the getDate method.
 boolean isSingleValued()
          Returns true.
 boolean isTagValid(byte tag)
          Returns a boolean indicating if the tag is valid for this object.
 String toString()
          Returns a string representation of this SigningTime object.
 
Methods inherited from class com.ibm.security.pkcs9.PKCS9DerObject
getName, getOID, getPKCSAttribute
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
decode, decode, encode, hashCode, read, readBASE64, write, write, writeBASE64
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SigningTime

public SigningTime(byte[] der)
            throws IOException
Create a SigningTime object with a DER byte array.
Parameters:
der - a DER byte array of a SigningTime object.
Throws:
IOException - on decoding errors.

SigningTime

public SigningTime(byte[] der,
                   String provider)
            throws IOException
Create a SigningTime object with a DER byte array.
Parameters:
der - a DER byte array of a SigningTime object.
provider - the provider to be used.
Throws:
IOException - on decoding errors.

SigningTime

public SigningTime(Date date)
Create a SigningTime object with a Date object. The date format defaults to UTCTime.
Parameters:
date - a Date object

SigningTime

public SigningTime(Date date,
                   String provider)
Create a SigningTime object with a Date object. The date format defaults to UTCTime.
Parameters:
date - a Date object
provider - the provider to be used

SigningTime

public SigningTime(Date date,
                   boolean bUTCTime)
Create a SigningTime object with a Date object and flag to indicate if the date should be encoded as UTCTime or GeneralizedTime.
Parameters:
date - a Date object
bUTCTime - true if date should be encoded as UTCTime, false if date should be stored as GeneralizedTime.

SigningTime

public SigningTime(Date date,
                   boolean bUTCTime,
                   String provider)
Create a SigningTime object with a Date object and flag to indicate if the date should be encoded as UTCTime or GeneralizedTime.
Parameters:
date - a Date object
bUTCTime - true if date should be encoded as UTCTime, false if date should be stored as GeneralizedTime.
provider - the provider to be used

SigningTime

public SigningTime(String filename,
                   boolean base64)
            throws IOException
Create a SigningTime with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
Throws:
IOException - on decoding errors.

SigningTime

public SigningTime(String filename,
                   boolean base64,
                   String provider)
            throws IOException
Create a SigningTime with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
provider - the provider to be used
Throws:
IOException - on decoding errors.
Method Detail

clone

public Object clone()
Creates a clone of this SigningTime object.
Overrides:
clone in class Object
Returns:
clone of this SigningTime object.

equals

public boolean equals(Object obj)
Determines if this SigningTime object is equivalent to the input object.
Overrides:
equals in class PKCSDerObject
Parameters:
other - the object to compare this one to.
Returns:
true, if the two objects are equivalent, false otherwise.

getObjectIdentifier

public ObjectIdentifier getObjectIdentifier()
Returns the ObjectIdentifer for the SigningTime attribute.
Overrides:
getObjectIdentifier in class PKCSDerObject
Returns:
the ObjectIdentifer for the SigningTime attribute.

encode

public void encode(OutputStream os)
            throws IOException
Encodes this object to an OutputStream. The SigningTime object is encoded as a UTCTime or GeneralizedTime depending upon the bUTCTime attribute value.
Overrides:
encode in class PKCSDerObject
Parameters:
os - the OutputStream to write the encoded data to.
Throws:
IOException - on encoding errors.

getDate

public Date getDate()
Returns a copy of the date of this SigningTime object.
Returns:
Date object stored with this SigningTime object.

getValue

public Object getValue()
Calls the getDate method. Standard method to access the value of the PKCS #9 object.
Overrides:
getValue in class PKCS9DerObject

isTagValid

public boolean isTagValid(byte tag)
Returns a boolean indicating if the tag is valid for this object.
Overrides:
isTagValid in class PKCS9DerObject
Returns:
true if tag_UtcTime or tag_GeneralizedTime, false otherwise.

isSingleValued

public boolean isSingleValued()
Returns true. SigningTime must have a single attribute value.
Overrides:
isSingleValued in class PKCS9DerObject
Returns:
true

getAttributeName

public String getAttributeName()
Returns a String indicating the name of the attribute.
Overrides:
getAttributeName in class PKCS9DerObject
Returns:
name of the SigningTime attribute.

toString

public String toString()
Returns a string representation of this SigningTime object.
Overrides:
toString in class PKCSDerObject
Returns:
a string representation of this object.

decode

protected void decode(com.ibm.security.pkcs9.DerValue encoding)
               throws IOException
Initializes a SigningTime object from a DerValue. The DER encoding must be in the format specified by the SigningTime ASN.1 notation. The bUTCTime flag on the SigningTime object is set according to the DER encoding tag.
Overrides:
decode in class PKCS9DerObject
Parameters:
encoding - a DER-encoded SigningTime object.
Throws:
IOException - on parsing error.