synta-python 0.3.1

Python extension module for the synta ASN.1 library
Documentation
//! Python bindings for PKCS #9 attribute OID constants (RFC 2985).
//!
//! Exposes the 13 well-known PKCS #9 OID constants into the ``synta.pkcs9``
//! submodule.  These OIDs are used for signed attributes in CMS/PKCS #7
//! structures and for bag attributes in PKCS #12 archives.

use pyo3::prelude::*;

/// Build and register the ``synta.pkcs9`` submodule.
pub(super) fn register_pkcs9_submodule(parent: &Bound<'_, PyModule>) -> PyResult<()> {
    let py = parent.py();
    let m = PyModule::new(py, "pkcs9")?;

    m.add(
        "ID_PKCS_9",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_PKCS_9),
    )?;
    m.add(
        "ID_EMAIL_ADDRESS",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_EMAIL_ADDRESS),
    )?;
    m.add(
        "ID_UNSTRUCTURED_NAME",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_UNSTRUCTURED_NAME),
    )?;
    m.add(
        "ID_CONTENT_TYPE",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_CONTENT_TYPE),
    )?;
    m.add(
        "ID_MESSAGE_DIGEST",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_MESSAGE_DIGEST),
    )?;
    m.add(
        "ID_SIGNING_TIME",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_SIGNING_TIME),
    )?;
    m.add(
        "ID_COUNTERSIGNATURE",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_COUNTERSIGNATURE),
    )?;
    m.add(
        "ID_CHALLENGE_PASSWORD",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_CHALLENGE_PASSWORD),
    )?;
    m.add(
        "ID_UNSTRUCTURED_ADDRESS",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_UNSTRUCTURED_ADDRESS),
    )?;
    m.add(
        "ID_EXTENSION_REQUEST",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_EXTENSION_REQUEST),
    )?;
    m.add(
        "ID_SMIME",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_SMIME),
    )?;
    m.add(
        "ID_FRIENDLY_NAME",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_FRIENDLY_NAME),
    )?;
    m.add(
        "ID_LOCAL_KEY_ID",
        super::oid_const(py, synta_certificate::pkcs9_types::ID_LOCAL_KEY_ID),
    )?;

    crate::install_submodule(
        parent,
        &m,
        "synta.pkcs9",
        Some(concat!(
            "synta.pkcs9 — PKCS #9 attribute OID constants (RFC 2985).\n\n",
            "Covers signed-attribute OIDs used in CMS/PKCS #7 (id-contentType,\n",
            "id-messageDigest, id-signingTime, id-countersignature), PKCS #10\n",
            "request attributes (id-extensionRequest, id-challengePassword),\n",
            "and PKCS #12 bag attributes (id-friendlyName, id-localKeyId).",
        )),
    )
}