Esempio n. 1
0
        public static string MapNameToOID(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            string oidName;

            // Check to see if we have an application defined mapping
            lock (s_InternalSyncObject)
            {
                if (!appOidHT.TryGetValue(name, out oidName))
                {
                    oidName = null;
                }
            }

            if (string.IsNullOrEmpty(oidName) && !DefaultOidHT.TryGetValue(name, out oidName))
            {
                try
                {
                    Oid oid = Oid.FromFriendlyName(name, OidGroup.All);
                    oidName = oid.Value;
                }
                catch (CryptographicException) { }
            }

            return(oidName);
        }
Esempio n. 2
0
        public static string?MapNameToOID(string name)
        {
#if BROWSER
            throw new PlatformNotSupportedException(SR.SystemSecurityCryptography_PlatformNotSupported);
#else
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            appOidHT.TryGetValue(name, out string?oidName);

            if (string.IsNullOrEmpty(oidName) && !DefaultOidHT.TryGetValue(name, out oidName))
            {
                try
                {
                    Oid oid = Oid.FromFriendlyName(name, OidGroup.All);
                    oidName = oid.Value;
                }
                catch (CryptographicException) { }
            }

            return(oidName);
#endif
        }
Esempio n. 3
0
        public static string?MapNameToOID(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            appOidHT.TryGetValue(name, out string?oidName);

            if (string.IsNullOrEmpty(oidName) && !DefaultOidHT.TryGetValue(name, out oidName))
            {
                try
                {
                    Oid oid = Oid.FromFriendlyName(name, OidGroup.All);
                    oidName = oid.Value;
                }
                catch (CryptographicException) { }
            }

            return(oidName);
        }