Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for exporting TLS Keying Material #12479

Open
sanjerai opened this issue Nov 5, 2024 · 7 comments
Open

Add support for exporting TLS Keying Material #12479

sanjerai opened this issue Nov 5, 2024 · 7 comments

Comments

@sanjerai
Copy link

sanjerai commented Nov 5, 2024

Jetty version(s)
Jetty 11.0.20+

Enhancement Description
RFC5705 defines and RFC8446 updates keying material exporters for TLS:

Many other TLS implementations already support it:

5G mobile specs mandate the use of TLS session at app level for JWE:

We have a Spring + jetty client code base communicating over TLS1.3 and HTTP2. We have a use case to export TLS keying material or the master secret. We need this information to further derive keys for JWE tokens ciphering.

@sbordet
Copy link
Contributor

sbordet commented Nov 5, 2024

@sanjerai OpenJDK does not provide any API to access the TLS exporters, so there is nothing that Jetty can do.

You may want to open an OpenJDK issue, and I would gladly support this, since it is required also for QUIC+TLS, which is currently not possible to implement using OpenJDK APIs.

@sanjerai
Copy link
Author

sanjerai commented Nov 5, 2024

@sbordet enhancement has been raised for open jdk https://bugs.openjdk.org/browse/JDK-8341346.
Once complete we can track jetty changes with this current issue.

@sbordet
Copy link
Contributor

sbordet commented Nov 5, 2024

@sanjerai thanks for the link to the OpenJDK bug.

Just to set expectations, realize that that issue will be fixed in Java 25 or later, and it will take a while (years) before adoption widespreads, so do not hold your breath 😄

@sanjerai
Copy link
Author

@sbordet netty seems to have such functionality added in netty project https://netty.io/4.1/api/io/netty/handler/ssl/SslMasterKeyHandler.html
do you think we can have something similar for jetty as well?

@sbordet
Copy link
Contributor

sbordet commented Nov 28, 2024

I looked at the Netty implementation and it uses deep reflection on JDK classes, which is forbidden in modern JDK unless opening up the java.base module.

I'm not really keen to do that.

Seems strange that you have a requirement to export the key material or the master secret of a TLS connection, seems like this would open up for vulnerabilities.

Can you detail why you need this feature?
Seems to me you don't need the key material, but just access to the HKDF-Expand function (which is necessary for QUIC too), but while the JDK has an implementation, it is not public.

@sanjerai
Copy link
Author

@sbordet we need this to derive key at client and server side as per 5G mobile specs. we have to directly use the master key and a known salt to generate a single HMAC output, from which we will extracts the required length. this is to make sure as per 5G specs both networks client server use same derived key.

@sbordet
Copy link
Contributor

sbordet commented Nov 28, 2024

@sanjerai there might be hope, see https://openjdk.org/jeps/478.

I'm hoping that along with the KDF APIs there will be API additions to extract the master key from the SSLSession without using deep reflection.

If that is true, then what you need would be doable in Java 24.

If it is doable, then we can have a Jetty class that uses those new APIs via non-deep reflection, and expose this feature.

If you're willing to do it, can you check JEP 478 and see if this new API would be enough for you to implement your use case?

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

No branches or pull requests

2 participants