Skip to content

fix: preserve provider serialization and prime-check behavior - #54

Open
boorad wants to merge 1 commit into
nodejs:mainfrom
boorad:fix/provider-behavior
Open

boorad wants to merge 1 commit into
nodejs:mainfrom
boorad:fix/provider-behavior

Conversation

@boorad

@boorad boorad commented Oct 26, 2026

Copy link
Copy Markdown

Fix three provider-backed behaviors:

  • Allow an explicitly empty passphrase when writing encrypted SEC1 EC PEM, extending the helper already used for RSA PKCS#1.
  • Preserve explicit EC parameter encoding during SPKI export. Oakley-EC2N-3/4 have valid explicit encodings despite lacking named-curve OIDs; named-curve exports without an OID remain rejected.
  • Honor BignumPointer::isPrime(nchecks) requests above the minimum performed by a single BN_check_prime() call. Repeat checks as needed and preserve callback cancellation/error propagation.

Regression tests cover RSA/EC PEM and DER round trips; binary, empty, missing, and incorrect passphrases; explicit EC SPKI re-export; and prime-check requests of 65/129 rounds plus callback cancellation.

Validation at a0616695e92f9889b8d2fd35f635eb00e1ca4e8b: OpenSSL 3.6.2 on macOS, CMake Release build with NCRYPTO_SHARED_LIBS=ON and NCRYPTO_TESTING=ON, followed by ctest --output-on-failure: 34/34 pass. Changed C++ files pass clang-format and git diff --check.

This PR is independent of the separate EVP-only build-profile proposal.

Signed-off-by: Brad Anderson <brad@sankatygroup.com>
@panva

panva commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

please propose any applicable changes in nodejs/node first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants