Skip to content

asn1: Add reference docs#14623

Merged
alex merged 7 commits intopyca:mainfrom
trail-of-forks:ft/asn1-docs
Apr 9, 2026
Merged

asn1: Add reference docs#14623
alex merged 7 commits intopyca:mainfrom
trail-of-forks:ft/asn1-docs

Conversation

@facutuesca
Copy link
Copy Markdown
Contributor

@facutuesca facutuesca commented Apr 9, 2026

Add the reference doc for the ASN.1 API. After this, we can add a "Tutorial" or "Overview" doc that is more of a walkthrough for new users.

Link to CI build of the docs: https://cryptography--14623.org.readthedocs.build/en/14623/hazmat/asn1/

Part of #12283

@facutuesca facutuesca marked this pull request as ready for review April 9, 2026 20:15
Comment on lines +14 to +16
.. function:: decode_der(asn1_type, data)

Deserialize a DER-encoded byte string into an instance of ``cls``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cls doesn't match asn1_type :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah missed that one, fixed!


.. decorator:: sequence

A class decorator that registers a class as an ASN.1 SEQUENCE. Fields
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
A class decorator that registers a class as an ASN.1 SEQUENCE. Fields
A class decorator that registers a class as an ASN.1 ``SEQUENCE``. Fields

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +86 to +93
The following built-in Python types are supported as field types in
:func:`sequence`-decorated classes:

* ``int`` -- INTEGER
* ``bool`` -- BOOLEAN
* ``bytes`` -- OCTET STRING
* ``str`` -- UTF8String

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure the sequence docs are the right place for this mapping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved them to the beginning of the section, before sequence

=====

.. note::
While usable, these APIs should be considered unstable and not yet
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should replicate this in the reference file (and any other files in this directory), same with the hazmat warning

Copy link
Copy Markdown
Contributor Author

@facutuesca facutuesca Apr 9, 2026

Choose a reason for hiding this comment

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

done. I also formatted the occurrences of the other ASN.1 type names (e.g: PrintableString -> PrintableString)

@alex alex enabled auto-merge (squash) April 9, 2026 22:44
@alex alex merged commit fec5bcc into pyca:main Apr 9, 2026
67 checks passed
@facutuesca facutuesca deleted the ft/asn1-docs branch April 9, 2026 22:55
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