synta 0.2.6

ASN.1 parser, decoder, and encoder library with DER/BER support and C FFI
Documentation
# Well-known OIDs


`synta.oids` provides 70+ well-known OID constants as `ObjectIdentifier` instances
(frozen, hashable). Import with `import synta.oids as oids`.

## Algorithm OIDs

| Constant | OID | Standard |
|---|---|---|
| `RSA_ENCRYPTION` | 1.2.840.113549.1.1.1 | PKCS #1 |
| `MD5_WITH_RSA` | 1.2.840.113549.1.1.4 | PKCS #1 |
| `SHA1_WITH_RSA` | 1.2.840.113549.1.1.5 | PKCS #1 |
| `SHA256_WITH_RSA` | 1.2.840.113549.1.1.11 | RFC 4055 |
| `SHA384_WITH_RSA` | 1.2.840.113549.1.1.12 | RFC 4055 |
| `SHA512_WITH_RSA` | 1.2.840.113549.1.1.13 | RFC 4055 |
| `EC_PUBLIC_KEY` | 1.2.840.10045.2.1 | RFC 5480 |
| `ECDSA_WITH_SHA1` | 1.2.840.10045.4.1 | ANSI X9.62 |
| `ECDSA_WITH_SHA256` | 1.2.840.10045.4.3.2 | RFC 5758 |
| `ECDSA_WITH_SHA384` | 1.2.840.10045.4.3.3 | RFC 5758 |
| `ECDSA_WITH_SHA512` | 1.2.840.10045.4.3.4 | RFC 5758 |
| `ED25519` | 1.3.101.112 | RFC 8410 |
| `ED448` | 1.3.101.113 | RFC 8410 |
| `ML_DSA_44` | 2.16.840.1.101.3.4.3.17 | FIPS 204 |
| `ML_DSA_65` | 2.16.840.1.101.3.4.3.18 | FIPS 204 |
| `ML_DSA_87` | 2.16.840.1.101.3.4.3.19 | FIPS 204 |
| `ML_KEM_512` | 2.16.840.1.101.3.4.4.1 | FIPS 203 |
| `ML_KEM_768` | 2.16.840.1.101.3.4.4.2 | FIPS 203 |
| `ML_KEM_1024` | 2.16.840.1.101.3.4.4.3 | FIPS 203 |
| `EC_CURVE_P256` | 1.2.840.10045.3.1.7 | NIST P-256 |
| `EC_CURVE_P384` | 1.3.132.0.34 | NIST P-384 |
| `EC_CURVE_P521` | 1.3.132.0.35 | NIST P-521 |
| `EC_CURVE_SECP256K1` | 1.3.132.0.10 | Bitcoin curve |

## Hash algorithm OIDs

| Constant | OID | Standard |
|---|---|---|
| `SHA224` | 2.16.840.1.101.3.4.2.4 | FIPS 180-4 |
| `SHA256` | 2.16.840.1.101.3.4.2.1 | FIPS 180-4 |
| `SHA384` | 2.16.840.1.101.3.4.2.2 | FIPS 180-4 |
| `SHA512` | 2.16.840.1.101.3.4.2.3 | FIPS 180-4 |
| `SHA512_224` | 2.16.840.1.101.3.4.2.5 | FIPS 180-4 |
| `SHA512_256` | 2.16.840.1.101.3.4.2.6 | FIPS 180-4 |
| `SHA3_224` | 2.16.840.1.101.3.4.2.7 | FIPS 202 |
| `SHA3_256` | 2.16.840.1.101.3.4.2.8 | FIPS 202 |
| `SHA3_384` | 2.16.840.1.101.3.4.2.9 | FIPS 202 |
| `SHA3_512` | 2.16.840.1.101.3.4.2.10 | FIPS 202 |
| `SHAKE128` | 2.16.840.1.101.3.4.2.11 | FIPS 202 |
| `SHAKE256` | 2.16.840.1.101.3.4.2.12 | FIPS 202 |

## SLH-DSA OIDs (FIPS 205)

`SLH_DSA_SHA2_128F`, `SLH_DSA_SHA2_128S`, `SLH_DSA_SHA2_192F`, `SLH_DSA_SHA2_192S`,
`SLH_DSA_SHA2_256F`, `SLH_DSA_SHA2_256S`, `SLH_DSA_SHAKE_128F`, `SLH_DSA_SHAKE_128S`,
`SLH_DSA_SHAKE_192F`, `SLH_DSA_SHAKE_192S`, `SLH_DSA_SHAKE_256F`, `SLH_DSA_SHAKE_256S`.

## Composite ML-DSA OIDs (draft-ietf-lamps-pq-composite-sigs-19)

