# HG changeset patch # User František Kučera # Date 1626547083 -7200 # Node ID c15dc8762bdb1a306efc949253295c544d497a63 # Parent 13aa7280ac7b45786850ee21fdf663faed424278 format unknown values as HEX and ASCII when possible diff -r 13aa7280ac7b -r c15dc8762bdb src/lib/BasicASN1Reader.h --- a/src/lib/BasicASN1Reader.h Sat Jul 17 18:58:22 2021 +0200 +++ b/src/lib/BasicASN1Reader.h Sat Jul 17 20:38:03 2021 +0200 @@ -258,13 +258,17 @@ // TODO: recover transaction? std::stringstream description; - description << "value:" + description << "UNKNOWN:" << " tag = " << typeHeader.tag << " tagClass = " << (int) typeHeader.tagClass << " pc = " << (int) typeHeader.pc << " length = " << typeHeader.length - << " definite = " << (typeHeader.definiteLength ? "true" : "false"); - + << " definite = " << (typeHeader.definiteLength ? "true" : "false") + << " hex = "; + description << std::hex << std::setfill('0'); + for (uint8_t b : temp) description << std::setw(2) << (int) b; + description << " ascii = "; + for (uint8_t b : temp) description << (b >= 32 && b < 127 ? (char) b : '.'); // TODO: special event for unparsed? (instead of a text string) handlers->writeTextString(typeHeader, description.str()); }