-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
tls: optimize root cert handling during startup, store as DER #45768
Copy link
Copy link
Closed as not planned
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Description
Activity
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
The root certificates are currently baked into the binary as PEM - basically base64-encoded binary data.
On startup, node dutifully turns each of the ~140 certifcates into a
X509instance withPEM_read_bio_X509(), which decodes the PEM to DER before passing it tod2i_X509().You can see where this is going: it's a lot more efficient to store the certificates as DER and pass them to
d2i_X509()directly.One caveat:
tls.rootCertificatesis documented to be an array of PEM strings. Can be fixed by turning the DER objects into PEM inGetRootCertificates()insrc/crypto/crypto_context.cc.