Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
crlSimpl.thisUpdate = new Time({
type: 0,
value: new Date()
});
const revokedCertificate = new RevokedCertificate({
userCertificate: new asn1js.Integer({
value: 999
}),
revocationDate: new Time({
value: new Date()
}),
crlEntryExtensions: new Extensions({
extensions: [new Extension({
extnID: "2.5.29.21", // cRLReason
extnValue: (new asn1js.Enumerated({
value: 1
})).toBER(false)
})]
})
});
crlSimpl.revokedCertificates = [];
crlSimpl.revokedCertificates.push(revokedCertificate);
crlSimpl.crlExtensions = new Extensions({
extensions: [new Extension({
extnID: "2.5.29.20", // cRLNumber
extnValue: (new asn1js.Integer({
value: 2
})).toBER(false)
})]
});
}
//endregion
//region Making final OCSP response object
basicResponse = new BasicOCSPResponse({
tbsResponseData: new ResponseData({
responderID: certSimpl.subject,
producedAt: getUTCDate(new Date()),
responses: responses
}),
signatureAlgorithm: certSimpl.signatureAlgorithm,
certs: [certSimpl]
});
ocspResponse = new OCSPResponse({
responseStatus: new asn1js.Enumerated({ value: 0 }) // successful
});
//endregion
});
}), // IMPLICIT NULL (no "valueBlock")
new asn1js.Constructed({
name: (names.certStatus || ""),
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
value: [
new asn1js.GeneralizedTime(),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
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,
static schema(parameters = {})
{
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [responseStatus]
* @property {string} [responseBytes]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || "OCSPResponse"),
value: [
new asn1js.Enumerated({ name: (names.responseStatus || "responseStatus") }),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
value: [
ResponseBytes.schema(names.responseBytes || {
names: {
blockName: "responseBytes"
}
})
]
})
]
}));
static schema(parameters = {})
{
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [digestedObjectType]
* @property {string} [otherObjectTypeID]
* @property {string} [digestAlgorithm]
* @property {string} [objectDigest]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
new asn1js.Enumerated({ name: (names.digestedObjectType || "") }),
new asn1js.ObjectIdentifier({
optional: true,
name: (names.otherObjectTypeID || "")
}),
AlgorithmIdentifier.schema(names.digestAlgorithm || {}),
new asn1js.BitString({ name: (names.objectDigest || "") }),
]
}));
}
//**********************************************************************************
static defaultValues(memberName)
{
switch(memberName)
{
case "responseStatus":
return new asn1js.Enumerated();
case "responseBytes":
return new ResponseBytes();
default:
throw new Error(`Invalid member name for OCSPResponse class: ${memberName}`);
}
}
//**********************************************************************************
static defaultValues(memberName)
{
switch(memberName)
{
case "digestedObjectType":
return new asn1js.Enumerated();
case "otherObjectTypeID":
return new asn1js.ObjectIdentifier();
case "digestAlgorithm":
return new AlgorithmIdentifier();
case "objectDigest":
return new asn1js.BitString();
default:
throw new Error(`Invalid member name for ObjectDigestInfo class: ${memberName}`);
}
}
//**********************************************************************************