rusticata/der-parser

BerObject::as_pretty() drops tag class when printing Unknown contents

lilyball opened this issue · 0 comments

BerObjectContent::Unknown carries the BerTag but not the BerClass. I don't know why this is, it seems like an oversight, but the class is stored in the BerObjectHeader. Unfortunately, the BerObject::as_pretty() method only prints the contents (barring the ShowHeader flag). What's more, it prints the enum name for any BerTags even if they don't belong to the Universal class. This means that my pretty-printed object is showing up containing a Sequence[Unknown(EndOfContent,[de, ad, be, ef])]. Printing the header tells me this is actually a context-specific tag, which means it should have been printed as something like Sequence[Unknown(ContextSpecific(0),[de, ad, be, ef])] instead.