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

Support additional friendly names on OID #36362

Merged
merged 2 commits into from
May 14, 2020
Merged

Conversation

vcsjones
Copy link
Member

Fixes #36342

Adds the ability for OIDs to support mapping multiple friendly names on non-Windows platforms.

The previous design assumed there was a 1:1 for friendly name <-> OID. I'm not sure if this breaks assumptions elsewhere in the framework.

@ghost
Copy link

ghost commented May 13, 2020

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq
Notify danmosemsft if you want to be subscribed.

@vcsjones
Copy link
Member Author

The first commit only changes the dictionary initializer to the cctor builder. The second commit adds additional friendly names.

@@ -237,29 +121,155 @@ internal static partial class OidLookup
{ "1.3.14.7.2.3.1", "md2RSA" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new ones should just be added in this dictionary...

Copy link
Member

@bartonjs bartonjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a second dictionary for "this is not the preferred return value for the OID", it should be used instead of a refactoring.

@vcsjones
Copy link
Member Author

@bartonjs I'm not sure I understand. That dictionary doesn't get used for FriendlyName -> OID. It's used in ToFriendlyName which is used to resolve the friendly name from a given OID.

As far as I can tell, the purpose of that dictionary is to allow going from Oid -> FriendlyName, but not FriendlyName -> Oid. For example, on Linux this fails:

var oid = Oid.FromFriendlyName("RSA_KEYX", OidGroup.All);
Console.WriteLine(oid.Value);

But this will print RSA_KEYX:

var oid2 = Oid.FromOidValue("1.3.14.3.2.22", OidGroup.All);
Console.WriteLine(oid2.FriendlyName);

@bartonjs
Copy link
Member

Ah. OK, then I guess the refactor makes sense. That one does seem to be for when there's more than one OID that points to the same friendly name (on Windows), not more than one friendly name that points to the same OID. So it supported 1:m, not m:m. Hmm.

@bartonjs bartonjs dismissed their stale review May 14, 2020 04:40

I was proven wrong.

@bartonjs bartonjs merged commit ea6a008 into dotnet:master May 14, 2020
@vcsjones vcsjones deleted the fix-36342 branch May 14, 2020 15:40
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ECCurve friendly names are not cross platform
3 participants