FromFriendlyName() публичный статический Метод

public static FromFriendlyName ( string friendlyName, System group ) : System.Security.Cryptography.Oid
friendlyName string
group System
Результат System.Security.Cryptography.Oid
Пример #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);
        }
Пример #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
        }
Пример #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;
            }
        }
Пример #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));
        }
Пример #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);
        }