-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8252523: Add ASN.1 Formatter to work with test utility HexPrinter #268
Conversation
👋 Welcome back rriggs! A progress list of the required criteria for merging this PR into |
@RogerRiggs The following labels will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing lists. If you would like to change these labels, use the |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments based on the output example.
Are there any other comments or suggestions? |
Can you post an example output of that cert? What about indefinite length? (Ex: 0x24, (byte) 0x80, 4, 2, 'a', 'b', 4, 2, 'c', 'd', 0, 0) |
For your example the output is:
|
Also in that last example, it seems to suggest that the second octet string is nested within the first one since it sits at a second indent layer. They are both primitives completely covered by their two byte values so shouldn't they sit at the same indentation level? Or is the indentation not there to suggest nested substructures and is more for separation between elements? Or is this what you mean by "lost an indent"? Also, should the end of content be at the same indentation level as the initial indefinite length encoding? |
…h tag-values, added test for indefinite length
Yes, all of the enclosed items should be at the same indent level. (A bug as it turns out). The updated output is:
|
Regarding the end-of-content identifier, that looks good. Thanks for fixing the indentation for the right-side ASN.1 interpretation of the bytes. My only remaining question is whether the corresponding hex dumps on the left should match the indentation levels as well. I don't have a strong opinion either way on that one but if you're indenting for each element at the same nest level it seems like that could potentially chew up a lot of horizontal space. Was the extra indentation for the second octet string done for readability? |
Max had requested the current offset of the byte values, so it was easy to see where each new value started and to keep the offsets on a modulo boundary. The formatter on the right is largely decoupled from the hex value tabular form on the left while keeping the correspondence between the formatted items and the bytes. |
If you and Max find that better from a visual perspective then that works for me. Thanks for clarifying that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@RogerRiggs This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for more details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 142 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
@RogerRiggs Since your change was applied there have been 152 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 092c227. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
JDK-8252523: Add ASN.1 Formatter to work with test utility HexPrinter
Debugging functions that utilize ASN.1, DER, and BER encoded streams is
difficult without test utilities to show the contents.
The ASN.1 formatter reads a stream and produces annotated output of the
tags, values, and structures.
When used with the test library jdk.test.lib.hexdump.HexPrinter the annotations are synchronized
with the hex formatted output.
Small changes to HexPrinter are included to improve the output readability.
Example decoding of a .pem certificate:
When used with the HexPrinter test utility, the formatting of the
hexadecimal values is selected with the parameters to HexPrinter.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/268/head:pull/268
$ git checkout pull/268