18 composite algorithm OIDs under the `id-alg` arc `1.3.6.1.5.5.7.6`.  The arc
prefix itself is exposed as `COMPOSITE_MLDSA_ARC`.

| Constant | OID | Traditional component |
|---|---|---|
| `MLDSA44_RSA2048_PSS_SHA256` | 1.3.6.1.5.5.7.6.37 | RSA-PSS 2048 |
| `MLDSA44_RSA2048_PKCS15_SHA256` | 1.3.6.1.5.5.7.6.38 | RSA-PKCS#1v15 2048 |
| `MLDSA44_ED25519_SHA512` | 1.3.6.1.5.5.7.6.39 | Ed25519 |
| `MLDSA44_ECDSA_P256_SHA256` | 1.3.6.1.5.5.7.6.40 | ECDSA P-256 |
| `MLDSA65_RSA3072_PSS_SHA512` | 1.3.6.1.5.5.7.6.41 | RSA-PSS 3072 |
| `MLDSA65_RSA3072_PKCS15_SHA512` | 1.3.6.1.5.5.7.6.42 | RSA-PKCS#1v15 3072 |
| `MLDSA65_RSA4096_PSS_SHA512` | 1.3.6.1.5.5.7.6.43 | RSA-PSS 4096 |
| `MLDSA65_RSA4096_PKCS15_SHA512` | 1.3.6.1.5.5.7.6.44 | RSA-PKCS#1v15 4096 |
| `MLDSA65_ECDSA_P256_SHA512` | 1.3.6.1.5.5.7.6.45 | ECDSA P-256 |
| `MLDSA65_ECDSA_P384_SHA512` | 1.3.6.1.5.5.7.6.46 | ECDSA P-384 |
| `MLDSA65_ECDSA_BRAINPOOL_P256R1_SHA512` | 1.3.6.1.5.5.7.6.47 | ECDSA Brainpool P-256r1 |
| `MLDSA65_ED25519_SHA512` | 1.3.6.1.5.5.7.6.48 | Ed25519 |
| `MLDSA87_ECDSA_P384_SHA512` | 1.3.6.1.5.5.7.6.49 | ECDSA P-384 |
| `MLDSA87_ECDSA_BRAINPOOL_P384R1_SHA512` | 1.3.6.1.5.5.7.6.50 | ECDSA Brainpool P-384r1 |
| `MLDSA87_ED448_SHAKE256` | 1.3.6.1.5.5.7.6.51 | Ed448 |
| `MLDSA87_RSA3072_PSS_SHA512` | 1.3.6.1.5.5.7.6.52 | RSA-PSS 3072 |
| `MLDSA87_RSA4096_PSS_SHA512` | 1.3.6.1.5.5.7.6.53 | RSA-PSS 4096 |
| `MLDSA87_ECDSA_P521_SHA512` | 1.3.6.1.5.5.7.6.54 | ECDSA P-521 |

These OIDs are returned by `identify_signature_algorithm()` when parsing certificates
that use composite ML-DSA algorithms.  Key generation, signing, and verification are
available from both the Python API (`PrivateKey.generate_composite_ml_dsa(sub_arc)`)
and the Rust API (`PrivateKeyBuilder::composite_ml_dsa(sub_arc)`).

## Prefix OIDs

These are prefix arcs for use with `oid.components()` rather than exact match.

| Constant | OID prefix | Covers |
|---|---|---|
| `RSA` | 1.2.840.113549.1.1 | All PKCS#1 signature algorithms |
| `ECDSA` | 1.2.840.10045.4 | All ECDSA signature algorithms |

```python
# Example: match any RSA algorithm
import synta.oids as oids
rsa_prefix = oids.RSA.components()
if cert.signature_algorithm_oid.components()[:len(rsa_prefix)] == rsa_prefix:
    print("RSA family")
```

## RSA-PSS / OAEP algorithm OIDs (RFC 8017)

| Constant | OID | Description |
|---|---|---|
| `RSASSA_PSS` | 1.2.840.113549.1.1.10 | id-RSASSA-PSS signature algorithm |
| `RSAES_OAEP` | 1.2.840.113549.1.1.7 | id-RSAES-OAEP encryption algorithm |
| `MGF1` | 1.2.840.113549.1.1.8 | id-mgf1 mask generation function |
| `P_SPECIFIED` | 1.2.840.113549.1.1.9 | id-pSpecified label OID |

## RFC 9925 unsigned algorithm OIDs

| Constant | OID | Description |
|---|---|---|
| `ALG_UNSIGNED` | 1.3.6.1.5.5.7.6.36 | id-alg-unsigned — no-signature indicator |
| `RDNA_UNSIGNED` | 1.3.101.119 | id-rdna-unsigned |

