From cf4b6df13a309150c2664affea28f7b80db6c302 Mon Sep 17 00:00:00 2001 From: Francesco Date: Wed, 3 Jan 2024 10:44:56 -0600 Subject: [PATCH] Passing reqPolicy from req.sign --- src/query.ts | 5 ++++- src/response.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/query.ts b/src/query.ts index f2ba31d..7428bbe 100644 --- a/src/query.ts +++ b/src/query.ts @@ -2,7 +2,7 @@ * Author : Francesco * Created at: 2023-12-09 17:52 * Edited by : Francesco - * Edited at : 2023-12-30 15:30 + * Edited at : 2024-01-03 10:43 * * Copyright (c) 2023 Xevolab S.R.L. */ @@ -153,6 +153,7 @@ export class TimeStampReq { sign(params: { key?: KeyObject, certs?: X509Certificate[], + }, signingOptions?: SignOptions): TimeStampResp { if (!this.request) throw new Error("Request not initialized."); @@ -161,6 +162,8 @@ export class TimeStampReq { nonce: this.request.nonce, certReq: this.request.certReq, + reqPolicy: this.request.reqPolicy || undefined, + key: params.key || undefined, certs: params.certs, diff --git a/src/response.ts b/src/response.ts index 70efebf..21ef1f5 100644 --- a/src/response.ts +++ b/src/response.ts @@ -2,7 +2,7 @@ * Author : Francesco * Created at: 2023-12-09 17:52 * Edited by : Francesco - * Edited at : 2023-12-14 15:43 + * Edited at : 2023-12-31 12:28 * * Copyright (c) 2023 Xevolab S.R.L. */ @@ -124,7 +124,7 @@ export class TimeStampResp { if (certs.length === 0) throw new Error("Invalid certs; needs to be an array with at least one element."); this.signingTime = new Date(); - this.serialNumber = randomBytes(4) + this.serialNumber = randomBytes(6) /** * TSTInfo ::= SEQUENCE { @@ -183,7 +183,7 @@ export class TimeStampResp { /** * CertificateSerialNumber ::= INTEGER */ - new asn1js.Integer({ valueHex: this.serialNumber }), + asn1js.Integer.fromBigInt("0x" + this.serialNumber.toString("hex")), /** * GeneralizedTime ::= CHOICE {