import * as asn1js from "asn1js"; import * as pvutils from "pvutils"; import { Attribute, AttributeJson } from "./Attribute"; import * as Schema from "./Schema"; import { PkiObject, PkiObjectParameters } from "./PkiObject"; import { AsnError } from "./errors";
//#region Get internal properties from parsed schema this.bagId = asn1.result.bagId.valueBlock.toString();
const bagType = SafeBagValueFactory.find(this.bagId); if (!bagType) { thrownew Error(`Invalid BAG_ID for SafeBag: ${this.bagId}`);
} this.bagValue = new bagType({ schema: asn1.result.bagValue }) as unknown as T;
if (BAG_ATTRIBUTES in asn1.result) { this.bagAttributes = Array.from(asn1.result.bagAttributes, element => new Attribute({ schema: element }));
} //#endregion
}
public toSchema(): asn1js.Sequence { //#region Construct and return new ASN.1 schema for this object const outputArray = [ new asn1js.ObjectIdentifier({ value: this.bagId }), new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0// [0]
},
value: [this.bagValue.toSchema()]
})
];
if (this.bagAttributes) {
outputArray.push(new asn1js.Set({
value: Array.from(this.bagAttributes, o => o.toSchema())
}));
}
return (new asn1js.Sequence({
value: outputArray
})); //#endregion
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.