Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sequence = sequence.then(result =>
{
tspKey = result;
// #region Prepare buffer with combined "messageImprint" and "genTime"
const asn1GenTime = new asn1js.GeneralizedTime({ valueDate: genTime });
const buffer = utilConcatBuf(request.messageImprint.toSchema().toBER(false), asn1GenTime.toBER(false));
// #endregion
return crypto.digest({ name: "SHA-1" }, buffer);
});
},
value: [new asn1js.Enumerated()]
})
]
}),
new asn1js.Primitive({
name: (names.certStatus || ""),
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 2 // [2]
},
lenBlock: { length: 1 }
}) // IMPLICIT NULL (no "valueBlock")
]
}),
new asn1js.GeneralizedTime({ name: (names.thisUpdate || "") }),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
value: [new asn1js.GeneralizedTime({ name: (names.nextUpdate || "") })]
}),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
value: [Extensions.schema(names.singleExtensions || {})]
}) // EXPLICIT SEQUENCE value
toSchema()
{
//region Create array for output sequence
const outputArray = [];
if("notBefore" in this)
{
outputArray.push(new asn1js.Primitive({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
valueHex: (new asn1js.GeneralizedTime({ valueDate: this.notBefore })).valueBlock.valueHex
}));
}
if("notAfter" in this)
{
outputArray.push(new asn1js.Primitive({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
valueHex: (new asn1js.GeneralizedTime({ valueDate: this.notAfter })).valueBlock.valueHex
}));
}
//endregion
//region Construct and return new ASN.1 schema for this object
names: {
blockName: "ResponseData.byName"
}
})]
}),
new asn1js.Constructed({
name: (names.responderID || "ResponseData.responderID"),
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 2 // [2]
},
value: [new asn1js.OctetString({ name: (names.ResponseDataByKey || "ResponseData.byKey") })]
})
]
}),
new asn1js.GeneralizedTime({ name: (names.producedAt || "ResponseData.producedAt") }),
new asn1js.Sequence({
value: [
new asn1js.Repeated({
name: "ResponseData.responses",
value: SingleResponse.schema(names.response || {})
})
]
}),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
value: [Extensions.schema(names.extensions || {
names: {
* @property {string} [extensions]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || "TSTInfo"),
value: [
new asn1js.Integer({ name: (names.version || "TSTInfo.version") }),
new asn1js.ObjectIdentifier({ name: (names.policy || "TSTInfo.policy") }),
MessageImprint.schema(names.messageImprint || {
names: {
blockName: "TSTInfo.messageImprint"
}
}),
new asn1js.Integer({ name: (names.serialNumber || "TSTInfo.serialNumber") }),
new asn1js.GeneralizedTime({ name: (names.genTime || "TSTInfo.genTime") }),
Accuracy.schema(names.accuracy || {
names: {
blockName: "TSTInfo.accuracy"
}
}),
new asn1js.Boolean({
name: (names.ordering || "TSTInfo.ordering"),
optional: true
}),
new asn1js.Integer({
name: (names.nonce || "TSTInfo.nonce"),
optional: true
}),
new asn1js.Constructed({
optional: true,
idBlock: {
static schema(parameters = {})
{
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [notBeforeTime]
* @property {string} [notAfterTime]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
new asn1js.GeneralizedTime({ name: (names.notBeforeTime || "") }),
new asn1js.GeneralizedTime({ name: (names.notAfterTime || "") })
]
}));
}
//**********************************************************************************
toSchema()
{
//region Construct and return new ASN.1 schema for this object
return (new asn1js.Sequence({
value: [
new asn1js.GeneralizedTime({ valueDate: this.notBeforeTime }),
new asn1js.GeneralizedTime({ valueDate: this.notAfterTime }),
]
}));
//endregion
}
//**********************************************************************************
PrivateKeyUsagePeriod.schema({
names: {
notBefore: "notBefore",
notAfter: "notAfter"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for PrivateKeyUsagePeriod");
//endregion
//region Get internal properties from parsed schema
if("notBefore" in asn1.result)
{
const localNotBefore = new asn1js.GeneralizedTime();
localNotBefore.fromBuffer(asn1.result.notBefore.valueBlock.valueHex);
this.notBefore = localNotBefore.toDate();
}
if("notAfter" in asn1.result)
{
const localNotAfter = new asn1js.GeneralizedTime({ valueHex: asn1.result.notAfter.valueBlock.valueHex });
localNotAfter.fromBuffer(asn1.result.notAfter.valueBlock.valueHex);
this.notAfter = localNotAfter.toDate();
}
//endregion
}
//**********************************************************************************
static schema(parameters = {}, optional = false)
{
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [utcTimeName] Name for "utcTimeName" choice
* @property {string} [generalTimeName] Name for "generalTimeName" choice
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Choice({
optional,
value: [
new asn1js.UTCTime({ name: (names.utcTimeName || "") }),
new asn1js.GeneralizedTime({ name: (names.generalTimeName || "") })
]
}));
}
//**********************************************************************************
static defaultValues(memberName)
{
switch(memberName)
{
case "keyIdentifier":
return new asn1js.OctetString();
case "date":
return new asn1js.GeneralizedTime();
case "other":
return new OtherKeyAttribute();
default:
throw new Error(`Invalid member name for KEKIdentifier class: ${memberName}`);
}
}
//**********************************************************************************