FromFriendlyName() public static method

public static FromFriendlyName ( string friendlyName, System group ) : System.Security.Cryptography.Oid
friendlyName string
group System
return System.Security.Cryptography.Oid
Example #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);
        }
Example #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
        }
Example #3
0
        public override void SetHashAlgorithm(string strName)
        {
            try
            {
                // Verify the name
                Oid.FromFriendlyName(strName, OidGroup.HashAlgorithm);

                // Uppercase known names as required for BCrypt
                _algName = HashAlgorithmNames.ToUpper(strName);
            }
            catch (CryptographicException)
            {
                // For desktop compat, exception is deferred until VerifySignature
                _algName = null;
            }
        }
Example #4
0
        private static ECCurve CreateFromValueAndName(string oidValue, string oidFriendlyName)
        {
            Oid oid = null;

            if (oidValue == null && oidFriendlyName != null)
            {
                try
                {
                    oid = Oid.FromFriendlyName(oidFriendlyName, OidGroup.PublicKeyAlgorithm);
                }
                catch (CryptographicException)
                {
                }
            }

            oid ??= new Oid(oidValue, oidFriendlyName);
            return(ECCurve.Create(oid));
        }
Example #5
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);
        }