Skip to content

Implemented decodeString method in BerOctetString#54

Open
elFarto wants to merge 1 commit intobeanit:masterfrom
elFarto:master
Open

Implemented decodeString method in BerOctetString#54
elFarto wants to merge 1 commit intobeanit:masterfrom
elFarto:master

Conversation

@elFarto
Copy link

@elFarto elFarto commented May 19, 2025

A decodeString method is introduced to allow the decoding of constructed strings. This method requires that a tag is passed in so that it can be determined at runtime whether the string is constructed or not.

Obviously this method needs changes to the compiler to make use of it. I have those changes, but they're intermingled with all the other changes I had to make to get the X.400 ASN1 files I have compiling. This is the only change I needed to make to the parsing library itself.

The changes to the compiler I have produce code like this:

if (berTag.equals(BerIA5String.tag) || berTag.equals(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, BerTag.IA5_STRING_TAG)) {
   data = new IA5TextData();
   vByteCount += data.decodeString(is, berTag);

This isn't a particually nice way to solve this issue, but I didn't see any easier solution given how this library is architected (i.e. assuming a single tag for a value). I'm not an expert in ASN.1, but it's possible that the primitive field in the BerTag shouldn't be apart of the equals method, but we'd still need to pass the tag into the decode method so it knows what it's decoding.

The decodeString method is introduced to allow the decoding of constructed strings. This method requires that a tag is passed in so that it can be determined at runtime whether this string is constructed or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant