diff -r c15dc8762bdb -r bf2c546f49d1 src/lib/GenericASN1ContentHandler.h --- a/src/lib/GenericASN1ContentHandler.h Sat Jul 17 20:38:03 2021 +0200 +++ b/src/lib/GenericASN1ContentHandler.h Sun Jul 18 12:37:40 2021 +0200 @@ -117,6 +117,20 @@ handlers.writeEndElement(); } + void writeSpecific(const Header& header, std::string value) override { + std::stringstream hex; + hex << std::hex << std::setfill('0'); + for (uint8_t b : value) hex << std::setw(2) << (int) b; + + std::stringstream ascii; + for (uint8_t b : value) ascii << (b >= 32 && b < 127 ? (char) b : '.'); // TODO: configurable unsupported symbol? + + handlers.writeStartElement("specific",{"length", std::to_string(value.size()), "hex", hex.str()}); + handlers.writeCharacters(ascii.str()); + handlers.writeEndElement(); + } + + }; }