On Tue, 2 Jun 2026 16:01:57 GMT, Weijun Wang <[email protected]> wrote:

>> This enhancement adds label display and allow drilling into an OCTET STRING 
>> or BIT STRING. The label can be used in other tools like `DerUtil`.
>> 
>> For example:
>> 
>> o $ echo 3009040730050201050500 | xxd -r -p > bin
>> # Before the change
>> o $ java ASN1Formatter.java bin
>> bin
>> 0000: 30 09                                           ; SEQUENCE [9]
>> 0002:       04 07 30 05 02 01 05 05 00                ;   OCTET STRING [7] 
>> <Unprintable>
>> # After the change
>> o $ java ASN1Formatter.java bin
>> 0000: 30 09                                           ; []: SEQUENCE [9]
>> 0002:       04 07 30 05 02 01 05 05 00                ; [0]: OCTET STRING 
>> [7] (try --drill=0)
>> o $ java ASN1Formatter.java bin --drill=0
>> 0000: 30 09                                           ; []: SEQUENCE [9]
>> 0002:       04 07                                     ; [0]: OCTET STRING [7]
>> 0004:             30 05                               ; [0c]: SEQUENCE [5]
>> 0006:                   02 01 05                      ; [0c0]: BYTE 5.
>> 0009:                            05 00                ; [0c1]: NULL
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Weijun Wang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   wrong format in test

test/lib/jdk/test/lib/hexdump/ASN1Formatter.java line 43:

> 41: /**
> 42:  * ASN.1 stream formatter; a debugging utility for visualizing the 
> contents
> 43:  * of an ASN.1 stream. The ANS1Formatter can be used standalone by 
> calling the

s/ANS1Formatter/ASN1Formatter/

test/lib/jdk/test/lib/hexdump/ASN1Formatter.java line 460:

> 458:      */
> 459:     private String tagName(int tag) {
> 460:         String tagString = (isConstructed(tag) ? "CONSTRUCTED " : "") + 
> tagNames[tagType(tag)];

Could move this line into TAG_UNIVERSAL case.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30685#discussion_r3501077172
PR Review Comment: https://git.openjdk.org/jdk/pull/30685#discussion_r3501128783

Reply via email to