Repository navigation
Replace OpenSSL with Rust certificate and PKCS#12 libraries #484
Description
The X.509 identity implementation in #483 introduces a vendored OpenSSL dependency for certificate generation, PKCS#12 import/export, key matching, and certificate-chain validation. It also adds platform-specific build requirements, including selecting different Perl implementations for MSVC and MinGW.
Track a follow-up migration to Rust certificate and PKCS#12 libraries. HTTP clients already use rustls; rustls itself does not replace the certificate-generation and archive operations used here.
Proposed libraries:
rcgenfor certificate generation, using AWS-LC where practical to share the existing crypto backend.x509-parserfor certificate parsing and signature verification.p12-keystorefor PKCS#12 decoding and writing, using its proposed bag-preserving archive API before applying SecretSpec's validation rules.
Upstream dependencies
The initial compatibility prototype found bag loss and Unicode-password incompatibilities. Fixes have been proposed upstream:
- Preserve decoded PKCS#12 bags and avoid imported alias overwrites ancwrd1/p12-keystore#13: expose decoded bags before linking/filtering, retain duplicates and unrelated certificates, and avoid imported alias overwrites.
- pkcs12: support supplementary Unicode passwords in UTF-8 KDF RustCrypto/formats#2477: support supplementary Unicode passwords using OpenSSL-compatible UTF-16BE encoding while retaining the strict BMP API.
With both patches applied, six local compatibility probes pass, including OpenSSL import/export in both directions, empty and protected passwords, supplementary Unicode passwords, duplicate/unrelated certificate preservation, and key/certificate friendly-name collisions.
Acceptance criteria
- Replace production OpenSSL usage without changing the canonical PKCS#12 identity format or typed projection behavior.
- Preserve password handling, wrong-password rejection, private-key matching, validity checks, chain reconstruction, signature verification, and rejection of duplicate, ambiguous, unrelated, or oversized chains.
- Preserve the supported imported key types; investigate and document any compatibility gaps before switching.
- Preserve PEM/DER output, certificate-chain projections, secret redaction, and temporary-file ownership/permissions.
- Preserve the modern PKCS#12 output profile: AES-256-CBC, SHA-256 MAC, and 100,000 encryption/MAC iterations.
- Retain independent OpenSSL interoperability fixtures/tests, including malformed archives and Unicode passwords.
- Pass Rust, SDK, minimal-feature, Linux, macOS, MSVC, and MinGW/Haskell CI checks.
- Use released upstream dependencies for the final migration and remove OpenSSL-specific production build workarounds.
Migration development can proceed on a separate branch using patched forks while upstream review is underway. This follow-up should not block landing or releasing #483 with OpenSSL.
Activity
[-]Replace production OpenSSL with Rust certificate and PKCS#12 libraries[/-][+]Replace OpenSSL with Rust certificate and PKCS#12 libraries[/+]