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

Handle serials with a single missing leading zero. #16

Merged
merged 3 commits into from
Oct 23, 2020

Conversation

jcjones
Copy link
Contributor

@jcjones jcjones commented Oct 23, 2020

Python doesn't like integer values with leading zeroes, and I can't seem to
make pyasn.1 provide the serial number in a format where I can obtain the raw
DER-encoding.

This works around the problem by testing the top bit after big-endian-ing the
value, and if it's set, retry the filter checks with a prepended leading zero.

Fixes #15

Python doesn't like integer values with leading zeroes, and I can't seem to
make pyasn.1 provide the serial number in a format where I can obtain the raw
DER-encoding.

This works around the problem by testing the top bit after big-endian-ing the
value, and if it's set, retry the filter checks with a prepended leading zero.

Fixes #15
Copy link
Collaborator

@mozkeeler mozkeeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, seems like the best we can reasonably do given the constraints of pyasn1.

@jcjones jcjones merged commit 63398ae into main Oct 23, 2020
@jcjones jcjones deleted the 15-fix-leading-zero branch October 23, 2020 20:45
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