Skip to content
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

Tag validation #23

Open
wants to merge 5 commits into
base: der-support
Choose a base branch
from

Conversation

masihyeganeh
Copy link

@masihyeganeh masihyeganeh commented Oct 15, 2020

It now validates tags.
It shows that C::TAG is wrong sometimes. we need to work on that.
simple_der now panics with Got unexpected tag Universal(2) instead of ContextSpecific(0) error.
It needs to parse a Number (Universal(2)) but C::TAG says it needs to see ContextSpecific(0) that is wrong.

And by the way, I added more default tags and implemented Display for it if you don't mind.

@masihyeganeh
Copy link
Author

Correct me if I'm wrong, but based on this example:

Data-Structures DEFINITIONS ::=
BEGIN
  DataStructures ::= SEQUENCE
  {
     int              INTEGER,
     limitedString    UTF8String (SIZE(1..16)),
     optionalString   UTF8String OPTIONAL,
     enumerated       ENUMERATED {value1, value2, value3},
     optionalChoice   CHOICE
     {
        int1   [0] INTEGER,
        int2   [1] INTEGER
     }  OPTIONAL,
     sequenceOfString SEQUENCE OF UTF8String
  }
END

in places such as choice that there are [0] and [1], the C::TAG should be ContextSpecific(0) and ContextSpecific(1).
Also if there was AUTOMATIC TAGS after DEFINITIONS, then all Tags should be ContextSpecific(index of the element).

Other than that, it should always be Universal.

@masihyeganeh
Copy link
Author

OK, I just added ability to parse AUTOMATIC TAGS and saving it as a boolean automatic_tags on model.
I see that you already extracting tag number in next_with_opt_tag.
Please help me with this.
if automatic_tags is true, this function should return increasing number for each tag.

@kellerkindt
Copy link
Owner

kellerkindt commented Feb 15, 2021

FYI: as long as (existing) tests do not pass, I do not consider a PR as ready

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.

None yet

2 participants