示例#1
0
        // Token: 0x060023FA RID: 9210 RVA: 0x00083A68 File Offset: 0x00081C68
        internal static bool DoesRsaKeyOverride(RSA rsaKey, string methodName, Type[] parameterTypes)
        {
            Type type = rsaKey.GetType();

            if (rsaKey is RSACryptoServiceProvider)
            {
                return(true);
            }
            string fullName = type.FullName;

            return(fullName == "System.Security.Cryptography.RSACng" || Utils.DoesRsaKeyOverrideSlowPath(type, methodName, parameterTypes));
        }
示例#2
0
        //
        // Backward-compat hack for third-party RSA-derived classes:
        // 
        // Because the SignHash()/VerifyHash()/Encrypt()/Decrypt() methods are new on RSA, we may 
        // encounter older third-party RSA-derived classes that don't override them
        // (and if they don't override them, these methods will throw since they are effectively abstract methods that had to declared non-abstract
        // for backward compat reasons.)
        //
        internal static bool DoesRsaKeyOverride(RSA rsaKey, string methodName, Type[] parameterTypes)
        {
            // A fast-path check for the common cases where we know we implemented the overrides.
            Type t = rsaKey.GetType();
            if (rsaKey is RSACryptoServiceProvider)
            {
#if DEBUG
                // On checked builds, do the slow-path check anyway so it gets exercised.
                bool foundOverride = DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
                BCLDebug.Assert(foundOverride, "RSACryptoServiceProvider expected to override " + methodName);
#endif
                return true;
            }

            string fullName = t.FullName;
            if (fullName == "System.Security.Cryptography.RSACng")
            {
#if DEBUG
                // On checked builds, do the slow-path check anyway so it gets exercised.
                bool foundOverride = DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
                BCLDebug.Assert(foundOverride, "RSACng expected to override " + methodName);
#endif
                return true;
            }
            return DoesRsaKeyOverrideSlowPath(t, methodName, parameterTypes);
        }