Skip to content

Replace OpenSSL with Rust certificate and PKCS#12 libraries #484

Closed

Description

@domenkozar

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:

  • rcgen for certificate generation, using AWS-LC where practical to share the existing crypto backend.
  • x509-parser for certificate parsing and signature verification.
  • p12-keystore for 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:

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.

Related: #481, #483.

Activity

  1. changed the title [-]Replace production OpenSSL with Rust certificate and PKCS#12 libraries[/-] [+]Replace OpenSSL with Rust certificate and PKCS#12 libraries[/+] on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions