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

Switch from array to collection expression in OidLookup #100252

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,14 @@ static OidLookup()

private static void InitializeLookupDictionaries()
{
static void AddEntry(string oid, string primaryFriendlyName, string[]? additionalFriendlyNames = null)
static void AddEntry(string oid, string primaryFriendlyName, ReadOnlySpan<string> additionalFriendlyNames = default)
{
s_oidToFriendlyName.Add(oid, primaryFriendlyName);
s_friendlyNameToOid.Add(primaryFriendlyName, oid);

if (additionalFriendlyNames != null)
foreach (string additionalName in additionalFriendlyNames)
{
foreach (var additionalName in additionalFriendlyNames)
{
s_friendlyNameToOid.Add(additionalName, oid);
}
s_friendlyNameToOid.Add(additionalName, oid);
}
}

Expand Down Expand Up @@ -200,10 +197,9 @@ static void AddEntry(string oid, string primaryFriendlyName, string[]? additiona
AddEntry("1.3.133.16.840.63.0.2", "ECDH_STD_SHA1_KDF");
AddEntry("1.3.132.1.11.1", "ECDH_STD_SHA256_KDF");
AddEntry("1.3.132.1.11.2", "ECDH_STD_SHA384_KDF");
#pragma warning disable CA1861 // Avoid constant arrays as arguments. Loaded by static constructor
AddEntry("1.2.840.10045.3.1.7", "ECDSA_P256", new[] { "nistP256", "secP256r1", "x962P256v1", "ECDH_P256" });
AddEntry("1.3.132.0.34", "ECDSA_P384", new[] { "nistP384", "secP384r1", "ECDH_P384" });
AddEntry("1.3.132.0.35", "ECDSA_P521", new[] { "nistP521", "secP521r1", "ECDH_P521" });
AddEntry("1.2.840.10045.3.1.7", "ECDSA_P256", ["nistP256", "secP256r1", "x962P256v1", "ECDH_P256"]);
AddEntry("1.3.132.0.34", "ECDSA_P384", ["nistP384", "secP384r1", "ECDH_P384"]);
AddEntry("1.3.132.0.35", "ECDSA_P521", ["nistP521", "secP521r1", "ECDH_P521"]);
AddEntry("1.2.840.113549.1.9.16.3.5", "ESDH");
AddEntry("2.5.4.42", "G");
AddEntry("2.5.4.43", "I");
Expand All @@ -230,8 +226,7 @@ static void AddEntry(string oid, string primaryFriendlyName, string[]? additiona
AddEntry("1.2.840.113549.1.1.1", "RSA");
AddEntry("1.2.840.113549.1.1.7", "RSAES_OAEP");
AddEntry("1.2.840.113549.1.1.10", "RSASSA-PSS");
AddEntry("2.5.4.8", "S", new[] { "ST" });
#pragma warning restore CA1861 // Avoid constant arrays as arguments
AddEntry("2.5.4.8", "S", ["ST"]);
AddEntry("1.3.132.0.9", "secP160k1");
AddEntry("1.3.132.0.8", "secP160r1");
AddEntry("1.3.132.0.30", "secP160r2");
Expand Down
Loading