## X.509v3 extension OIDs

| Constant | OID | RFC reference |
|---|---|---|
| `SUBJECT_ALT_NAME` | 2.5.29.17 | RFC 5280 |
| `ISSUER_ALT_NAME` | 2.5.29.18 | RFC 5280 |
| `BASIC_CONSTRAINTS` | 2.5.29.19 | RFC 5280 |
| `KEY_USAGE` | 2.5.29.15 | RFC 5280 |
| `EXTENDED_KEY_USAGE` | 2.5.29.37 | RFC 5280 |
| `SUBJECT_KEY_IDENTIFIER` | 2.5.29.14 | RFC 5280 |
| `AUTHORITY_KEY_IDENTIFIER` | 2.5.29.35 | RFC 5280 |
| `CERTIFICATE_POLICIES` | 2.5.29.32 | RFC 5280 |
| `NAME_CONSTRAINTS` | 2.5.29.30 | RFC 5280 §4.2.1.10 |
| `CRL_DISTRIBUTION_POINTS` | 2.5.29.31 | RFC 5280 |
| `ISSUING_DISTRIBUTION_POINT` | 2.5.29.28 | RFC 5280 §5.2.5 |
| `DELTA_CRL_INDICATOR` | 2.5.29.27 | RFC 5280 §5.2.6 |
| `CRL_NUMBER` | 2.5.29.20 | RFC 5280 |
| `INVALIDITY_DATE` | 2.5.29.24 | RFC 5280 |
| `AUTHORITY_INFO_ACCESS` | 1.3.6.1.5.5.7.1.1 | RFC 5280 |
| `AD_OCSP` | 1.3.6.1.5.5.7.48.1 | OCSP access method |
| `AD_CA_ISSUERS` | 1.3.6.1.5.5.7.48.2 | CA Issuers access method |
| `CT_PRECERT_SCTS` | 1.3.6.1.4.1.11129.2.4.2 | RFC 6962 |

## Extended Key Usage (EKU) OIDs

| Constant | OID | Use |
|---|---|---|
| `KP_SERVER_AUTH` | 1.3.6.1.5.5.7.3.1 | TLS server authentication |
| `KP_CLIENT_AUTH` | 1.3.6.1.5.5.7.3.2 | TLS client authentication |
| `KP_CODE_SIGNING` | 1.3.6.1.5.5.7.3.3 | Code signing |
| `KP_EMAIL_PROTECTION` | 1.3.6.1.5.5.7.3.4 | S/MIME |
| `KP_TIME_STAMPING` | 1.3.6.1.5.5.7.3.8 | RFC 3161 TSA |
| `KP_OCSP_SIGNING` | 1.3.6.1.5.5.7.3.9 | OCSP responder |
| `ANY_EXTENDED_KEY_USAGE` | 2.5.29.37.0 | Match any EKU |

## PKINIT OIDs (RFC 4556 / RFC 8636)

| Constant | OID | Description |
|---|---|---|
| `PKINIT_SAN` | 1.3.6.1.5.2.2 | KRB5PrincipalName OtherName type-id |
| `PKINIT_KP_CLIENT_AUTH` | 1.3.6.1.5.2.3.4 | PKINIT client auth EKU |
| `PKINIT_KP_KDC` | 1.3.6.1.5.2.3.5 | PKINIT KDC EKU |
| `PKINIT_AUTH_DATA` | 1.3.6.1.5.2.3.1 | PA-PK-AS-REQ content type |
| `PKINIT_DHKEY_DATA` | 1.3.6.1.5.2.3.2 | DH key data content type |
| `PKINIT_RKEY_DATA` | 1.3.6.1.5.2.3.3 | Reply key pack content type |
| `PKINIT_KDF` | 1.3.6.1.5.2.3.6 | KDF algorithm arc (RFC 8636) |
| `PKINIT_KDF_SHA1` | 1.3.6.1.5.2.3.6.1 | PKINIT KDF with SHA-1 |
| `PKINIT_KDF_SHA256` | 1.3.6.1.5.2.3.6.2 | PKINIT KDF with SHA-256 |
| `PKINIT_KDF_SHA384` | 1.3.6.1.5.2.3.6.4 | PKINIT KDF with SHA-384 |
| `PKINIT_KDF_SHA512` | 1.3.6.1.5.2.3.6.3 | PKINIT KDF with SHA-512 |

## Microsoft PKI OIDs

