-
Notifications
You must be signed in to change notification settings - Fork 1.7k
asn1: Add support for BIT STRING
#13908
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Facundo Tuesca <[email protected]>
|
@reaperhulk does a BitString type (with API that looks like rust-asn1: as_byes() + padding_bits()) look right to you? |
|
There are two primary ways bit strings are used. One is the “wrong type”, as in a signature in x509, where you really just want the byte value. The other is an actual bit field, like key usage or CRL revocation reasons. This API seems fine for the former and lacking for the latter. |
|
Nothing prevents us from introducing another representation of bitstring for that in the future. Will go ahead and review this PR as-is. |
| pub fn __repr__(&self) -> pyo3::PyResult<String> { | ||
| Ok(format!( | ||
| "BitString(data: {}, padding_bits: {})", | ||
| self.data, self.padding_bits, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repr should be formatted like the constructor, so =, not :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| self.data.clone_ref(py) | ||
| } | ||
|
|
||
| #[pyo3(signature = ())] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary for anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, fixed
Signed-off-by: Facundo Tuesca <[email protected]>
Signed-off-by: Facundo Tuesca <[email protected]>
This PR adds support for
BIT STRINGto the ASN.1 APIPart of #12283