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

Invalid allowed characters for VisibleString type #146

Closed
Nicceboy opened this issue Aug 21, 2023 · 1 comment · Fixed by #147
Closed

Invalid allowed characters for VisibleString type #146

Nicceboy opened this issue Aug 21, 2023 · 1 comment · Fixed by #147
Labels
area/types Related to rasn’s types for ASN.1 help wanted Extra attention is needed kind/bug Something isn't working

Comments

@Nicceboy
Copy link
Contributor

Nicceboy commented Aug 21, 2023

Hey,

it seems like VisibleString allows too many characters.

Currently it supports full range of 7-bit ASCII, while it should limit the support for characters specified in ISO International Register of Coded Character Sets, registration 6. + SPACE character. (ITU-T Rec. X.680 (02/2021), Section 41, Table 8.)

Registration number 6. limits the allowed characters into so called ASCII graphics set, which has 94 characters.

Unfortunately these standards are still behind paywalls, but one might find readable version by a little bit of searching.

I might make a PR to fix this. Also the from_iso646_bytes function requires relative fix so that type restriction can be applied.

Should we also create "new" function for these string types to enforce type restrictions further or is it unnecessary? I would like to trust for the input when defining encoder so that the coming type does not contain disallowed characters

@XAMPPRocky
Copy link
Collaborator

Should we also create "new" function for these string types to enforce type restrictions further or is it unnecessary? I would like to trust for the input when defining encoder so that the coming type does not contain disallowed characters

Yes, the type should require valid characters at creation time, the function shouldn't be called new however it should be try_from_* where * is the input source (e.g. try_from_bytes). new should be reserved for creating empty strings.

@XAMPPRocky XAMPPRocky added kind/bug Something isn't working help wanted Extra attention is needed area/types Related to rasn’s types for ASN.1 labels Aug 21, 2023
Nicceboy added a commit to Nicceboy/rasn that referenced this issue Aug 21, 2023
Nicceboy added a commit to Nicceboy/rasn that referenced this issue Oct 10, 2023
XAMPPRocky pushed a commit that referenced this issue Oct 11, 2023
* types: Fixes #146

* visiblestring: remove dbg!

* per: add checks when restricted strings should be indexed, printable string tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/types Related to rasn’s types for ASN.1 help wanted Extra attention is needed kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants