Skip to content

Commit

Permalink
Passing reqPolicy from req.sign
Browse files Browse the repository at this point in the history
  • Loading branch information
cfranc0 committed Jan 3, 2024
1 parent ff2d1a4 commit cf4b6df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.");

Expand All @@ -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,

Expand Down
6 changes: 3 additions & 3 deletions src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit cf4b6df

Please sign in to comment.