asn1-ts
Version:
ASN.1 encoding and decoding, including BER, CER, and DER.
19 lines (18 loc) • 630 B
JavaScript
export default class CharacterString {
constructor(identification, stringValue) {
this.identification = identification;
this.stringValue = stringValue;
}
toString() {
return ("CHARACTER STRING { "
+ `identification ${this.identification.toString()} `
+ `dataValue ${Array.from(this.stringValue).map((byte) => byte.toString(16)).join("")} `
+ "}");
}
toJSON() {
return {
identification: this.identification.toJSON(),
dataValue: Array.from(this.stringValue).map((byte) => byte.toString(16)).join(""),
};
}
}