Skip to content

fix(crypto): check x509 private keys#4303

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-x509-check-private-key
Jun 4, 2026
Merged

fix(crypto): check x509 private keys#4303
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-x509-check-private-key

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • adds bound X509Certificate#checkPrivateKey(privateKey) dispatch and property exposure
  • validates pkey as a KeyObject and rejects public/secret KeyObjects with Node-shaped ERR_INVALID_ARG_VALUE
  • compares RSA certificate public keys against the public key derived from a private KeyObject surrogate
  • returns true for the matching RSA private key and false for mismatched RSA or unsupported non-RSA private keys
  • adds focused Node/Perry parity coverage for success, mismatch, and validation behavior

Non-goals

Validation

  • cargo fmt --all --check
  • npm exec --package=node@26 -- node --experimental-strip-types test-parity/node-suite/crypto/x509/check-private-key.ts
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-x509-check-private-key-check cargo check -p perry-stdlib --no-default-features --features crypto
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-x509-check-private-key-build cargo build -p perry --release
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-x509-check-private-key-build cargo build -p perry-runtime -p perry-stdlib --release
  • direct Perry run of test-parity/node-suite/crypto/x509/check-private-key.ts
  • PATH=<node26-bin>:$PATH CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-x509-check-private-key-build PERRY_RUNTIME_DIR=/root/perry-worktrees/.build-targets/perry-x509-check-private-key-build/release PERRY_NO_AUTO_OPTIMIZE=1 PERRY_GEN_GC=0 ./run_parity_tests.sh --suite node-suite --module crypto --filter x509/check-private-key
  • git diff --check
  • ./scripts/check_file_size.sh

@proggeramlug proggeramlug force-pushed the codex/node-x509-check-private-key branch from 0a61ad9 to ed82cbc Compare June 4, 2026 11:49
@proggeramlug proggeramlug marked this pull request as ready for review June 4, 2026 11:50
@proggeramlug proggeramlug merged commit dfc1cdf into PerryTS:main Jun 4, 2026
11 of 12 checks passed
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