Top Description Fields Constructors Methods
sun.security.timestamp

public Class TSRequest

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.security.MessageDigest, .NoSuchAlgorithmException, java.security.cert.X509Extension, sun.security.util.DerValue, .DerOutputStream, .ObjectIdentifier, sun.security.x509.AlgorithmId

This class provides a timestamp request, as defined in RFC 3161. The TimeStampReq ASN.1 type has the following definition:

    TimeStampReq ::= SEQUENCE {
        version           INTEGER { v1(1) },
        messageImprint    MessageImprint
          -- a hash algorithm OID and the hash value of the data to be
          -- time-stamped.
        reqPolicy         TSAPolicyId    OPTIONAL,
        nonce             INTEGER        OPTIONAL,
        certReq           BOOLEAN        DEFAULT FALSE,
        extensions        [0] IMPLICIT Extensions OPTIONAL }

    MessageImprint ::= SEQUENCE {
        hashAlgorithm     AlgorithmIdentifier,
        hashedMessage     OCTET STRING }

    TSAPolicyId ::= OBJECT IDENTIFIER

Author
Vincent Ryan
Since
1.5
See Also
Timestamper

Field Summary

Modifier and TypeField and Description
private X509Extension[]
private final AlgorithmId
private final byte[]
private BigInteger
private String
private boolean
private int

Constructor Summary

AccessConstructor and Description
public
TSRequest(String tSAPolicyID, byte[]
The data to be timestamped.
toBeTimeStamped
,
MessageDigest
The MessageDigest of the hash algorithm to use.
messageDigest
)

Constructs a timestamp request for the supplied data.

Method Summary

Modifier and TypeMethod and Description
public byte[]
public byte[]
public void
requestCertificate(boolean
True if the TSA should return its signing certificate. By default, it is not returned.
returnCertificate
)

Request that the TSA include its signing certificate in the response.

public void
setExtensions(X509Extension[]
The protocol extensions.
extensions
)

Sets the Time-Stamp Protocol extensions.

public void
setNonce(BigInteger
The nonce value.
nonce
)

Sets a nonce.

public void
setPolicyId(String
The policy object identifier.
policyId
)

Sets an object identifier for the Time-Stamp Protocol policy.

public void
setVersion(int
The TSP version.
version
)

Sets the Time-Stamp Protocol version.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extensionsback to summary
private X509Extension[] extensions
hashAlgorithmIdback to summary
private final AlgorithmId hashAlgorithmId
hashValueback to summary
private final byte[] hashValue
nonceback to summary
private BigInteger nonce
policyIdback to summary
private String policyId
returnCertificateback to summary
private boolean returnCertificate
versionback to summary
private int version

Constructor Detail

TSRequestback to summary
public TSRequest(String tSAPolicyID, byte[] toBeTimeStamped, MessageDigest messageDigest) throws NoSuchAlgorithmException

Constructs a timestamp request for the supplied data.

Parameters
toBeTimeStamped:byte[]

The data to be timestamped.

messageDigest:MessageDigest

The MessageDigest of the hash algorithm to use.

Exceptions
NoSuchAlgorithmException:
if the hash algorithm is not supported

Method Detail

encodeback to summary
public byte[] encode() throws IOException
getHashedMessageback to summary
public byte[] getHashedMessage()
requestCertificateback to summary
public void requestCertificate(boolean returnCertificate)

Request that the TSA include its signing certificate in the response.

Parameters
returnCertificate:boolean

True if the TSA should return its signing certificate. By default, it is not returned.

setExtensionsback to summary
public void setExtensions(X509Extension[] extensions)

Sets the Time-Stamp Protocol extensions.

Parameters
extensions:X509Extension[]

The protocol extensions.

setNonceback to summary
public void setNonce(BigInteger nonce)

Sets a nonce. A nonce is a single-use random number.

Parameters
nonce:BigInteger

The nonce value.

setPolicyIdback to summary
public void setPolicyId(String policyId)

Sets an object identifier for the Time-Stamp Protocol policy.

Parameters
policyId:String

The policy object identifier.

setVersionback to summary
public void setVersion(int version)

Sets the Time-Stamp Protocol version.

Parameters
version:int

The TSP version.