-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[API Proposal]: Expose TLS details for QUIC connection #70184
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBackground and motivationASP.NET Core has an We (asp.net core team) think that this has been discussed and brought up before but I couldn't find an issue in runtime for exposing this information. Tracking in asp.net core: dotnet/aspnetcore#35039 API ProposalI don't have a concrete proposal, but I think this information should probably come from a QUIC connection. QuicConnection.NegotiatedApplicationProtocol is a similar property that exists today. Perhaps something like: public class QuicConnection
{
public QuicTlsDetail NegotiatedTlsDetails { get; } // new
}
public class QuicTlsDetail
{
public SslApplicationProtocol ApplicationProtocol { get; } // if it makes sense to move
// ...various TLS properties
} API Usagevar connection = await listener.AcceptAsync();
var details = connection.NegotiatedTlsDetails;
// use details to populate implementation of ITlsHandshakeFeature Alternative DesignsNo response RisksNo response
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBackground and motivationASP.NET Core has an We (asp.net core team) think that this has been discussed and brought up before but I couldn't find an issue in runtime for exposing this information. Tracking in asp.net core: dotnet/aspnetcore#35039. This doesn't block HTTP/3 for us in .NET 7 but will eventually need to be done. API ProposalI don't have a concrete proposal, but I think this information should probably come from a QUIC connection. QuicConnection.NegotiatedApplicationProtocol is a similar property that exists today. Perhaps something like: public class QuicConnection
{
public QuicTlsDetail NegotiatedTlsDetails { get; } // new
}
public class QuicTlsDetail
{
public SslApplicationProtocol ApplicationProtocol { get; } // if it makes sense to move
// ...various TLS properties
} API Usagevar connection = await listener.AcceptAsync();
var details = connection.NegotiatedTlsDetails;
// use details to populate implementation of ITlsHandshakeFeature Alternative DesignsNo response RisksNo response
|
For comparison, for TLS, we have The underlying info is already exposed by |
I think And there are issues IMHO like #37578 where the info become useless for commonly used My suggestions would be to add We could skip the |
It's better to add these fields now so they're available later when we need them. Especially since when there is a new TLS version it will likely be an internal/OS change, not something at the API level. Is there an easy API take NegotiatedCipherSuite and break it down into parts? I asked SChannel recently for the opposite API and it doesn't exist. |
I don't think there is public API, but internally, we have runtime/src/libraries/System.Net.Security/src/System/Net/Security/TlsCipherSuiteData.cs Line 38 in eae7caa
It is internally used for SslStream on Unixes to populate the TLS-related properties. |
Ha, that's exactly the code I don't want to duplicate. Maybe I'll convince you to put it in shared source like we do for HTTP/2? |
shared location may be good. We may have some updates so we can perhaps do it together. |
To push this a bit more forward, I like the idea of putting out only the NegotiatedCipherSuite and SslProtocol, and moving cipher decomposition to source shared with asp.net. I will update the API proposal. If all is good, I will put this for API Review. |
looks good to me. I feel that would be good start and we can work out the shared component. We can always add something more later if needed or if the shard approach fails for whatever reason. |
namespace System.Net.Quic;
public partial class QuicConnection
{
public SslProtocols SslProtocol { get; }
[CLSCompliant(false)]
public TlsCipherSuite NegotiatedCipherSuite { get; }
} |
Implemented in #106391 |
Background and motivation
ASP.NET Core has an
ITlsHandshakeFeature
type that a dev can use to get information about the TLS connection. We want to support it for HTTP/3: today HTTP/3 only runs on TLS 1.3, but it'll eventually also run on whatever comes after TLS 1.3 and there needs to be a way for people to get that information.We (asp.net core team) think that this has been discussed and brought up before but I couldn't find an issue in runtime for exposing this information. Tracking in asp.net core: dotnet/aspnetcore#35039. This doesn't block HTTP/3 for us in .NET 7 but will eventually need to be done.
API Proposal (edited by @rzikm)
The proposed API adds following two properties.
These properties contain all the relevant information.
API Usage
Potential output:
Alternative Designs
Put all the properties on a new class
QuicConnectionInfo
instead of directly onQuicConnection
. This would be consistent withSslStream
, but would impose an extra allocation (unless we make the new type struct). Furthermore, we already haveNegotiatedApplicationProtocol
onQuicConnection
so it seems preferrable to have all properties directly onQuicConnection
.Decomposition of TlsCipherSuite into individual values as in SslStream
Not applicable anymore, releavant types obsoleted as of #100361
SslStream contains also additional properties which expose additional metadata about the cipher suite, however, not all of these properties make sense for QUIC, see comments inline.
Risks
Possible small risk if some future version of QUIC uses different security protocol for handshake other than TLS (and we cant fit the value into
SslProtocols
enum)The text was updated successfully, but these errors were encountered: