src/lib/GenericASN1ContentHandler.h
branchv_0
changeset 35 bf2c546f49d1
parent 31 a87c97aecbf6
child 38 44ee477875ec
--- 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();
+	}
+
+
 };
 
 }