FileDocCategorySizeDatePackage
Timestamp.javaAPI DocJava SE 5 API3572Fri Aug 26 14:57:16 BST 2005java.security

Timestamp

public final class Timestamp extends Object implements Serializable
This class encapsulates information about a signed timestamp. It is immutable. It includes the timestamp's date and time as well as information about the Timestamping Authority (TSA) which generated and signed the timestamp.
since
1.5
version
1.2, 12/19/03
author
Vincent Ryan

Fields Summary
private static final long
serialVersionUID
private Date
timestamp
The timestamp's date and time
private CertPath
signerCertPath
The TSA's certificate path.
private transient int
myhash
Constructors Summary
public Timestamp(Date timestamp, CertPath signerCertPath)
Constructs a Timestamp.

param
timestamp is the timestamp's date and time. It must not be null.
param
signerCertPath is the TSA's certificate path. It must not be null.
throws
NullPointerException if timestamp or signerCertPath is null.


                                             
         
	if (timestamp == null || signerCertPath == null) {
	    throw new NullPointerException();
	}
	this.timestamp = new Date(timestamp.getTime()); // clone
	this.signerCertPath = signerCertPath;
    
Methods Summary
public booleanequals(java.lang.Object obj)
Tests for equality between the specified object and this timestamp. Two timestamps are considered equal if the date and time of their timestamp's and their signer's certificate paths are equal.

param
obj the object to test for equality with this timestamp.
return
true if the timestamp are considered equal, false otherwise.

	if (obj == null || (!(obj instanceof Timestamp))) {
	    return false;
	}
	Timestamp that = (Timestamp)obj;

	if (this == that) {
	    return true;
	}
	return (timestamp.equals(that.getTimestamp()) &&
	    signerCertPath.equals(that.getSignerCertPath()));
    
public java.security.cert.CertPathgetSignerCertPath()
Returns the certificate path for the Timestamping Authority.

return
The TSA's certificate path.

	return signerCertPath;
    
public java.util.DategetTimestamp()
Returns the date and time when the timestamp was generated.

return
The timestamp's date and time.

	return new Date(timestamp.getTime()); // clone
    
public inthashCode()
Returns the hash code value for this timestamp. The hash code is generated using the date and time of the timestamp and the TSA's certificate path.

return
a hash code value for this timestamp.

	if (myhash == -1) {
	    myhash = timestamp.hashCode() + signerCertPath.hashCode();
	}
	return myhash;
    
public java.lang.StringtoString()
Returns a string describing this timestamp.

return
A string comprising the date and time of the timestamp and its signer's certificate.

	StringBuffer sb = new StringBuffer();
	sb.append("(");
	sb.append("timestamp: " + timestamp);
	sb.append("TSA: " + signerCertPath.getCertificates().get(0));
	sb.append(")");
	return sb.toString();