Open rzikm opened 3 months ago
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones See info in area-owners.md if you want to be subscribed.
cc @wfurt, @bartonjs
Let me know if you have any comments/concerns, if not I will put it to the API review queue.
I'm wondering if we should bump the algorithms wincrypt does not have up high so there is less likelihood it will conflict with wincrypt in the future. We did something similar to AddressFamily
Also do we need to split the ephemeral vs static? I'm not sure the difference matters and we can always map either one to the base. For anybody who really needs to know exactly perhaps the TlsCipherSuite is the ultimate answer.
I'll probably lean toward recommendation from @vcsjones and @bartonjs
@vcsjones, @bartonjs do you have any comments/recommendations here?
@bartonjs do you have any comments/recommendations here?
Not really. I can understand the thinking behind why these types exist, but I don't really understand their "purpose". Now that .NET exposes the ciphersuite value there's not much reasoning for these, other than they already exist.
I'm wondering if we should bump the algorithms wincrypt does not have up high so there is less likelihood it will conflict with wincrypt in the future.
If the data on all platforms is already driven by ciphersuite ID, then I wouldn't bother caring who gets what number. If Windows is still pass-through and you want to maintain that for as long as possible, then picking unlikely numbers has merit. Just beware that every now and then Windows comes back and surprises you by adding an algorithm that seemed impossible previously; and if you've already added it to this enum that'll force a mapping (plus have the confusion in the meantime where Windows and non-Windows use different values for the same thing).
OK, so I guess I do have one recommendation: ditch the Windows passthrough and drive everything off of ciphersuite. (Unless the ciphersuite is backformed on Windows from these breakdown products... I guess...)
do we need to split the ephemeral vs static?
It looks like Windows already has been (at least, ECDHE vs ECDH seem different, but DH and DHE are maybe the same?), so probably worth maintaining.
OK, so I guess I do have one recommendation: ditch the Windows passthrough and drive everything off of ciphersuite. (Unless the ciphersuite is backformed on Windows from these breakdown products... I guess...)
we talk about it. And also sharing it with asp.net for Quic. AFAIK most users use this just as convenience for audits.
and TlsCipherSuite is not available in netstandard & Framework so it is hassle for certain user base
I can understand the thinking behind why these types exist, but I don't really understand their "purpose". Now that .NET exposes the ciphersuite value there's not much reasoning for these, other than they already exist.
AFAICT they exist only for logging purposes, so we feel we should either make them up to date or obsolete them and lead users to the TlsCipherSuite
(which as wfurt mentioned is not part of .NET Standard, and, if it changes anything further, is apparently not CLS compliant).
If the data on all platforms is already driven by ciphersuite ID, then I wouldn't bother caring who gets what number.
OK, so I guess I do have one recommendation: ditch the Windows passthrough and drive everything off of ciphersuite. (Unless the ciphersuite is backformed on Windows from these breakdown products... I guess...)
That is the intention, I wanted to do that long time ago in https://github.com/dotnet/runtime/pull/66702, and I can ressurect it once we get this in.
Since there have not been any major concerns, let's queue this for review.
Background and motivation
Enums
ExchangeAlgorithmType
,CipherAlgorithmType
andHashAlgorithmType
haven't been updated in a long time and code which uses them (SslStream
) sometimes even returns values which do not map to existing members. See e.g. https://github.com/dotnet/runtime/issues/55570. Similarly, many algorithms/ciphers belonging to the same general family are being mapped to the same enum member, discarding information in the process.Since the expected use of these properites is mainly logging for auditing purposes, it makes sense to report more specific information.
API Proposal
This proposal adds missing members so that we are on par with
https://github.com/dotnet/runtime/blob/f92b9ef636a4cc9599b33446e30e7a489591ca46/src/libraries/System.Net.Security/src/System/Net/Security/TlsCipherSuiteNameParser.ttinclude#L11-L71
API Usage
The values are expected to be used mainly for logging and audit purposes.
Alternative Designs
The above mentioned enum types are only used on properties of
SslStream
where they expose information about the negotiated TLS cipher suite. All information can be deduced from theSslStream.TlsCipherSuite
so another option is to obsolete all ofSslStream
And leave
TlsCipherSuite
SslStream.NegotiatedCipherSuite
as the only source of truth.Risks
If -- in the future -- Windows adds
ALG_ID
for algorithms we assigned an arbitrary value, the values will no longer be in sync. However, we plan to mitigate this by using the lookup table fromhttps://github.com/dotnet/runtime/blob/f92b9ef636a4cc9599b33446e30e7a489591ca46/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs#L41
on all platforms for consistency between platforms (to fix https://github.com/dotnet/runtime/issues/37578).