import * as asn1js from "asn1js"; import * as pvutils from "pvutils"; import { AttributeTypeAndValue, AttributeTypeAndValueJson } from "./AttributeTypeAndValue"; import { EMPTY_BUFFER, EMPTY_STRING } from "./constants"; import { AsnError } from "./errors"; import { PkiObject, PkiObjectParameters } from "./PkiObject"; import * as Schema from "./Schema";
// Get internal properties from parsed schema if (TYPE_AND_VALUES in asn1.result) {// Could be a case when there is no "types and values" this.typesAndValues = Array.from(asn1.result.typesAndValues, element => new AttributeTypeAndValue({ schema: element }));
}
this.valueBeforeDecode = (asn1.result.RDN as asn1js.BaseBlock).valueBeforeDecodeView.slice().buffer;
}
public toSchema(): asn1js.Sequence { if (this.valueBeforeDecode.byteLength === 0) // No stored encoded array, create "from scratch"
{
return (new asn1js.Sequence({
value: [new asn1js.Set({
value: Array.from(this.typesAndValues, o => o.toSchema())
} as any)]
} as any));
}
const asn1 = asn1js.fromBER(this.valueBeforeDecode);
AsnError.assert(asn1, "RelativeDistinguishedNames"); if (!(asn1.result instanceof asn1js.Sequence)) { thrownew Error("ASN.1 result should be SEQUENCE");
}
return asn1.result;
}
public toJSON(): RelativeDistinguishedNamesJson {
return {
typesAndValues: Array.from(this.typesAndValues, o => o.toJSON())
};
}
/** *ComparestwoRDNvalues,orRDNwithArrayBuffervalue *@paramcompareToThevaluecomparetocurrent
*/ public isEqual(compareTo: unknown): boolean { if (compareTo instanceof RelativeDistinguishedNames) { if (this.typesAndValues.length !== compareTo.typesAndValues.length)
return false;
for (const [index, typeAndValue] of this.typesAndValues.entries()) { if (typeAndValue.isEqual(compareTo.typesAndValues[index]) === false)
return false;
}
return true;
}
if (compareTo instanceof ArrayBuffer) {
return pvutils.isEqualBuffer(this.valueBeforeDecode, compareTo);
}
return false;
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-08-28)
¤
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.