Skip to content
PKIjsPKIjsPKIjsv4.0.1

TimeStampReq

Represents the TimeStampReq structure described in RFC3161

The following example demonstrates how to create Time-Stamp Request

const nonce = pkijs.getRandomValues(new Uint8Array(10)).buffer;
const tspReq = new pkijs.TimeStampReq({
version: 1,
messageImprint: await pkijs.MessageImprint.create("SHA-256", message),
reqPolicy: "1.2.3.4.5.6",
certReq: true,
nonce: new asn1js.Integer({ valueHex: nonce }),
});
const tspReqRaw = tspReq.toSchema().toBER();

new TimeStampReq(parameters?): TimeStampReq

Initializes a new instance of the TimeStampReq class

TimeStampReqParameters = {}

Initialization parameters

TimeStampReq

PkiObject.constructor

optional certReq?: boolean

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.

ITimeStampReq.certReq


optional extensions?: Extension[]

The extensions field is a generic way to add additional information to the request in the future.

ITimeStampReq.extensions


messageImprint: MessageImprint

Contains the hash of the datum to be time-stamped

ITimeStampReq.messageImprint


optional nonce?: Integer

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.

ITimeStampReq.nonce


optional reqPolicy?: string

Indicates the TSA policy under which the TimeStampToken SHOULD be provided.

ITimeStampReq.reqPolicy


version: number

Version of the Time-Stamp request. Should be version 1.

ITimeStampReq.version


static CLASS_NAME: string = "TimeStampReq"

Name of the class

PkiObject.CLASS_NAME

get className(): string

string

PkiObject.className

fromSchema(schema): void

Converts parsed ASN.1 object into current class

any

ASN.1 schema

void

PkiObject.fromSchema


toJSON(): TimeStampReqJson

Converts the class to JSON object

TimeStampReqJson

JSON object

PkiObject.toJSON


toSchema(): Sequence

Converts current object to ASN.1 object and sets correct values

Sequence

ASN.1 object

PkiObject.toSchema


toString(encoding?): string

"hex" | "base64" | "base64url" = "hex"

string

PkiObject.toString


static blockName(): string

Returns block name

string

Returns string block name

PkiObject.blockName


static compareWithDefault(memberName, memberValue): boolean

Compare values with default values for all class members

string

String name for a class member

any

Value to compare with default value

boolean


static defaultValues(memberName): number

Returns default values for all class members

"version"

String name for a class member

number

Default value

PkiObject.defaultValues

static defaultValues(memberName): MessageImprint

Returns default values for all class members

"messageImprint"

String name for a class member

MessageImprint

Default value

PkiObject.defaultValues

static defaultValues(memberName): string

Returns default values for all class members

"reqPolicy"

String name for a class member

string

Default value

PkiObject.defaultValues

static defaultValues(memberName): Integer

Returns default values for all class members

"nonce"

String name for a class member

Integer

Default value

PkiObject.defaultValues

static defaultValues(memberName): boolean

Returns default values for all class members

"certReq"

String name for a class member

boolean

Default value

PkiObject.defaultValues

static defaultValues(memberName): Extension[]

Returns default values for all class members

"extensions"

String name for a class member

Extension[]

Default value

PkiObject.defaultValues


static fromBER<T>(this, raw): T

Creates PKI object from the raw data

T extends PkiObject

PkiObjectConstructor<T>

BufferSource

ASN.1 encoded raw data

T

Initialized and filled current class object

PkiObject.fromBER


static schema(parameters?): any

Returns value of pre-defined ASN.1 schema for current class

SchemaParameters<{ certReq?: string; extensions?: string; messageImprint?: MessageImprintSchema; nonce?: string; reqPolicy?: string; version?: string; }> = {}

Input parameters for the schema

any

ASN.1 schema object

PkiObject.schema