public class TimeStampReq extends java.lang.Object implements ASN1Type
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
}
TSAPolicyId ::= OBJECT IDENTIFIER
The messageImprint field SHOULD contain the hash of the datum to be time-stamped. The hash is represented as an OCTET STRING.
The reqPolicy field, if included, indicates the TSA policy under which the TimeStampToken SHOULD be provided.
The nonce, if included, allows the client to verify the timeliness of the response when no local clock is available. The nonce is a large random number with a high probability that the client generates it only once (e.g., a 64 bit integer). In such a case the same nonce value MUST be included in the response, otherwise the response shall be rejected.
If the certReq field is present and set to true, the TSA's public key certificate that is referenced by the ESSCertID identifier inside a SigningCertificate attribute in the response MUST be provided by the TSA in the certificates field from the SignedData structure in that response. That field may also contain other certificates.
If the certReq field is missing or if the certReq field is present and set to false then the certificates field from the SignedData structure MUST not be present in the response.
The extensions field is a generic way to add additional information to the request in the future. Extensions is defined in [RFC 3280]. If an extension, whether it is marked critical or not critical, is used by a requester but is not recognized by a time-stamping server, the server SHALL not issue a token and SHALL return a failure (unacceptedExtension).
The time-stamp request does not identify the requester, as this information is not validated by the TSA. In situations where the TSA requires the identity of the requesting entity, alternate identification/authentication means have to be used (e.g., CMS encapsulation or TLS authentication).
| Constructor and Description |
|---|
TimeStampReq(ASN1Object obj)
Creates a new
TimeStampReq object from an
ASN1Object. |
TimeStampReq(MessageImprint messageImprint)
Creates a new
TimeStampReq object with the specified
components. |
| Modifier and Type | Method and Description |
|---|---|
void |
addExtension(V3Extension extension)
Adds additional information about the request.
|
void |
decode(ASN1Object obj)
Decodes a TimeStampReq object from an
ASN1Object. |
V3Extension |
getExtension(ObjectID oid)
Returns a specific piece of addition information about the request,
identified by the extension object identifier.
|
X509Extensions |
getExtensions()
Returns additional information about the request.
|
MessageImprint |
getMessageImprint()
Returns the hash of the datum to be time-stamped.
|
java.math.BigInteger |
getNonce()
Indicates if a nonce has been requested.
|
ObjectID |
getReqPolicy()
Returns the TSA request policy.
|
int |
getVersion()
Returns the version of the TimeStampReq structure.
|
boolean |
isCertReq()
Indicates whether the TSA must provide their certificate in the response.
|
void |
setCertReq(java.lang.Boolean certReq)
Sets an indicator for whether the TSA must provide their certificate in
the response.
|
void |
setExtensions(X509Extensions extensions)
Sets additional information about the request.
|
void |
setNonce(java.math.BigInteger nonce)
Sets the request nonce.
|
void |
setReqPolicy(ObjectID reqPolicy)
Sets the TSA request policy.
|
ASN1Object |
toASN1Object()
Encodes this
TimeStampReq object as an ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
TimeStampReq object. |
public TimeStampReq(MessageImprint messageImprint)
TimeStampReq object with the specified
components.messageImprint - the hash of the datum to be time-stampedjava.lang.IllegalArgumentException - thrown if the parameter is nullpublic TimeStampReq(ASN1Object obj) throws CodingException
TimeStampReq object from an
ASN1Object.
The ASN1Object must be a TimeStampReq structure.
obj - the ASN.1 representation of a TimeStampReq structureCodingException - thrown if an errors occurs while decoding the ANS1Objectjava.lang.IllegalArgumentException - thrown if the parameter is nullpublic int getVersion()
public MessageImprint getMessageImprint()
public ObjectID getReqPolicy()
null if the reqPolicy component
is not setpublic java.math.BigInteger getNonce()
null if the nonce component is not
setpublic boolean isCertReq()
false if the certReq component
was not setpublic X509Extensions getExtensions()
null if the tsa component is
not setpublic V3Extension getExtension(ObjectID oid) throws X509ExtensionInitException
null if the
requested extension does not exist in the extensions componentX509ExtensionInitException - if there is a problem with the extensionpublic void setReqPolicy(ObjectID reqPolicy)
reqPolicy - the reqPolicy componentpublic void setNonce(java.math.BigInteger nonce)
nonce - the nonce componentpublic void setCertReq(java.lang.Boolean certReq)
certReq - the certReq componentpublic void setExtensions(X509Extensions extensions)
extensions - the extensions componentpublic void addExtension(V3Extension extension) throws X509ExtensionException
extension - an extensionX509ExtensionExceptionpublic void decode(ASN1Object obj) throws CodingException
ASN1Object.
The ASN1Object must contain a TimeStampReq structure.
decode in interface ASN1Typeobj - an ASN.1 representation of a TimeStampReq structureCodingException - thrown if an errors occurs while decoding the ANS1Objectjava.lang.IllegalArgumentException - thrown if the parameter is nullpublic ASN1Object toASN1Object() throws CodingException
TimeStampReq object as an ASN1Object.toASN1Object in interface ASN1TypeCodingException - thrown if an error occurs while encoding the 'extensions' componentpublic java.lang.String toString()
TimeStampReq object.toString in class java.lang.Object