-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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] Expand ExchangeAlgorithmType, CipherAlgorithmType, HashAlgorithmType #100361
Comments
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
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. 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 |
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.
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...)
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. |
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 |
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
That is the intention, I wanted to do that long time ago in #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. |
namespace System.Security.Authentication
{
+ [Obsolete]
public enum ExchangeAlgorithmType { }
+ [Obsolete]
public enum CipherAlgorithmType { }
+ [Obsolete]
public enum HashAlgorithmType { }
}
namespace System.Net.Security
{
+ [Obsolete]
public virtual ExchangeAlgorithmType KeyExchangeAlgorithm { get; }
+ [Obsolete]
public virtual int KeyExchangeStrength { get; }
+ [Obsolete]
public virtual CipherAlgorithmType CipherAlgorithm { get; }
+ [Obsolete]
public virtual int CipherStrength { get; }
+ [Obsolete]
public virtual HashAlgorithmType HashAlgorithm { get; }
+ [Obsolete]
public virtual int HashStrength { get; }
} |
Looks like the enums are used in other runtime places after all :/ runtime/src/libraries/System.DirectoryServices.Protocols/ref/System.DirectoryServices.Protocols.cs Lines 658 to 668 in 1487522
This seems to belong to code around There does not seem to be any API to get TlsCipherSuite (nor easy way to implement it), and it also seems that only Windows implementation supports TLS. What is the API review teams guidance, @bartonjs ?
|
It's still going to have the same problem on LdapConnection: the returned values won't necessarily map to anything. (Though I assume for LdapConnection it's just passing through the Windows values, so someone could map it later). I'd say obsolete those properties on LdapConnection, too... I doubt anyone would be really upset. |
Done in #105875. |
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. #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
runtime/src/libraries/System.Net.Security/src/System/Net/Security/TlsCipherSuiteNameParser.ttinclude
Lines 11 to 71 in f92b9ef
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
wherethey expose information about the negotiated TLS cipher suite. All information
can be deduced from the
SslStream.TlsCipherSuite
so another option is toobsolete all of
SslStream
And leave
TlsCipherSuite
SslStream.NegotiatedCipherSuite
as the only source of truth.Risks
If -- in the future -- Windows adds
ALG_ID
for algorithms we assigned anarbitrary value, the values will no longer be in sync. However, we plan to mitigate this by using the lookup table from
runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.Unix.cs
Line 41 in f92b9ef
on all platforms for consistency between platforms (to fix #37578).
The text was updated successfully, but these errors were encountered: