PKI
Parse, build and verify X.509 certificates, CSRs and CRLs, validate certification paths and sign CMS SignedData.
The PKI family uses the existing signature key classes: RSA, ECDSA (P-256, P-384, P-521), Ed25519, Ed448 and ML-DSA keys sign and verify certificates, requests, revocation lists and CMS messages. Public keys read from a certificate or request come back as those classes.
Parsing failures, invalid parameters and keys that do not match the requested
algorithm raise ValueError. Inputs of the wrong Python type raise
TypeError. verify returns True or False.
Capabilities
- X.509 Certificates, PKCS#10 requests and CRLs (RFC 5280, RFC 2986): parse, build and verify signatures.
- Path validation RFC 5280 certification paths for TLS server
and client certificates through
rustls-webpki. - CMS SignedData (RFC 5652), attached and detached, experimental.
Signature algorithms
| Key | Algorithms | Selector |
|---|---|---|
| RSA | PKCS #1 v1.5 and PSS with SHA-256, SHA-384 or SHA-512 | RSA.PKCS1V15_SHA256 (default), RSA.PSS_SHA384, ... |
| ECDSA P-256, P-384, P-521 | ECDSA with SHA-256, SHA-384 or SHA-512 | SHA2.SHA256, ...; default follows the curve |
| Ed25519, Ed448 | Pure EdDSA (RFC 8410) | None; Ed25519ph and Ed448ph keys raise ValueError |
| ML-DSA-44, -65, -87 | Pure ML-DSA (RFC 9881) | None |
Zeroization
Note
The PKI code keeps no private key material: signing calls the key's own
sign method, so the zeroization behavior of each key class applies.
Certificates, CRLs, to-be-signed data, CMS content and signatures are copied
into Rust buffers that are not wiped.