Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
certificate.extensions.push(new pkijs.Extension({
extnID: "2.5.29.37",
critical: true,
extnValue: extKeyUsage.toSchema().toBER(false),
parsedValue: extKeyUsage,
}));
// Subject alternative name
const subjectAlternativeName = new pkijs.AltName({
altNames: [
new pkijs.GeneralName({
type: 2,
value: "localhost",
}),
new pkijs.GeneralName({
type: 7,
value: new asn1js.OctetString({ valueHex: new Uint8Array(Buffer.from("7F000001", "hex")).buffer }),
}),
],
});
certificate.extensions.push(new pkijs.Extension({
extnID: "2.5.29.17",
critical: false,
extnValue: subjectAlternativeName.toSchema().toBER(false),
parsedValue: subjectAlternativeName,
}));
// Basic constraints
const basicConstraints = new pkijs.BasicConstraints({
cA: false,
});
});
certificate.extensions.push(new pkijs.Extension({
extnID: "2.5.29.37",
critical: true,
extnValue: extKeyUsage.toSchema().toBER(false),
parsedValue: extKeyUsage,
}));
// Subject alternative name
const subjectAlternativeName = new pkijs.AltName({
altNames: [
new pkijs.GeneralName({
type: 2,
value: "localhost",
}),
new pkijs.GeneralName({
type: 7,
value: new asn1js.OctetString({ valueHex: new Uint8Array(Buffer.from("7F000001", "hex")).buffer }),
}),
],
});
certificate.extensions.push(new pkijs.Extension({
extnID: "2.5.29.17",
critical: false,
extnValue: subjectAlternativeName.toSchema().toBER(false),
parsedValue: subjectAlternativeName,
}));
// Basic constraints
const basicConstraints = new pkijs.BasicConstraints({
cA: false,
});
sequence = sequence.then(result =>
{
// noinspection JSCheckFunctionSignatures
const newView = new Uint8Array(result);
newView[0] = 0x01;
tstInfo = new TSTInfo({
version: 1,
policy: "1.1.1.1",
messageImprint: request.messageImprint,
serialNumber: new asn1js.Integer({ valueHex: result }),
genTime: genTime,
tsa: new GeneralName({
type: 4,
value: certSimpl.subject
})
});
});