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

ASN1BitString.encode() doesn't guarantee that unused bits are 0 #839

Open
kdeus opened this issue Jan 7, 2025 · 1 comment
Open

ASN1BitString.encode() doesn't guarantee that unused bits are 0 #839

kdeus opened this issue Jan 7, 2025 · 1 comment
Assignees

Comments

@kdeus
Copy link
Contributor

kdeus commented Jan 7, 2025

The standard requires unused bits to be set to 0, so there's only one possible encoding. I don't see anything in ASN1BitString.encode() that guarantees that, if the caller used the ByteArray constructor directly.

Either add a check()/require() or force those values to 0 before appending?

@kdeus
Copy link
Contributor Author

kdeus commented Jan 7, 2025

And we should have a unit test covering this case...

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

No branches or pull requests

2 participants