Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"1.3.6.1.4.1.311.10.3.1", // Microsoft Certificate Trust List signing
"1.3.6.1.4.1.311.10.3.4" // Microsoft Encrypted File System
]
});
certificate.extensions.push(new Extension({
extnID: "2.5.29.37",
critical: false,
extnValue: extKeyUsage.toSchema().toBER(false),
parsedValue: extKeyUsage // Parsed value for well-known extensions
}));
//endregion
//region Microsoft-specific extensions
const certType = new asn1js.Utf8String({ value: "certType" });
certificate.extensions.push(new Extension({
extnID: "1.3.6.1.4.1.311.20.2",
critical: false,
extnValue: certType.toBER(false),
parsedValue: certType // Parsed value for well-known extensions
}));
const prevHash = new asn1js.OctetString({ valueHex: (new Uint8Array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])).buffer });
certificate.extensions.push(new Extension({
extnID: "1.3.6.1.4.1.311.21.2",
critical: false,
extnValue: prevHash.toBER(false),
parsedValue: prevHash // Parsed value for well-known extensions
// ContentHints ::= SEQUENCE {
// contentDescription UTF8String (SIZE (1..MAX)) OPTIONAL,
// contentType ContentType }
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [contentDescription]
* @property {string} [contentType]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
new asn1js.Utf8String({
name: (names.contentDescription || ""),
optinal: true
}),
new asn1js.ObjectIdentifier({ name: (names.contentType || "") })
]
}));
}
//**********************************************************************************
]
}),
new asn1js.Constructed({
name: (names.localityName || ""),
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
value: [
new asn1js.Choice({
value: [
new asn1js.TeletexString({ name: (names.localityName || "") }),
new asn1js.PrintableString({ name: (names.localityName || "") }),
new asn1js.UniversalString({ name: (names.localityName || "") }),
new asn1js.Utf8String({ name: (names.localityName || "") }),
new asn1js.BmpString({ name: (names.localityName || "") })
]
})
]
}),
new asn1js.Constructed({
optional: true,
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 2 // [2]
},
value: [
new asn1js.Repeated({
name: (names.postalAdddress || ""),
value: new asn1js.Choice({
value: [
//region Get a "crypto" extension
const crypto = getCrypto();
if(typeof crypto === "undefined")
return Promise.reject("No WebCrypto extension found");
//endregion
//region Put a static values
pkcs10.version = 0;
pkcs10.subject.typesAndValues.push(new AttributeTypeAndValue({
type: "2.5.4.6",
value: new asn1js.PrintableString({ value: "RU" })
}));
pkcs10.subject.typesAndValues.push(new AttributeTypeAndValue({
type: "2.5.4.3",
value: new asn1js.Utf8String({ value: "Simple test (простой тест)" })
}));
const altNames = new GeneralNames({
names: [
new GeneralName({
type: 1, // rfc822Name
value: "email@address.com"
}),
new GeneralName({
type: 2, // dNSName
value: "www.domain.com"
}),
new GeneralName({
type: 2, // dNSName
value: "www.anotherdomain.com"
}),
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
NoticeReference.schema(names.sPUserNotice || {
names: {
blockName: "",
optional: true
}
}),
new asn1js.Choice({
value: [
new asn1js.VisibleString({ name: (names.explicitText || "") }),
new asn1js.BmpString({ name: (names.explicitText || "") }),
new asn1js.Utf8String({ name: (names.explicitText || "") })
]
})
]
}));
}
//**********************************************************************************
* @property {string} [status]
* @property {string} [statusStrings]
* @property {string} [failInfo]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
new asn1js.Integer({ name: (names.status || "") }),
new asn1js.Sequence({
optional: true,
value: [
new asn1js.Repeated({
name: (names.statusStrings || ""),
value: new asn1js.Utf8String()
})
]
}),
new asn1js.BitString({
name: (names.failInfo || ""),
optional: true
})
]
}));
}
//**********************************************************************************
toSchema()
{
//region Create array for output sequence
const outputArray = [];
switch(this._organizationType)
{
case 0:
outputArray.push(new asn1js.VisibleString({ value: this.organization }));
break;
case 1:
outputArray.push(new asn1js.BmpString({ value: this.organization }));
break;
case 2:
outputArray.push(new asn1js.Utf8String({ value: this.organization }));
break;
default:
throw new Error("Non-initialized \"organization\" value");
}
outputArray.push(new asn1js.Sequence({
value: Array.from(this.noticeNumbers)
}));
//endregion
//region Construct and return new ASN.1 schema for this object
return (new asn1js.Sequence({
value: outputArray
}));
//endregion
}
toSchema()
{
//region Construct and return new ASN.1 schema for this object
return (new asn1js.Sequence({
value: [
new asn1js.Utf8String({ value: this.contentType }),
new asn1js.ObjectIdentifier({ value: this.contentType })
]
}));
//endregion
}
//**********************************************************************************