Creates a new TimeStampReq instance.
Configuration object for the timestamp request
Optional
certReq?: booleanWhether to request the TSA certificate
Optional
extensions?: Extension[]Optional request extensions
Hash imprint of the data to timestamp
Optional
nonce?: Uint8Array<ArrayBufferLike>Optional nonce for replay protection
Optional
reqPolicy?: ObjectIdentifierStringOptional TSA policy OID
Optional
version?: numberProtocol version, defaults to 1
Whether to include the TSA certificate in the response
Optional
extensionsOptional extensions for additional functionality
Hash of the data to be timestamped
Optional
nonceOptional nonce for replay protection, should be unique per request
Optional
reqOptional TSA policy identifier specifying how the timestamp should be created
Version of the TSA request format, currently always 1
Gets the PEM header name for this object type. Converts the class name to uppercase for use in PEM encoding.
Gets the PKI type name for this object (typically the class name). Used for PEM headers and debugging output.
Compares this PKI object with another for equality. Two objects are considered equal if their DER encodings are identical.
The other PKI object to compare with
true if the objects are equal, false otherwise
Parses this object as a different PKI type. Useful for converting between related PKI structures.
The target type to parse as
The target type constructor with parsing capabilities
A new instance of the target type
Sends the timestamp request to a Time Stamping Authority (TSA).
This method handles the HTTP protocol for communicating with RFC 3161 compliant TSA servers. It sends the request as application/timestamp-query and expects an application/timestamp-reply response.
Request configuration
Optional
otherRequestOptions?: RequestInitAdditional fetch options
Optional
password?: stringOptional basic auth password
Optional
timeout?: numberOptional request timeout in milliseconds
TSA server URL
Optional
username?: stringOptional basic auth username
Promise resolving to the timestamp response
// Simple request to public TSA
const response = await tsReq.request({
url: 'http://timestamp.digicert.com'
})
// Authenticated request with timeout
const response = await tsReq.request({
url: 'https://tsa.example.com/tsa',
username: 'user',
password: 'pass',
timeout: 30000
})
if (response.status.status === 0) { // Granted
console.log('Timestamp obtained:', response.timeStampToken)
} else {
console.error('Timestamp request failed:', response.status.failInfo)
}
Converts the TimeStampReq to its ASN.1 representation.
Creates a SEQUENCE containing all the request fields in the proper order according to RFC 3161 specification.
ASN.1 structure representing the timestamp request
Converts this PKI object to DER (Distinguished Encoding Rules) format.
The DER-encoded bytes of this object
Returns a human-readable string representation of this object. By default, returns the same as toString(), but subclasses can override for more user-friendly output.
A human-readable string representation
Converts this PKI object to PEM (Privacy-Enhanced Mail) format.
A PEM-encoded string with appropriate headers
Returns a string representation of this PKI object. Includes the type name and ASN.1 structure.
A string representation for debugging
Static
createCreates a TimeStampReq with the specified options.
Alternative constructor method that provides more explicit parameter naming.
Request configuration
A new TimeStampReq instance
Static
fromCreates a TimeStampReq from an ASN.1 structure.
Parses the ASN.1 SEQUENCE and extracts all optional and required fields according to RFC 3161 specification.
The ASN.1 structure to parse
The parsed TimeStampReq object
Static
fromCreates a TimeStampReq from DER-encoded bytes.
The DER-encoded timestamp request bytes
The parsed TimeStampReq
Static
fromCreates a simple TimeStampReq from a MessageImprint.
Convenience method for creating a basic timestamp request with default settings.
The message imprint to timestamp
A new TimeStampReq with version 1 and the given message imprint
Time-Stamp Request structure for RFC 3161 Time-Stamp Protocol.
A TimeStampReq is sent to a Time Stamping Authority (TSA) to request a timestamp for data. The request contains a hash of the data to be timestamped (MessageImprint) along with optional parameters like policy requirements and nonce for replay protection.
Asn
TimeStampReq ::= SEQUENCE { version INTEGER { v1(1) }, messageImprint MessageImprint, reqPolicy TSAPolicyId OPTIONAL, nonce TSANonce OPTIONAL, certReq BOOLEAN DEFAULT FALSE, extensions [0] IMPLICIT Extensions OPTIONAL }
TSAPolicyId ::= OBJECT IDENTIFIER TSANonce ::= INTEGER
Example
See
RFC 3161 Section 2.4.1 - TSAReq Structure