Skip to content

Conversation

@facutuesca
Copy link
Contributor

This PR adds support for BIT STRING to the ASN.1 API

@asn1.sequence
class Example
  field: asn1.BitString

bt = asn1.BitString(data=b"\x01\x10", padding_bits=2)

object = Example(field=bt)
encoded = encode_der(object)

decoded = decode_der(Example, encoded)
assert decoded.field.as_bytes() == b"\x01\x10"
assert decoded.field.padding_bits() == 2

Part of #12283

Signed-off-by: Facundo Tuesca <[email protected]>
@alex
Copy link
Member

alex commented Nov 22, 2025

@reaperhulk does a BitString type (with API that looks like rust-asn1: as_byes() + padding_bits()) look right to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants