From b6646a5e93daba052ed98e641b77ebe40efe8b4f Mon Sep 17 00:00:00 2001 From: August Johann Date: Thu, 10 Jun 2021 17:00:10 +0200 Subject: [PATCH] Allow to specify generic attributes by OID --- src/asn1cms-1.0.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/asn1cms-1.0.js b/src/asn1cms-1.0.js index 28ddd873..b80c4828 100644 --- a/src/asn1cms-1.0.js +++ b/src/asn1cms-1.0.js @@ -1001,6 +1001,10 @@ extendClass(KJUR.asn1.cms.SubjectKeyIdentifier, KJUR.asn1.ASN1Object); * array: [{ * attr: "contentType", * type: "data" + * },{ + * attr: "oid", + * oid: "1.2.840.113549.1.9.16.2.80", + * value: { set: [{ set: [{enum: int 1}] }] } * }], * sortflag: false * }) @@ -1050,6 +1054,10 @@ KJUR.asn1.cms.AttributeList = function(params) { } else if (attrName == "signatureTimeStamp" || attrName == "timeStampToken") { a.push(new KJUR.asn1.cades.SignatureTimeStamp(pAttr)); + } else if (attrName == "oid") { + if (pAttr.oid == undefined || pAttr.value == undefined) + throw new _Error("missing oid or value attribute"); + a.push(KJUR.asn1.ASN1Util.newObject({seq: [{"oid": pAttr.oid, pAttr.value}])); } else { throw new _Error("unknown attr: " + attrName); }