Skip to content

Conversation

@facutuesca
Copy link
Contributor

This adds support for encoding/decoding IA5String.

here's an example of how it would be used:

@asn1.sequence
class MySeq:
    field: asn1.IA5String

object = MySeq(field=asn1.IA5String("A string"))
encoded = encode_der(object)

decoded = decode_der(MySeq, encoded)
assert decoded.field.as_str() == "A string"

Part of #12283

Signed-off-by: Facundo Tuesca <facundo.tuesca@trailofbits.com>
Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

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

slightly unfortunate that we end up doing 2x validation, once on construction and then again on serialization.

can you put a TODO somewhere (either on the issue or as a follow up PR with appropriate comments) for us to look for a way to improve that perf?

@alex alex enabled auto-merge (squash) December 8, 2025 15:53
@alex
Copy link
Member

alex commented Dec 8, 2025

Another follow up: can you have us use to_str() on py310+ and to_cow() only on older Pythons? We do 3.11 wheels, so they'll get the perf win.

@alex alex merged commit 03a854d into pyca:main Dec 8, 2025
68 checks passed
@facutuesca facutuesca deleted the ft/asn1-ia5string branch December 8, 2025 16:13
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