feat: add CRL support in generation and validation - #987
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands PKI support across server, CLI, Web UI, and tests by adding CRL generation + public CRL distribution, strengthening CRL-based validation behavior, and updating related KMIP/TTLV and export paths (including PQC Raw export support).
Changes:
- Add CRL generation (authenticated) and public CRL distribution point endpoint (unauthenticated), plus auto-injection of CDP into issued certificates when
kms_public_urlis set. - Strengthen certificate validation around CRLs (freshness checks, signature handling) and persist revocation reasons needed for CRL entries; fix TTLV normalization for structured
RevocationReason. - Add PQC key export as
KeyFormatType::Raw(non-FIPS) plus new vectors/tests and related documentation/CORS behavior updates.
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/menuItems.tsx | Adds a new “Generate CRL” menu entry under Certificates. |
| ui/src/App.tsx | Registers a new React route for the Generate CRL form. |
| ui/src/actions/Certificates/CertificateGenerateCrl.tsx | New UI form that calls the CRL REST endpoint and downloads DER/PEM. |
| documentation/docs/use_cases/pki.md | Documents CRL generation and clarifies unsupported Delta CRLs. |
| documentation/docs/configuration/tls.md | Adds ANSSI TLS recommendations note. |
| documentation/docs/configuration/server_configuration_file.md | Clarifies CORS defaults and interaction with kms_public_url. |
| crate/test_kms_server/src/vector_runner.rs | Extends vector runner with {{hex:...}}, AllocTempFile, and GenerateCrl steps; adds new vector tests. |
| crate/test_kms_server/src/pqc_export_tests.rs | New non-FIPS PQC export-as-Raw roundtrip tests. |
| crate/test_kms_server/src/lib.rs | Wires in new CRL and PQC export test modules. |
| crate/test_kms_server/src/crl_tests.rs | New integration tests covering CRL generation and CRL-based validation lifecycle. |
| crate/test_kms_server/README.md | Updates vector counts and lists new vectors. |
| crate/test_kms_server/Cargo.toml | Adds deps needed by new tests/vector-runner capabilities. |
| crate/server/src/start_kms_server.rs | Registers CRL routes (authenticated + public) in Actix app/scope. |
| crate/server/src/routes/mod.rs | Adds the new crl routes module. |
| crate/server/src/routes/crl.rs | Implements authenticated CRL generation and public cached CRL serving. |
| crate/server/src/core/operations/validate.rs | Tightens CRL validation handling (freshness checks, signature rules, file:// handling, soft-fail for unreachable CRLs). |
| crate/server/src/core/operations/revoke.rs | Persists revocation reasons/metadata needed for CRL generation. |
| crate/server/src/core/operations/mod.rs | Exposes the new generate_crl operation module. |
| crate/server/src/core/operations/generate_crl.rs | Implements CRL generation, selection of revoked certs, and in-memory caching for public serving. |
| crate/server/src/core/operations/export_get.rs | Adds non-FIPS PQC PKCS#8/SPKI → Raw conversion during export. |
| crate/server/src/core/operations/certify/subject.rs | Adds detection of existing CDP extension to avoid injecting duplicates. |
| crate/server/src/core/operations/certify/certify_op.rs | Passes kms_public_url into certificate building for CDP injection. |
| crate/server/src/core/operations/certify/build_certificate.rs | Injects server CDP extension when appropriate; adds DER length helper. |
| crate/server/src/config/params/server_params.rs | Automatically includes kms_public_url in default CORS allow-list when cors_allowed_origins is unset + adds unit tests. |
| crate/server/documentation/openapi.yaml | Documents new CRL endpoints in OpenAPI. |
| crate/kmip/src/ttlv/normalize.rs | Fixes AttributeValue normalization to preserve structured types; adds regression tests. |
| crate/kmip/src/kmip_0/kmip_types.rs | Adds vendor-extension revocation reason codes required for CRL completeness. |
| crate/crypto/src/openssl/mod.rs | Exposes new OpenSSL CRL module. |
| crate/crypto/src/openssl/crl.rs | New OpenSSL-sys based CRL builder implementation + unit tests. |
| crate/crypto/src/crypto/pqc/mod.rs | Adds PKCS#8/SPKI → Raw extraction helpers + tests for conversion roundtrips. |
| crate/crypto/Cargo.toml | Adds deps needed by new OpenSSL CRL builder module. |
| crate/clients/client/src/kms_rest_client.rs | Adds get_bytes() helper for non-JSON REST responses (DER/PEM). |
| crate/clients/client/src/http_client/login.rs | Fixes OAuth callback server startup race by pre-binding the callback port. |
| crate/clients/clap/src/actions/certificates/mod.rs | Registers new ckms certificates generate-crl command. |
| crate/clients/clap/src/actions/certificates/generate_crl.rs | Implements CLI action calling REST CRL endpoint and writing output file. |
| crate/clients/ckms/src/tests/certificates/certify.rs | Updates test expectations for CDP URL fixture. |
| CHANGELOG/fix_put_kms_public_url_in_allowed_cors_by_default.md | Adds branch-specific changelog entries covering CRL, PQC export, CORS, and related changes. |
| Cargo.lock | Updates lockfile for newly added dependencies. |
acfb590 to
8f2ebff
Compare
629b34d to
1c7fd8d
Compare
05a4a4f to
a7e4fe5
Compare
d40a530 to
089f3a2
Compare
089f3a2 to
4714b9b
Compare
88f57da to
1a16dbd
Compare
5ed738b to
eec713b
Compare
4d1acce to
e0f6267
Compare
5acf494 to
3d448aa
Compare
1b0e5f0 to
3e58b01
Compare
375485d to
c74639a
Compare
c74639a to
9e22500
Compare
Bug: Public CRL distribution point is not primed by certificate revocationPR / branch: #987 · SummaryThe public CRL endpoint Steps to reproduce
Expected vs actual
Evidence
Likely root causeThe auto-trigger on revoke ( Open verification (one step)Confirm on a clean DB that step 4 is 404 immediately after revoke and before any Suggested fixes
Related finding (separate ticket)
|
9e22500 to
98aa85f
Compare
98aa85f to
b62c3bb
Compare
1 — X.509 CRL generation
A new
GenerateCrlKMIP-like operation builds an X.509 v2 CRL for a given CAcertificate. It queries all revoked certificates (state
DeactivatedorCompromised) whoseCertificateLinkpoints to the issuer, signs the CRLwith the issuer's private key, and returns the DER bytes.
The CRL is also written to an in-memory per-issuer cache so the
unauthenticated
GET /public/certificates/{id}/crlendpoint can serve itwithout access to key material. The cache is refreshed on every authenticated
GenerateCrlcall and cleared on server restart.CLI:
ckms certificates generate-crl --issuer-certificate-id <ID>.2 — PQC key format conversions (
crate/crypto/src/crypto/pqc/mod.rs)Adds two public converters for all PQC algorithm families
(ML-DSA-44/65/87, ML-KEM-512/768/1024, SLH-DSA all 12 variants,
hybrid KEMs X25519MLKEM768 / X448MLKEM1024):
pqc_private_key_pkcs8_to_raw(pkcs8_der)EVP_PKEY_get_raw_private_keypqc_public_key_spki_to_raw(spki_der)EVP_PKEY_get_raw_public_keyThese converters allow any KMIP client that requests a PQC key in
KeyFormatType::Raw(required for ML-KEM encapsulation in hybrid TLS, or forinterop with libraries that do not parse DER) to get raw seed bytes from a key
that was generated or imported in PKCS#8 / SPKI form. RAII guards (
PKeyGuard,BioGuard) ensure no key material leaks on error paths.3 — Security advisories