Skip to content

Auto-port 5.0: Avoid re-parsing openssl key material with non-cached provider#16761

Merged
chrisvest merged 2 commits into
5.0from
auto-port-pr-16759-to-5.0
May 10, 2026
Merged

Auto-port 5.0: Avoid re-parsing openssl key material with non-cached provider#16761
chrisvest merged 2 commits into
5.0from
auto-port-pr-16759-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16759 to 5.0
Cherry-picked commit: edffed0


Motivation:
The non-caching OpenSslKeyMaterialProvider must check with the KeyManager on every handshake, if the certificate and keys have changed. However, if they haven't then it is a waste of cycles to allocate, serialize, and parse the key material on every handshake.

Modification:
Add a single-entry cache of the key material and do an identity on the key and certificates after the KeyManager look-up. If there's a match, we can reuse the key material we created earlier. Many systems, particularly internal web services, only have a single key and certificate pair, so the single-entry cache will be very effective there.

Result:
Speeds up TLS handshakes when a server is configured with a KeyManagerFactory or KeyManager, and the key/cert pair isn't changing on every handshake.

Motivation:
The non-caching `OpenSslKeyMaterialProvider` must check with the
`KeyManager` on every handshake, if the certificate and keys have
changed. However, if they haven't then it is a waste of cycles to
allocate, serialize, and parse the key material on every handshake.

Modification:
Add a single-entry cache of the key material and do an identity on the
key and certificates after the `KeyManager` look-up. If there's a match,
we can reuse the key material we created earlier. Many systems,
particularly internal web services, only have a single key and
certificate pair, so the single-entry cache will be very effective
there.

Result:
Speeds up TLS handshakes when a server is configured with a
`KeyManagerFactory` or `KeyManager`, and the key/cert pair isn't
changing on every handshake.

(cherry picked from commit edffed0)
@chrisvest chrisvest enabled auto-merge (squash) May 9, 2026 21:46
@chrisvest chrisvest merged commit dc0a5c3 into 5.0 May 10, 2026
12 of 13 checks passed
@chrisvest chrisvest deleted the auto-port-pr-16759-to-5.0 branch May 10, 2026 00:33
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