How to use the asn1js.Any function in asn1js

To help you get started, we’ve selected a few asn1js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / PKI.js / src / ContentInfo.js View on Github external
const names = getParametersValue(parameters, "names", {});

		if(("optional" in names) === false)
			names.optional = false;

		return (new asn1js.Sequence({
			name: (names.blockName || "ContentInfo"),
			optional: names.optional,
			value: [
				new asn1js.ObjectIdentifier({ name: (names.contentType || "contentType") }),
				new asn1js.Constructed({
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 0 // [0]
					},
					value: [new asn1js.Any({ name: (names.content || "content") })] // EXPLICIT ANY value
				})
			]
		}));
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / RevocationInfoChoices.js View on Github external
return (new asn1js.Set({
			name: (names.blockName || ""),
			value: [
				new asn1js.Repeated({
					name: (names.crls || ""),
					value: new asn1js.Choice({
						value: [
							CertificateRevocationList.schema(),
							new asn1js.Constructed({
								idBlock: {
									tagClass: 3, // CONTEXT-SPECIFIC
									tagNumber: 1 // [1]
								},
								value: [
									new asn1js.ObjectIdentifier(),
									new asn1js.Any()
								]
							})
						]
					})
				})
			]
		}));
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / GeneralName.js View on Github external
return (new asn1js.Choice({
			value: [
				new asn1js.Constructed({
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 0 // [0]
					},
					name: (names.blockName || ""),
					value: [
						new asn1js.ObjectIdentifier(),
						new asn1js.Constructed({
							idBlock: {
								tagClass: 3, // CONTEXT-SPECIFIC
								tagNumber: 0 // [0]
							},
							value: [new asn1js.Any()]
						})
					]
				}),
				new asn1js.Primitive({
					name: (names.blockName || ""),
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 1 // [1]
					}
				}),
				new asn1js.Primitive({
					name: (names.blockName || ""),
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 2 // [2]
					}
github PeculiarVentures / PKI.js / src / OriginatorIdentifierOrKey.js View on Github external
case 2:
				this.value.idBlock.tagClass = 3; // CONTEXT-SPECIFIC
				this.value.idBlock.tagNumber = 0; // [0]

				return this.value;
			case 3:
				{
					const _schema = this.value.toSchema();

					_schema.idBlock.tagClass = 3; // CONTEXT-SPECIFIC
					_schema.idBlock.tagNumber = 1; // [1]

					return _schema;
				}
			default:
				return new asn1js.Any();
		}
		//endregion
	}
	//**********************************************************************************
github PeculiarVentures / CAdES.js / src / CrlValidatedID.js View on Github external
static defaultValues(memberName)
	{
		switch(memberName)
		{
			case "crlHash":
				return new asn1js.Any();
			case "crlIdentifier":
				return new CrlIdentifier();
			default:
				throw new Error(`Invalid member name for CrlValidatedID class: ${memberName}`);
		}
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / OtherCertificateFormat.js View on Github external
static defaultValues(memberName)
	{
		switch(memberName)
		{
			case "otherCertFormat":
				return "";
			case "otherCert":
				return new asn1js.Any();
			default:
				throw new Error(`Invalid member name for OtherCertificateFormat class: ${memberName}`);
		}
	}
	//**********************************************************************************
github YuryStrozhevsky / CTjs / src / TimestampedCertificateEntryDataV2.js View on Github external
static constants(name)
	{
		switch(name)
		{
			case "timestamp":
				return (new Date());
			case "issuerKeyHash":
				return (new ArrayBuffer(0));
			case "tbsCertificate":
				return (new asn1js.Any());
			case "extensions":
				return [];
			default:
				throw new Error(`Invalid constant name for TimestampedCertificateEntryDataV2 class: ${name}`);
		}
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / CRLBag.js View on Github external
static defaultValues(memberName)
	{
		switch(memberName)
		{
			case "crlId":
				return "";
			case "crlValue":
				return (new asn1js.Any());
			case "parsedValue":
				return {};
			default:
				throw new Error(`Invalid member name for CRLBag class: ${memberName}`);
		}
	}
	//**********************************************************************************
github PeculiarVentures / CAdES.js / src / OcspResponsesID.js View on Github external
static defaultValues(memberName)
	{
		switch(memberName)
		{
			case "ocspIdentifier":
				return new OcspIdentifier();
			case "ocspRepHash":
				return new asn1js.Any();
			default:
				throw new Error(`Invalid member name for OcspResponsesID class: ${memberName}`);
		}
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / ContentInfo.js View on Github external
static defaultValues(memberName)
	{
		switch(memberName)
		{
			case "contentType":
				return "";
			case "content":
				return new asn1js.Any();
			default:
				throw new Error(`Invalid member name for ContentInfo class: ${memberName}`);
		}
	}
	//**********************************************************************************

asn1js

asn1js is a pure JavaScript library implementing this standard. ASN.1 is the basis of all X.509 related data structures and numerous other protocols used on the web

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

73 / 100
Full package analysis