System\Security\Cryptography\X509Certificates\X500NameEncoder.cs (60)
33private static readonly Lazy<Dictionary<string, EncodingRules>> s_lazyEncodingRulesLookup = new(CreateEncodingRulesLookup);
527case EncodingRules.IA5String:
530case EncodingRules.UTF8String:
531case EncodingRules.DirectoryString or EncodingRules.Unknown when forceUtf8Encoding:
534case EncodingRules.NumericString:
537case EncodingRules.PrintableString:
540case EncodingRules.DirectoryString:
541case EncodingRules.Unknown:
553goto case EncodingRules.Unknown;
586private static Dictionary<string, EncodingRules> CreateEncodingRulesLookup()
594Dictionary<string, EncodingRules> lookup = new(LookupDictionarySize, StringComparer.Ordinal)
596{ Oids.KnowledgeInformation, EncodingRules.DirectoryString },
597{ Oids.CommonName, EncodingRules.DirectoryString },
598{ Oids.Surname, EncodingRules.DirectoryString },
599{ Oids.SerialNumber, EncodingRules.PrintableString },
600{ Oids.CountryOrRegionName, EncodingRules.PrintableString },
601{ Oids.LocalityName, EncodingRules.DirectoryString },
602{ Oids.StateOrProvinceName, EncodingRules.DirectoryString },
603{ Oids.StreetAddress, EncodingRules.DirectoryString },
604{ Oids.Organization, EncodingRules.DirectoryString },
605{ Oids.OrganizationalUnit, EncodingRules.DirectoryString },
606{ Oids.Title, EncodingRules.DirectoryString },
607{ Oids.Description, EncodingRules.DirectoryString },
608{ Oids.BusinessCategory, EncodingRules.DirectoryString },
609{ Oids.PostalCode, EncodingRules.DirectoryString },
610{ Oids.PostOfficeBox, EncodingRules.DirectoryString },
611{ Oids.PhysicalDeliveryOfficeName, EncodingRules.DirectoryString },
612{ Oids.TelephoneNumber, EncodingRules.PrintableString },
613{ Oids.X121Address, EncodingRules.NumericString },
614{ Oids.InternationalISDNNumber, EncodingRules.NumericString },
615{ Oids.DestinationIndicator, EncodingRules.PrintableString },
616{ Oids.Name, EncodingRules.DirectoryString },
617{ Oids.GivenName, EncodingRules.DirectoryString },
618{ Oids.Initials, EncodingRules.DirectoryString },
619{ Oids.GenerationQualifier, EncodingRules.DirectoryString },
620{ Oids.DnQualifier, EncodingRules.PrintableString },
621{ Oids.HouseIdentifier, EncodingRules.DirectoryString },
622{ Oids.DmdName, EncodingRules.DirectoryString },
623{ Oids.Pseudonym, EncodingRules.DirectoryString },
624{ Oids.UiiInUrn, EncodingRules.UTF8String },
625{ Oids.ContentUrl, EncodingRules.UTF8String },
626{ Oids.Uri, EncodingRules.UTF8String },
627{ Oids.Urn, EncodingRules.UTF8String },
628{ Oids.Url, EncodingRules.UTF8String },
629{ Oids.UrnC, EncodingRules.PrintableString },
630{ Oids.EpcInUrn, EncodingRules.DirectoryString },
631{ Oids.LdapUrl, EncodingRules.UTF8String },
632{ Oids.OrganizationIdentifier, EncodingRules.DirectoryString },
633{ Oids.CountryOrRegionName3C, EncodingRules.PrintableString },
634{ Oids.CountryOrRegionName3N, EncodingRules.NumericString },
635{ Oids.DnsName, EncodingRules.UTF8String },
636{ Oids.IntEmail, EncodingRules.UTF8String },
637{ Oids.JabberId, EncodingRules.UTF8String },
638{ Oids.EmailAddress, EncodingRules.IA5String },
664private static EncodingRules LookupEncodingRules(ReadOnlySpan<char> oid)
666Dictionary<string, EncodingRules> lookup = s_lazyEncodingRulesLookup.Value;
667Dictionary<string, EncodingRules>.AlternateLookup<ReadOnlySpan<char>> alternateLookup =
669return alternateLookup.TryGetValue(oid, out EncodingRules rules) ? rules : EncodingRules.Unknown;