| Constant | OID | Windows name |
|---|---|---|
| `MS_SAN_UPN` | 1.3.6.1.4.1.311.20.2.3 | `szOID_NT_PRINCIPAL_NAME` — UPN in OtherName |
| `MS_CERTIFICATE_TEMPLATE_NAME` | 1.3.6.1.4.1.311.20.2 | `szOID_CERTIFICATE_TEMPLATE_NAME` (v1) |
| `MS_CERTIFICATE_TEMPLATE` | 1.3.6.1.4.1.311.21.7 | `szOID_CERTIFICATE_TEMPLATE` (v2) |
| `MS_KP_SMARTCARD_LOGON` | 1.3.6.1.4.1.311.20.2.2 | `szOID_MS_KP_SMARTCARD_LOGON` EKU |
| `MS_NTDS_REPLICATION` | 1.3.6.1.4.1.311.25.1 | `szOID_NTDS_REPLICATION` EKU |

## CMS content-type OIDs (RFC 5652)

| Constant | OID | Name |
|---|---|---|
| `CMS_DATA` | 1.2.840.113549.1.7.1 | id-data |
| `CMS_SIGNED_DATA` | 1.2.840.113549.1.7.2 | id-signedData |
| `CMS_ENVELOPED_DATA` | 1.2.840.113549.1.7.3 | id-envelopedData |
| `CMS_DIGESTED_DATA` | 1.2.840.113549.1.7.5 | id-digestedData |
| `CMS_ENCRYPTED_DATA` | 1.2.840.113549.1.7.6 | id-encryptedData |
| `CMS_AUTH_DATA` | 1.2.840.113549.1.9.16.1.2 | id-ct-authData |
| `CMS_ORI` | 1.2.840.113549.1.9.16.13 | OtherRecipientInfo arc (RFC 9629) |
| `CMS_ORI_KEM` | 1.2.840.113549.1.9.16.13.3 | KEMRecipientInfo (RFC 9629) |

## PKCS#9 attribute OIDs

| Constant | OID | Description |
|---|---|---|
| `PKCS9_EMAIL_ADDRESS` | 1.2.840.113549.1.9.1 | emailAddress |
| `PKCS9_CONTENT_TYPE` | 1.2.840.113549.1.9.3 | id-contentType |
| `PKCS9_MESSAGE_DIGEST` | 1.2.840.113549.1.9.4 | id-messageDigest |
| `PKCS9_SIGNING_TIME` | 1.2.840.113549.1.9.5 | id-signingTime |
| `PKCS9_COUNTERSIGNATURE` | 1.2.840.113549.1.9.6 | id-countersignature |
| `PKCS9_CHALLENGE_PASSWORD` | 1.2.840.113549.1.9.7 | id-challengePassword |
| `PKCS9_EXTENSION_REQUEST` | 1.2.840.113549.1.9.14 | id-extensionRequest |
| `PKCS9_FRIENDLY_NAME` | 1.2.840.113549.1.9.20 | id-friendlyName |
| `PKCS9_LOCAL_KEY_ID` | 1.2.840.113549.1.9.21 | id-localKeyId |

## OID helper functions

```python
def identify_signature_algorithm(oid: ObjectIdentifier | str) -> str: ...
# Returns a display name such as "sha256WithRSAEncryption", "ecdsa-with-SHA256",
# "Ed25519", "ML-DSA-65", etc.  Returns "Other" for unknown OIDs.

def identify_public_key_algorithm(oid: ObjectIdentifier | str) -> str | None: ...
# Returns "RSA", "EC", "Ed25519", "ML-DSA-65", etc., or None for unknown OIDs.

def ec_curve_short_name(oid: ObjectIdentifier | str) -> str | None: ...
# Returns the ASN.1 short name, e.g. "prime256v1", "secp384r1".

def ec_curve_nist_name(oid: ObjectIdentifier | str) -> str | None: ...
# Returns the NIST name, e.g. "P-256", "P-384".  None for curves with no NIST name.

def ec_curve_key_bits(oid: ObjectIdentifier | str) -> int | None: ...
# Returns the field size in bits, e.g. 256, 384, 521.

def extension_oid_name(oid: ObjectIdentifier | str) -> str: ...
# Returns a display name, e.g. "X509v3 Subject Alternative Name".
# Returns the dotted-decimal string for unknown OIDs.
```

## Usage

```python
import synta.oids as oids

# Equality comparison against a string
assert oids.EC_PUBLIC_KEY == "1.2.840.10045.2.1"

# Use as a dict key (hashable)
lookup = {oids.SHA256: "SHA-256", oids.SHA384: "SHA-384"}
name = lookup.get(cert.signature_algorithm_oid, "unknown")

# OID helper functions
print(oids.identify_signature_algorithm(cert.signature_algorithm_oid))
print(oids.identify_public_key_algorithm(cert.public_key_algorithm_oid))
```

See also [DN Attribute OIDs](oids-attr.md) and [PKCS#9 OIDs](pkcs9.md).