Skip to content

Fix three small issues in x509 generation - #67781

Open
pimterry wants to merge 3 commits into
nodejs:mainfrom
pimterry:fix-x509-gen-pss
Open

pimterry wants to merge 3 commits into
nodejs:mainfrom
pimterry:fix-x509-gen-pss

Conversation

@pimterry

Copy link
Copy Markdown
Member

This is work following on from #67245 after I've finally found some time to review it. This covers three tiny bugs that I found in review, easier to fix than discuss I think:

  • The default config when using RSA keys with PSS padding is broken. The salt length for signing defaults to max, while TLS certs must have the salt length match the digest length (32 bytes for SHA-256, etc). In practice this means some clients (e.g. Go) would reject all these certs with default params as invalid, so every use of PSS has to override the salt length to be usable. This PR changes the default salt length to match the RFC requirement (while still observing any PSS params from the key itself). It reverts the small change to getSaltLength from that PR, since it's no longer used here.
    • Aside: we could consider changing the default in getSaltLength too, currently we pin a historical default there that both OpenSSL and BoringSSL have moved away from. Likely a breaking change though, and I can't say I fully understand the implications. Safer to change just for the new API for now.
  • The PR validates against \0 with SAN names, but not the cert subject. This extends coverage to that too.
  • Accidentally, the validation for AKI & SKI extensions differed. Due to some irrelevant implementation details, OpenSSL rejects empty SKI identifiers (silently dropping the extension, which results in a confusing error in Node) but preserves empty AKI. This PR now validates and rejects empty identifiers in both cases.

Broken into separate commits for each change for easier review, I've tried to keep each fairly small & focused.

Signed-off-by: Tim Perry <pimterry@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
Signed-off-by: Tim Perry <pimterry@gmail.com>
@pimterry
pimterry requested a review from panva November 25, 2026 23:11
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Nov 25, 2026
@pimterry pimterry added the commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants