Closed dtivel closed 1 year ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones See info in area-owners.md if you want to be subscribed.
Author: | dtivel |
---|---|
Assignees: | - |
Labels: | `area-System.Security`, `untriaged` |
Milestone: | - |
Yeah, the curve name here is case sensitive, but only on Windows.
I hit this because the curve name was being passed via CLI argument.
My 2 cents here, but I would not blindly take the curve name from user input and feed it directly in to curve construction. The list of curves should be tightened to desired / supported curves. This is to make sure not only that strong curves are used, but also are limited to curves that are supported by all platforms.
I guess we can change the ECCurve matcher to match FriendlyName (Windows) with case insensitive.
It'll probably be a different bug one day, where something curve123 and Curve123 are from different groups and actually are different curves... but until then I guess this is the muck we get to live in because Windows identifies curves by friendly names instead of OIDs.
Since it's an issue in existing versions, we've not already promised it for this release, and we're basically out of runway... vNext.
My 2 cents here, but I would not blindly take the curve name from user input and feed it directly in to curve construction.
Yeah, that, too :smile:
Also, if the curve name is entirely unrecognized there's probably a more clear error. This is "when it has different casing than Windows' canonical representation"
Description
When an ECDSA named curve is unrecognized,
CertificateRequest.CreateSelfSigned(...)
raises a confusing exception.This is similar in confusing-ness to https://github.com/dotnet/runtime/issues/42751, though @vcsjones thinks this is actually related to https://github.com/dotnet/runtime/issues/61767.
Reproduction Steps
Run the following program:
Expected behavior
An exception indicating that an
ECCurve
with the namenistp256
could not be found.Actual behavior
A confusing exception:
Regression?
No response
Known Workarounds
Use proper casing with the named curve (e.g.:
nistP256
notnistp256
).Configuration
Other information
It was suggested that I use the property
ECCurve.NamedCurves.nistP256
instead:Good feedback. However, I hit this because the curve name was being passed via CLI argument. This is why I used
ECCurve.CreateFromFriendlyName(...)
instead.