PKISolutions / Asn1Editor.WPF

Graphical WPF-based Abstract Syntax Notation One (ASN.1) DER editor
Microsoft Public License
193 stars 61 forks source link

Add ASN.1 tree comparer/diff window #15

Closed harrison314 closed 1 year ago

harrison314 commented 4 years ago

At work I often need to compare some "PKCS" files.

It would be very helpful to have a tool that can make diff ASN1 tree structure and values.

Crypt32 commented 4 years ago

We don't have such feature. Can you provide more details on this? Maybe, you have some imaginary examples?

Crypt32 commented 1 year ago

Closed because no details provided.

ralienpp commented 11 months ago

@Crypt32, I think I want the same thing as @harrison314, and I can explain my point of view. Occasionally I produce ASN1 structures, or have to parse stuff that comes from my colleagues.

What one does in this case is open two tabs with two different files, and quickly switch between them to look for visual discrepancies, like so:

image

image

(as an analogy, think about how back in the day astronomers looked for interesting celestial objects using a blink comparator.)

This is a manual operation, therefore it is error-prone, one can easily overlook a difference. What the tool could do is show something like this instead:

image

A further improvement would be if the tool would provide more details about the difference. In this particular case we have the same structure, but on the left side it is wrapped in a set/sequence/sequence; also - a string has a different value.

image

Ultimately, what I think most of us do is use the ASN1 viewer to understand the hierarchy of the raw data, then do a lot of mental acrobatics to answer the question "how are they different?". If the tool could do it for us - it would save a lot of time.

Such functionality could be rolled out in several steps:

ralienpp commented 11 months ago

@Crypt32 Do you have any feedback about the provided use case?

I'm confronting a "find a needle in a haystack" situation again, comparing two ASN1 structures. This feature would have been so nice to have right now...

Crypt32 commented 11 months ago

Do you have any feedback about the provided use case?

The use case sounds legit. However this is a huge development given my limited time, it may take several months or even a year to implement.

ralienpp commented 11 months ago

this is a huge development

I can imagine that this is indeed far from an easy feature. Perhaps there are some small things that can be done at little cost.

I noticed that I can open more than one instance of the ASN1 editor, so I just opened two windows side by side and let Windows split the screen in half (Win+left and Win+right). Maybe you could add an option to the context-menu of a tab, which might behave like this:

This would start another instance of ASN1editor and automatically open the given file, and close this tab in the original window. This is not at all an automatic comparison, but at least it saves me a lot of clicks and spares me from the boring chores.

If the tab view widget you're using allows side by side display, perhaps this doesn't need another instance of the process.

Another thing I'd like is to be able to manually highlight a node in a tree (so I can reason about it in terms like "the green part on the left is the same as the green part on the right"). This is also not an automatic comparison feature, but it makes my life easier. It is the human that still does the comparison, but the software supports them by giving some tooling. Let's call it "computer-assisted comparison" :-)

harrison314 commented 11 months ago

Maybe in the first step you don't even need to make a separate window for it. This problem could be solved by exporting the ASN1 structure in a text format suitable for diff and using, for example, WinMerge or another text comparison tool.

Crypt32 commented 11 months ago

Maybe in the first step you don't even need to make a separate window for it.

this makes sense, however built-in functionality is a better option because it eliminates manual operations, like opening dump in text view, export to file, use another tool to make diffs. The whole idea is good, just can't estimate required efforts.