using System; using System.Collections; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; using System.Security.Policy; using System.Text; namespace System.Security { /// Provides the main access point for classes interacting with the security system. This class cannot be inherited. // Token: 0x020005D4 RID: 1492 [ComVisible(true)] public static class SecurityManager { /// Gets or sets a value indicating whether code must have in order to execute. /// true if code must have in order to execute; otherwise, false. /// The code that calls this method does not have . /// /// /// // Token: 0x17000AAF RID: 2735 // (get) Token: 0x0600367B RID: 13947 // (set) Token: 0x0600367C RID: 13948 public static extern bool CheckExecutionRights { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; } /// Gets or sets a value indicating whether security is enabled. /// true if security is enabled; otherwise, false. /// The code that calls this method does not have . // Token: 0x17000AB0 RID: 2736 // (get) Token: 0x0600367D RID: 13949 // (set) Token: 0x0600367E RID: 13950 [Obsolete("The security manager cannot be turned off on MS runtime")] public static extern bool SecurityEnabled { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; } /// Gets the granted zone identity and URL identity permission sets for the current assembly. /// An output parameter that contains a of granted objects. /// An output parameter that contains a of granted objects. /// The request for failed. /// /// /// // Token: 0x0600367F RID: 13951 RVA: 0x000BA934 File Offset: 0x000B8B34 [MonoTODO("CAS support is experimental (and unsupported). This method only works in FullTrust.")] public static void GetZoneAndOrigin(out ArrayList zone, out ArrayList origin) { zone = new ArrayList(); origin = new ArrayList(); } /// Determines whether a permission is granted to the caller. /// true if the permissions granted to the caller include the permission ; otherwise, false. /// The permission to test against the grant of the caller. /// /// /// // Token: 0x06003680 RID: 13952 RVA: 0x000BA944 File Offset: 0x000B8B44 public static bool IsGranted(IPermission perm) { return perm == null || !SecurityManager.SecurityEnabled || SecurityManager.IsGranted(Assembly.GetCallingAssembly(), perm); } // Token: 0x06003681 RID: 13953 RVA: 0x000BA968 File Offset: 0x000B8B68 internal static bool IsGranted(Assembly a, IPermission perm) { PermissionSet grantedPermissionSet = a.GrantedPermissionSet; if (grantedPermissionSet != null && !grantedPermissionSet.IsUnrestricted()) { CodeAccessPermission codeAccessPermission = (CodeAccessPermission)grantedPermissionSet.GetPermission(perm.GetType()); if (!perm.IsSubsetOf(codeAccessPermission)) { return false; } } PermissionSet deniedPermissionSet = a.DeniedPermissionSet; if (deniedPermissionSet != null && !deniedPermissionSet.IsEmpty()) { if (deniedPermissionSet.IsUnrestricted()) { return false; } CodeAccessPermission codeAccessPermission2 = (CodeAccessPermission)a.DeniedPermissionSet.GetPermission(perm.GetType()); if (codeAccessPermission2 != null && perm.IsSubsetOf(codeAccessPermission2)) { return false; } } return true; } // Token: 0x06003682 RID: 13954 RVA: 0x000BAA00 File Offset: 0x000B8C00 internal static IPermission CheckPermissionSet(Assembly a, PermissionSet ps, bool noncas) { if (ps.IsEmpty()) { return null; } foreach (object obj in ps) { IPermission permission = (IPermission)obj; if (!noncas && permission is CodeAccessPermission) { if (!SecurityManager.IsGranted(a, permission)) { return permission; } } else { try { permission.Demand(); } catch (SecurityException) { return permission; } } } return null; } // Token: 0x06003683 RID: 13955 RVA: 0x000BAACC File Offset: 0x000B8CCC internal static IPermission CheckPermissionSet(AppDomain ad, PermissionSet ps) { if (ps == null || ps.IsEmpty()) { return null; } PermissionSet grantedPermissionSet = ad.GrantedPermissionSet; if (grantedPermissionSet == null) { return null; } if (grantedPermissionSet.IsUnrestricted()) { return null; } if (ps.IsUnrestricted()) { return new SecurityPermission(SecurityPermissionFlag.NoFlags); } foreach (object obj in ps) { IPermission permission = (IPermission)obj; if (permission is CodeAccessPermission) { CodeAccessPermission codeAccessPermission = (CodeAccessPermission)grantedPermissionSet.GetPermission(permission.GetType()); if (codeAccessPermission == null) { if ((!grantedPermissionSet.IsUnrestricted() || !(permission is IUnrestrictedPermission)) && !permission.IsSubsetOf(null)) { return permission; } } else if (!permission.IsSubsetOf(codeAccessPermission)) { return permission; } } else { try { permission.Demand(); } catch (SecurityException) { return permission; } } } return null; } /// Loads a from the specified file. /// The loaded . /// The physical file path to a file containing the security policy information. /// One of the values. /// The parameter is null. /// The file indicated by the parameter does not exist. /// The code that calls this method does not have .-or- The code that calls this method does not have .-or- The code that calls this method does not have .-or- The code that calls this method does not have . /// /// /// /// // Token: 0x06003684 RID: 13956 RVA: 0x000BAC14 File Offset: 0x000B8E14 public static PolicyLevel LoadPolicyLevelFromFile(string path, PolicyLevelType type) { if (path == null) { throw new ArgumentNullException("path"); } PolicyLevel policyLevel = null; try { policyLevel = new PolicyLevel(type.ToString(), type); policyLevel.LoadFromFile(path); } catch (Exception ex) { throw new ArgumentException(Locale.GetText("Invalid policy XML"), ex); } return policyLevel; } /// Loads a from the specified string. /// The loaded . /// The XML representation of a security policy level in the same form in which it appears in a configuration file. /// One of the values. /// The parameter is null. /// The parameter is not valid. /// The code that calls this method does not have . /// /// /// // Token: 0x06003685 RID: 13957 RVA: 0x000BAC88 File Offset: 0x000B8E88 public static PolicyLevel LoadPolicyLevelFromString(string str, PolicyLevelType type) { if (str == null) { throw new ArgumentNullException("str"); } PolicyLevel policyLevel = null; try { policyLevel = new PolicyLevel(type.ToString(), type); policyLevel.LoadFromString(str); } catch (Exception ex) { throw new ArgumentException(Locale.GetText("Invalid policy XML"), ex); } return policyLevel; } /// Provides an enumerator to access the security policy hierarchy by levels, such as computer policy and user policy. /// An for objects that compose the security policy hierarchy. /// The code that calls this method does not have . /// /// /// // Token: 0x06003686 RID: 13958 RVA: 0x000BACFC File Offset: 0x000B8EFC public static IEnumerator PolicyHierarchy() { return SecurityManager.Hierarchy; } /// Determines what permissions to grant to code based on the specified evidence. /// The set of permissions that can be granted by the security system. /// The evidence set used to evaluate policy. /// /// /// // Token: 0x06003687 RID: 13959 RVA: 0x000BAD04 File Offset: 0x000B8F04 public static PermissionSet ResolvePolicy(Evidence evidence) { if (evidence == null) { return new PermissionSet(PermissionState.None); } PermissionSet permissionSet = null; IEnumerator hierarchy = SecurityManager.Hierarchy; while (hierarchy.MoveNext()) { object obj = hierarchy.Current; PolicyLevel policyLevel = (PolicyLevel)obj; if (SecurityManager.ResolvePolicyLevel(ref permissionSet, policyLevel, evidence)) { break; } } SecurityManager.ResolveIdentityPermissions(permissionSet, evidence); return permissionSet; } /// Determines what permissions to grant to code based on the specified evidence. /// The set of permissions that is appropriate for all of the provided evidence. /// An array of objects used to evaluate policy. /// /// /// // Token: 0x06003688 RID: 13960 RVA: 0x000BAD60 File Offset: 0x000B8F60 [MonoTODO("(2.0) more tests are needed")] public static PermissionSet ResolvePolicy(Evidence[] evidences) { if (evidences == null || evidences.Length == 0 || (evidences.Length == 1 && evidences[0].Count == 0)) { return new PermissionSet(PermissionState.None); } PermissionSet permissionSet = SecurityManager.ResolvePolicy(evidences[0]); for (int i = 1; i < evidences.Length; i++) { permissionSet = permissionSet.Intersect(SecurityManager.ResolvePolicy(evidences[i])); } return permissionSet; } /// Determines what permissions to grant to code based on the specified evidence, excluding the policy for the level. /// The set of permissions that can be granted by the security system. /// The evidence set used to evaluate policy. // Token: 0x06003689 RID: 13961 RVA: 0x000BADC8 File Offset: 0x000B8FC8 public static PermissionSet ResolveSystemPolicy(Evidence evidence) { if (evidence == null) { return new PermissionSet(PermissionState.None); } PermissionSet permissionSet = null; IEnumerator hierarchy = SecurityManager.Hierarchy; while (hierarchy.MoveNext()) { object obj = hierarchy.Current; PolicyLevel policyLevel = (PolicyLevel)obj; if (policyLevel.Type == PolicyLevelType.AppDomain) { break; } if (SecurityManager.ResolvePolicyLevel(ref permissionSet, policyLevel, evidence)) { break; } } SecurityManager.ResolveIdentityPermissions(permissionSet, evidence); return permissionSet; } /// Determines what permissions to grant to code based on the specified evidence and requests. /// The set of permissions that would be granted by the security system. /// The evidence set used to evaluate policy. /// The required permissions the code needs to run. /// The optional permissions that will be used if granted, but aren't required for the code to run. /// The denied permissions that must never be granted to the code even if policy otherwise permits it. /// An output parameter that contains the set of permissions not granted. /// Policy fails to grant the minimum required permissions specified by the parameter. /// /// /// // Token: 0x0600368A RID: 13962 RVA: 0x000BAE34 File Offset: 0x000B9034 public static PermissionSet ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied) { PermissionSet permissionSet = SecurityManager.ResolvePolicy(evidence); if (reqdPset != null && !reqdPset.IsSubsetOf(permissionSet)) { throw new PolicyException(Locale.GetText("Policy doesn't grant the minimal permissions required to execute the assembly.")); } if (SecurityManager.CheckExecutionRights) { bool flag = false; if (permissionSet != null) { if (permissionSet.IsUnrestricted()) { flag = true; } else { IPermission permission = permissionSet.GetPermission(typeof(SecurityPermission)); flag = SecurityManager._execution.IsSubsetOf(permission); } } if (!flag) { throw new PolicyException(Locale.GetText("Policy doesn't grant the right to execute the assembly.")); } } denied = denyPset; return permissionSet; } /// Gets a collection of code groups matching the specified evidence. /// An enumeration of the set of code groups matching the evidence. /// The evidence set against which the policy is evaluated. /// /// /// // Token: 0x0600368B RID: 13963 RVA: 0x000BAEC8 File Offset: 0x000B90C8 public static IEnumerator ResolvePolicyGroups(Evidence evidence) { if (evidence == null) { throw new ArgumentNullException("evidence"); } ArrayList arrayList = new ArrayList(); IEnumerator hierarchy = SecurityManager.Hierarchy; while (hierarchy.MoveNext()) { object obj = hierarchy.Current; PolicyLevel policyLevel = (PolicyLevel)obj; CodeGroup codeGroup = policyLevel.ResolveMatchingCodeGroups(evidence); arrayList.Add(codeGroup); } return arrayList.GetEnumerator(); } /// Saves the modified security policy state. /// The code that calls this method does not have . /// /// /// /// /// // Token: 0x0600368C RID: 13964 RVA: 0x000BAF24 File Offset: 0x000B9124 public static void SavePolicy() { IEnumerator hierarchy = SecurityManager.Hierarchy; while (hierarchy.MoveNext()) { object obj = hierarchy.Current; PolicyLevel policyLevel = obj as PolicyLevel; policyLevel.Save(); } } /// Saves a modified security policy level loaded with . /// The object to be saved. /// The code that calls this method does not have . /// /// /// /// /// // Token: 0x0600368D RID: 13965 RVA: 0x000BAF5C File Offset: 0x000B915C public static void SavePolicyLevel(PolicyLevel level) { level.Save(); } // Token: 0x17000AB1 RID: 2737 // (get) Token: 0x0600368E RID: 13966 RVA: 0x000BAF64 File Offset: 0x000B9164 private static IEnumerator Hierarchy { get { object lockObject = SecurityManager._lockObject; lock (lockObject) { if (SecurityManager._hierarchy == null) { SecurityManager.InitializePolicyHierarchy(); } } return SecurityManager._hierarchy.GetEnumerator(); } } // Token: 0x0600368F RID: 13967 RVA: 0x000BAFC0 File Offset: 0x000B91C0 private static void InitializePolicyHierarchy() { string directoryName = Path.GetDirectoryName(Environment.GetMachineConfigPath()); string text = Path.Combine(Environment.InternalGetFolderPath(Environment.SpecialFolder.ApplicationData), "mono"); PolicyLevel policyLevel = new PolicyLevel("Enterprise", PolicyLevelType.Enterprise); SecurityManager._level = policyLevel; policyLevel.LoadFromFile(Path.Combine(directoryName, "enterprisesec.config")); PolicyLevel policyLevel2 = new PolicyLevel("Machine", PolicyLevelType.Machine); SecurityManager._level = policyLevel2; policyLevel2.LoadFromFile(Path.Combine(directoryName, "security.config")); PolicyLevel policyLevel3 = new PolicyLevel("User", PolicyLevelType.User); SecurityManager._level = policyLevel3; policyLevel3.LoadFromFile(Path.Combine(text, "security.config")); SecurityManager._hierarchy = ArrayList.Synchronized(new ArrayList { policyLevel, policyLevel2, policyLevel3 }); SecurityManager._level = null; } // Token: 0x06003690 RID: 13968 RVA: 0x000BB08C File Offset: 0x000B928C internal static bool ResolvePolicyLevel(ref PermissionSet ps, PolicyLevel pl, Evidence evidence) { PolicyStatement policyStatement = pl.Resolve(evidence); if (policyStatement != null) { if (ps == null) { ps = policyStatement.PermissionSet; } else { ps = ps.Intersect(policyStatement.PermissionSet); if (ps == null) { ps = new PermissionSet(PermissionState.None); } } if ((policyStatement.Attributes & PolicyStatementAttribute.LevelFinal) == PolicyStatementAttribute.LevelFinal) { return true; } } return false; } // Token: 0x06003691 RID: 13969 RVA: 0x000BB0EC File Offset: 0x000B92EC internal static void ResolveIdentityPermissions(PermissionSet ps, Evidence evidence) { if (ps.IsUnrestricted()) { return; } IEnumerator hostEnumerator = evidence.GetHostEnumerator(); while (hostEnumerator.MoveNext()) { object obj = hostEnumerator.Current; IIdentityPermissionFactory identityPermissionFactory = obj as IIdentityPermissionFactory; if (identityPermissionFactory != null) { IPermission permission = identityPermissionFactory.CreateIdentityPermission(evidence); ps.AddPermission(permission); } } } // Token: 0x17000AB2 RID: 2738 // (get) Token: 0x06003692 RID: 13970 RVA: 0x000BB140 File Offset: 0x000B9340 // (set) Token: 0x06003693 RID: 13971 RVA: 0x000BB148 File Offset: 0x000B9348 internal static PolicyLevel ResolvingPolicyLevel { get { return SecurityManager._level; } set { SecurityManager._level = value; } } // Token: 0x06003694 RID: 13972 RVA: 0x000BB150 File Offset: 0x000B9350 internal static PermissionSet Decode(IntPtr permissions, int length) { PermissionSet permissionSet = null; object lockObject = SecurityManager._lockObject; lock (lockObject) { if (SecurityManager._declsecCache == null) { SecurityManager._declsecCache = new Hashtable(); } object obj = (int)permissions; permissionSet = (PermissionSet)SecurityManager._declsecCache[obj]; if (permissionSet == null) { byte[] array = new byte[length]; Marshal.Copy(permissions, array, 0, length); permissionSet = SecurityManager.Decode(array); permissionSet.DeclarativeSecurity = true; SecurityManager._declsecCache.Add(obj, permissionSet); } } return permissionSet; } // Token: 0x06003695 RID: 13973 RVA: 0x000BB1F8 File Offset: 0x000B93F8 internal static PermissionSet Decode(byte[] encodedPermissions) { if (encodedPermissions == null || encodedPermissions.Length < 1) { throw new SecurityException("Invalid metadata format."); } byte b = encodedPermissions[0]; if (b == 46) { return PermissionSet.CreateFromBinaryFormat(encodedPermissions); } if (b != 60) { throw new SecurityException(Locale.GetText("Unknown metadata format.")); } string @string = Encoding.Unicode.GetString(encodedPermissions); return new PermissionSet(@string); } // Token: 0x17000AB3 RID: 2739 // (get) Token: 0x06003696 RID: 13974 RVA: 0x000BB264 File Offset: 0x000B9464 private static IPermission UnmanagedCode { get { object lockObject = SecurityManager._lockObject; lock (lockObject) { if (SecurityManager._unmanagedCode == null) { SecurityManager._unmanagedCode = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode); } } return SecurityManager._unmanagedCode; } } // Token: 0x06003697 RID: 13975 [MethodImpl(MethodImplOptions.InternalCall)] private unsafe static extern bool GetLinkDemandSecurity(MethodBase method, RuntimeDeclSecurityActions* cdecl, RuntimeDeclSecurityActions* mdecl); // Token: 0x06003698 RID: 13976 RVA: 0x000BB2C0 File Offset: 0x000B94C0 internal unsafe static void ReflectedLinkDemandInvoke(MethodBase mb) { RuntimeDeclSecurityActions runtimeDeclSecurityActions; RuntimeDeclSecurityActions runtimeDeclSecurityActions2; if (!SecurityManager.GetLinkDemandSecurity(mb, &runtimeDeclSecurityActions, &runtimeDeclSecurityActions2)) { return; } PermissionSet permissionSet = null; if (runtimeDeclSecurityActions.cas.size > 0) { permissionSet = SecurityManager.Decode(runtimeDeclSecurityActions.cas.blob, runtimeDeclSecurityActions.cas.size); } if (runtimeDeclSecurityActions.noncas.size > 0) { PermissionSet permissionSet2 = SecurityManager.Decode(runtimeDeclSecurityActions.noncas.blob, runtimeDeclSecurityActions.noncas.size); permissionSet = ((permissionSet != null) ? permissionSet.Union(permissionSet2) : permissionSet2); } if (runtimeDeclSecurityActions2.cas.size > 0) { PermissionSet permissionSet3 = SecurityManager.Decode(runtimeDeclSecurityActions2.cas.blob, runtimeDeclSecurityActions2.cas.size); permissionSet = ((permissionSet != null) ? permissionSet.Union(permissionSet3) : permissionSet3); } if (runtimeDeclSecurityActions2.noncas.size > 0) { PermissionSet permissionSet4 = SecurityManager.Decode(runtimeDeclSecurityActions2.noncas.blob, runtimeDeclSecurityActions2.noncas.size); permissionSet = ((permissionSet != null) ? permissionSet.Union(permissionSet4) : permissionSet4); } if (permissionSet != null) { permissionSet.Demand(); } } // Token: 0x06003699 RID: 13977 RVA: 0x000BB3F0 File Offset: 0x000B95F0 internal unsafe static bool ReflectedLinkDemandQuery(MethodBase mb) { RuntimeDeclSecurityActions runtimeDeclSecurityActions; RuntimeDeclSecurityActions runtimeDeclSecurityActions2; return !SecurityManager.GetLinkDemandSecurity(mb, &runtimeDeclSecurityActions, &runtimeDeclSecurityActions2) || SecurityManager.LinkDemand(mb.ReflectedType.Assembly, &runtimeDeclSecurityActions, &runtimeDeclSecurityActions2); } // Token: 0x0600369A RID: 13978 RVA: 0x000BB424 File Offset: 0x000B9624 private unsafe static bool LinkDemand(Assembly a, RuntimeDeclSecurityActions* klass, RuntimeDeclSecurityActions* method) { bool flag2; try { bool flag = true; if (klass->cas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(klass->cas.blob, klass->cas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, false) == null; } if (flag && klass->noncas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(klass->noncas.blob, klass->noncas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, true) == null; } if (flag && method->cas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(method->cas.blob, method->cas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, false) == null; } if (flag && method->noncas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(method->noncas.blob, method->noncas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, true) == null; } flag2 = flag; } catch (SecurityException) { flag2 = false; } return flag2; } // Token: 0x0600369B RID: 13979 RVA: 0x000BB564 File Offset: 0x000B9764 private static bool LinkDemandFullTrust(Assembly a) { PermissionSet grantedPermissionSet = a.GrantedPermissionSet; if (grantedPermissionSet != null && !grantedPermissionSet.IsUnrestricted()) { return false; } PermissionSet deniedPermissionSet = a.DeniedPermissionSet; return deniedPermissionSet == null || deniedPermissionSet.IsEmpty(); } // Token: 0x0600369C RID: 13980 RVA: 0x000BB5A8 File Offset: 0x000B97A8 private static bool LinkDemandUnmanaged(Assembly a) { return SecurityManager.IsGranted(a, SecurityManager.UnmanagedCode); } // Token: 0x0600369D RID: 13981 RVA: 0x000BB5B8 File Offset: 0x000B97B8 private static void LinkDemandSecurityException(int securityViolation, IntPtr methodHandle) { RuntimeMethodHandle runtimeMethodHandle = new RuntimeMethodHandle(methodHandle); MethodInfo methodInfo = (MethodInfo)MethodBase.GetMethodFromHandle(runtimeMethodHandle); Assembly assembly = methodInfo.DeclaringType.Assembly; AssemblyName assemblyName = null; PermissionSet permissionSet = null; PermissionSet permissionSet2 = null; object obj = null; IPermission permission = null; if (assembly != null) { assemblyName = assembly.UnprotectedGetName(); permissionSet = assembly.GrantedPermissionSet; permissionSet2 = assembly.DeniedPermissionSet; } string text; switch (securityViolation) { case 1: text = Locale.GetText("Permissions refused to call this method."); goto IL_E5; case 2: text = Locale.GetText("Partially trusted callers aren't allowed to call into this assembly."); obj = DefaultPolicies.FullTrust; goto IL_E5; case 4: text = Locale.GetText("Calling internal calls is restricted to ECMA signed assemblies."); goto IL_E5; case 8: text = Locale.GetText("Calling unmanaged code isn't allowed from this assembly."); obj = SecurityManager._unmanagedCode; permission = SecurityManager._unmanagedCode; goto IL_E5; } text = Locale.GetText("JIT time LinkDemand failed."); IL_E5: throw new SecurityException(text, assemblyName, permissionSet, permissionSet2, methodInfo, SecurityAction.LinkDemand, obj, permission, null); } // Token: 0x0600369E RID: 13982 RVA: 0x000BB6C0 File Offset: 0x000B98C0 private static void InheritanceDemandSecurityException(int securityViolation, Assembly a, Type t, MethodInfo method) { AssemblyName assemblyName = null; PermissionSet permissionSet = null; PermissionSet permissionSet2 = null; if (a != null) { assemblyName = a.UnprotectedGetName(); permissionSet = a.GrantedPermissionSet; permissionSet2 = a.DeniedPermissionSet; } string text; if (securityViolation != 1) { if (securityViolation != 2) { text = Locale.GetText("Load time InheritDemand failed."); } else { text = Locale.GetText("Method override refused."); } } else { text = string.Format(Locale.GetText("Class inheritance refused for {0}."), t); } throw new SecurityException(text, assemblyName, permissionSet, permissionSet2, method, SecurityAction.InheritanceDemand, null, null, null); } // Token: 0x0600369F RID: 13983 RVA: 0x000BB74C File Offset: 0x000B994C private static void ThrowException(Exception ex) { throw ex; } // Token: 0x060036A0 RID: 13984 RVA: 0x000BB750 File Offset: 0x000B9950 private unsafe static bool InheritanceDemand(AppDomain ad, Assembly a, RuntimeDeclSecurityActions* actions) { bool flag2; try { bool flag = true; if (actions->cas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(actions->cas.blob, actions->cas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, false) == null; if (flag) { flag = SecurityManager.CheckPermissionSet(ad, permissionSet) == null; } } if (actions->noncas.size > 0) { PermissionSet permissionSet = SecurityManager.Decode(actions->noncas.blob, actions->noncas.size); flag = SecurityManager.CheckPermissionSet(a, permissionSet, true) == null; if (flag) { flag = SecurityManager.CheckPermissionSet(ad, permissionSet) == null; } } flag2 = flag; } catch (SecurityException) { flag2 = false; } return flag2; } // Token: 0x060036A1 RID: 13985 RVA: 0x000BB82C File Offset: 0x000B9A2C private static void DemandUnmanaged() { SecurityManager.UnmanagedCode.Demand(); } // Token: 0x060036A2 RID: 13986 RVA: 0x000BB838 File Offset: 0x000B9A38 private static void InternalDemand(IntPtr permissions, int length) { PermissionSet permissionSet = SecurityManager.Decode(permissions, length); permissionSet.Demand(); } // Token: 0x060036A3 RID: 13987 RVA: 0x000BB854 File Offset: 0x000B9A54 private static void InternalDemandChoice(IntPtr permissions, int length) { throw new SecurityException("SecurityAction.DemandChoice was removed from 2.0"); } // Token: 0x04001655 RID: 5717 private static object _lockObject = new object(); // Token: 0x04001656 RID: 5718 private static ArrayList _hierarchy; // Token: 0x04001657 RID: 5719 private static IPermission _unmanagedCode; // Token: 0x04001658 RID: 5720 private static Hashtable _declsecCache; // Token: 0x04001659 RID: 5721 private static PolicyLevel _level; // Token: 0x0400165A RID: 5722 private static SecurityPermission _execution = new SecurityPermission(SecurityPermissionFlag.Execution); } }