using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Mono.Xml;
namespace System.Security.Policy
{
/// Represents the security policy levels for the common language runtime. This class cannot be inherited.
// Token: 0x02000599 RID: 1433
[ComVisible(true)]
[Serializable]
public sealed class PolicyLevel
{
// Token: 0x0600344F RID: 13391 RVA: 0x000B3D20 File Offset: 0x000B1F20
internal PolicyLevel(string label, PolicyLevelType type)
{
this.label = label;
this._type = type;
this.full_trust_assemblies = new ArrayList();
this.named_permission_sets = new ArrayList();
}
// Token: 0x06003450 RID: 13392 RVA: 0x000B3D58 File Offset: 0x000B1F58
internal void LoadFromFile(string filename)
{
try
{
if (!File.Exists(filename))
{
string text = filename + ".default";
if (File.Exists(text))
{
File.Copy(text, filename);
}
}
if (File.Exists(filename))
{
using (StreamReader streamReader = File.OpenText(filename))
{
this.xml = this.FromString(streamReader.ReadToEnd());
}
try
{
SecurityManager.ResolvingPolicyLevel = this;
this.FromXml(this.xml);
}
finally
{
SecurityManager.ResolvingPolicyLevel = this;
}
}
else
{
this.CreateDefaultFullTrustAssemblies();
this.CreateDefaultNamedPermissionSets();
this.CreateDefaultLevel(this._type);
this.Save();
}
}
catch
{
}
finally
{
this._location = filename;
}
}
// Token: 0x06003451 RID: 13393 RVA: 0x000B3E7C File Offset: 0x000B207C
internal void LoadFromString(string xml)
{
this.FromXml(this.FromString(xml));
}
// Token: 0x06003452 RID: 13394 RVA: 0x000B3E8C File Offset: 0x000B208C
private SecurityElement FromString(string xml)
{
SecurityParser securityParser = new SecurityParser();
securityParser.LoadXml(xml);
SecurityElement securityElement = securityParser.ToXml();
if (securityElement.Tag != "configuration")
{
throw new ArgumentException(Locale.GetText("missing root element"));
}
SecurityElement securityElement2 = (SecurityElement)securityElement.Children[0];
if (securityElement2.Tag != "mscorlib")
{
throw new ArgumentException(Locale.GetText("missing tag"));
}
SecurityElement securityElement3 = (SecurityElement)securityElement2.Children[0];
if (securityElement3.Tag != "security")
{
throw new ArgumentException(Locale.GetText("missing tag"));
}
SecurityElement securityElement4 = (SecurityElement)securityElement3.Children[0];
if (securityElement4.Tag != "policy")
{
throw new ArgumentException(Locale.GetText("missing tag"));
}
return (SecurityElement)securityElement4.Children[0];
}
/// Gets a list of objects used to determine whether an assembly is a member of the group of assemblies used to evaluate security policy.
/// A list of objects used to determine whether an assembly is a member of the group of assemblies used to evaluate security policy. These assemblies are granted full trust during security policy evaluation of assemblies not in the list.
// Token: 0x17000A48 RID: 2632
// (get) Token: 0x06003453 RID: 13395 RVA: 0x000B3F90 File Offset: 0x000B2190
[Obsolete("All GACed assemblies are now fully trusted and all permissions now succeed on fully trusted code.")]
public IList FullTrustAssemblies
{
get
{
return this.full_trust_assemblies;
}
}
/// Gets a descriptive label for the policy level.
/// The label associated with the policy level.
// Token: 0x17000A49 RID: 2633
// (get) Token: 0x06003454 RID: 13396 RVA: 0x000B3F98 File Offset: 0x000B2198
public string Label
{
get
{
return this.label;
}
}
/// Gets a list of named permission sets defined for the policy level.
/// A list of named permission sets defined for the policy level.
///
///
///
// Token: 0x17000A4A RID: 2634
// (get) Token: 0x06003455 RID: 13397 RVA: 0x000B3FA0 File Offset: 0x000B21A0
public IList NamedPermissionSets
{
get
{
return this.named_permission_sets;
}
}
/// Gets or sets the root code group for the policy level.
/// The that is the root of the tree of policy level code groups.
/// The value for is null.
///
///
///
// Token: 0x17000A4B RID: 2635
// (get) Token: 0x06003456 RID: 13398 RVA: 0x000B3FA8 File Offset: 0x000B21A8
// (set) Token: 0x06003457 RID: 13399 RVA: 0x000B3FB0 File Offset: 0x000B21B0
public CodeGroup RootCodeGroup
{
get
{
return this.root_code_group;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
this.root_code_group = value;
}
}
/// Gets the path where the policy file is stored.
/// The path where the policy file is stored, or null if the does not have a storage location.
// Token: 0x17000A4C RID: 2636
// (get) Token: 0x06003458 RID: 13400 RVA: 0x000B3FCC File Offset: 0x000B21CC
public string StoreLocation
{
get
{
return this._location;
}
}
/// Gets the type of the policy level.
/// One of the values.
// Token: 0x17000A4D RID: 2637
// (get) Token: 0x06003459 RID: 13401 RVA: 0x000B3FD4 File Offset: 0x000B21D4
[ComVisible(false)]
public PolicyLevelType Type
{
get
{
return this._type;
}
}
/// Adds a corresponding to the specified to the list of objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
/// The used to create the to add to the list of objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
/// The parameter is null.
/// The specified by the parameter already has full trust.
///
///
///
// Token: 0x0600345A RID: 13402 RVA: 0x000B3FDC File Offset: 0x000B21DC
[Obsolete("All GACed assemblies are now fully trusted and all permissions now succeed on fully trusted code.")]
public void AddFullTrustAssembly(StrongName sn)
{
if (sn == null)
{
throw new ArgumentNullException("sn");
}
StrongNameMembershipCondition strongNameMembershipCondition = new StrongNameMembershipCondition(sn.PublicKey, sn.Name, sn.Version);
this.AddFullTrustAssembly(strongNameMembershipCondition);
}
/// Adds the specified to the list of objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
/// The to add to the list of objects used to determine whether an assembly is a member of the group of assemblies that should not be evaluated.
/// The parameter is null.
/// The specified by the parameter already has full trust.
///
///
///
// Token: 0x0600345B RID: 13403 RVA: 0x000B401C File Offset: 0x000B221C
[Obsolete("All GACed assemblies are now fully trusted and all permissions now succeed on fully trusted code.")]
public void AddFullTrustAssembly(StrongNameMembershipCondition snMC)
{
if (snMC == null)
{
throw new ArgumentNullException("snMC");
}
foreach (object obj in this.full_trust_assemblies)
{
StrongNameMembershipCondition strongNameMembershipCondition = (StrongNameMembershipCondition)obj;
if (strongNameMembershipCondition.Equals(snMC))
{
throw new ArgumentException(Locale.GetText("sn already has full trust."));
}
}
this.full_trust_assemblies.Add(snMC);
}
/// Adds a to the current policy level.
/// The to add to the current policy level.
/// The parameter is null.
/// The parameter has the same name as an existing in the .
///
///
///
// Token: 0x0600345C RID: 13404 RVA: 0x000B40C0 File Offset: 0x000B22C0
public void AddNamedPermissionSet(NamedPermissionSet permSet)
{
if (permSet == null)
{
throw new ArgumentNullException("permSet");
}
foreach (object obj in this.named_permission_sets)
{
NamedPermissionSet namedPermissionSet = (NamedPermissionSet)obj;
if (permSet.Name == namedPermissionSet.Name)
{
throw new ArgumentException(Locale.GetText("This NamedPermissionSet is the same an existing NamedPermissionSet."));
}
}
this.named_permission_sets.Add(permSet.Copy());
}
/// Replaces a in the current policy level with the specified .
/// A copy of the that was replaced.
/// The name of the to replace.
/// The that replaces the specified by the parameter.
/// The parameter is null.-or- The parameter is null.
/// The parameter is equal to the name of a reserved permission set.-or- The specified by the parameter cannot be found.
///
///
///
// Token: 0x0600345D RID: 13405 RVA: 0x000B4174 File Offset: 0x000B2374
public NamedPermissionSet ChangeNamedPermissionSet(string name, PermissionSet pSet)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (pSet == null)
{
throw new ArgumentNullException("pSet");
}
if (DefaultPolicies.ReservedNames.IsReserved(name))
{
throw new ArgumentException(Locale.GetText("Reserved name"));
}
foreach (object obj in this.named_permission_sets)
{
NamedPermissionSet namedPermissionSet = (NamedPermissionSet)obj;
if (name == namedPermissionSet.Name)
{
this.named_permission_sets.Remove(namedPermissionSet);
this.AddNamedPermissionSet(new NamedPermissionSet(name, pSet));
return namedPermissionSet;
}
}
throw new ArgumentException(Locale.GetText("PermissionSet not found"));
}
/// Creates a new policy level for use at the application domain policy level.
/// The newly created .
///
///
///
// Token: 0x0600345E RID: 13406 RVA: 0x000B425C File Offset: 0x000B245C
public static PolicyLevel CreateAppDomainLevel()
{
UnionCodeGroup unionCodeGroup = new UnionCodeGroup(new AllMembershipCondition(), new PolicyStatement(DefaultPolicies.FullTrust));
unionCodeGroup.Name = "All_Code";
PolicyLevel policyLevel = new PolicyLevel("AppDomain", PolicyLevelType.AppDomain);
policyLevel.RootCodeGroup = unionCodeGroup;
policyLevel.Reset();
return policyLevel;
}
/// Reconstructs a security object with a given state from an XML encoding.
/// The XML encoding to use to reconstruct the security object.
/// The parameter is null.
/// The specified by the parameter is invalid.
///
///
///
// Token: 0x0600345F RID: 13407 RVA: 0x000B42A4 File Offset: 0x000B24A4
public void FromXml(SecurityElement e)
{
if (e == null)
{
throw new ArgumentNullException("e");
}
SecurityElement securityElement = e.SearchForChildByTag("SecurityClasses");
if (securityElement != null && securityElement.Children != null && securityElement.Children.Count > 0)
{
this.fullNames = new Hashtable(securityElement.Children.Count);
foreach (object obj in securityElement.Children)
{
SecurityElement securityElement2 = (SecurityElement)obj;
this.fullNames.Add(securityElement2.Attributes["Name"], securityElement2.Attributes["Description"]);
}
}
SecurityElement securityElement3 = e.SearchForChildByTag("FullTrustAssemblies");
if (securityElement3 != null && securityElement3.Children != null && securityElement3.Children.Count > 0)
{
this.full_trust_assemblies.Clear();
foreach (object obj2 in securityElement3.Children)
{
SecurityElement securityElement4 = (SecurityElement)obj2;
if (securityElement4.Tag != "IMembershipCondition")
{
throw new ArgumentException(Locale.GetText("Invalid XML"));
}
string text = securityElement4.Attribute("class");
if (text.IndexOf("StrongNameMembershipCondition") < 0)
{
throw new ArgumentException(Locale.GetText("Invalid XML - must be StrongNameMembershipCondition"));
}
this.full_trust_assemblies.Add(new StrongNameMembershipCondition(securityElement4));
}
}
SecurityElement securityElement5 = e.SearchForChildByTag("CodeGroup");
if (securityElement5 != null && securityElement5.Children != null && securityElement5.Children.Count > 0)
{
this.root_code_group = CodeGroup.CreateFromXml(securityElement5, this);
SecurityElement securityElement6 = e.SearchForChildByTag("NamedPermissionSets");
if (securityElement6 != null && securityElement6.Children != null && securityElement6.Children.Count > 0)
{
this.named_permission_sets.Clear();
foreach (object obj3 in securityElement6.Children)
{
SecurityElement securityElement7 = (SecurityElement)obj3;
NamedPermissionSet namedPermissionSet = new NamedPermissionSet();
namedPermissionSet.Resolver = this;
namedPermissionSet.FromXml(securityElement7);
this.named_permission_sets.Add(namedPermissionSet);
}
}
return;
}
throw new ArgumentException(Locale.GetText("Missing Root CodeGroup"));
}
/// Returns the in the current policy level with the specified name.
/// The in the current policy level with the specified name, if found; otherwise, null.
/// The name of the to find.
/// The parameter is null.
// Token: 0x06003460 RID: 13408 RVA: 0x000B45A8 File Offset: 0x000B27A8
public NamedPermissionSet GetNamedPermissionSet(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
foreach (object obj in this.named_permission_sets)
{
NamedPermissionSet namedPermissionSet = (NamedPermissionSet)obj;
if (namedPermissionSet.Name == name)
{
return (NamedPermissionSet)namedPermissionSet.Copy();
}
}
return null;
}
/// Replaces the configuration file for this with the last backup (reflecting the state of policy prior to the last time it was saved) and returns it to the state of the last save.
/// The policy level does not have a valid configuration file.
// Token: 0x06003461 RID: 13409 RVA: 0x000B4648 File Offset: 0x000B2848
public void Recover()
{
if (this._location == null)
{
string text = Locale.GetText("Only file based policies may be recovered.");
throw new PolicyException(text);
}
string text2 = this._location + ".backup";
if (!File.Exists(text2))
{
string text3 = Locale.GetText("No policy backup exists.");
throw new PolicyException(text3);
}
try
{
File.Copy(text2, this._location, true);
}
catch (Exception ex)
{
string text4 = Locale.GetText("Couldn't replace the policy file with it's backup.");
throw new PolicyException(text4, ex);
}
}
/// Removes an assembly with the specified from the list of assemblies the policy level uses to evaluate policy.
/// The of the assembly to remove from the list of assemblies used to evaluate policy.
/// The parameter is null.
/// The assembly with the specified by the parameter does not have full trust.
///
///
///
// Token: 0x06003462 RID: 13410 RVA: 0x000B46EC File Offset: 0x000B28EC
[Obsolete("All GACed assemblies are now fully trusted and all permissions now succeed on fully trusted code.")]
public void RemoveFullTrustAssembly(StrongName sn)
{
if (sn == null)
{
throw new ArgumentNullException("sn");
}
StrongNameMembershipCondition strongNameMembershipCondition = new StrongNameMembershipCondition(sn.PublicKey, sn.Name, sn.Version);
this.RemoveFullTrustAssembly(strongNameMembershipCondition);
}
/// Removes an assembly with the specified from the list of assemblies the policy level uses to evaluate policy.
/// The of the assembly to remove from the list of assemblies used to evaluate policy.
/// The parameter is null.
/// The specified by the parameter does not have full trust.
///
///
///
// Token: 0x06003463 RID: 13411 RVA: 0x000B472C File Offset: 0x000B292C
[Obsolete("All GACed assemblies are now fully trusted and all permissions now succeed on fully trusted code.")]
public void RemoveFullTrustAssembly(StrongNameMembershipCondition snMC)
{
if (snMC == null)
{
throw new ArgumentNullException("snMC");
}
if (((IList)this.full_trust_assemblies).Contains(snMC))
{
((IList)this.full_trust_assemblies).Remove(snMC);
return;
}
throw new ArgumentException(Locale.GetText("sn does not have full trust."));
}
/// Removes the specified from the current policy level.
/// The that was removed.
/// The to remove from the current policy level.
/// The specified by the parameter was not found.
/// The parameter is null.
///
///
///
// Token: 0x06003464 RID: 13412 RVA: 0x000B477C File Offset: 0x000B297C
public NamedPermissionSet RemoveNamedPermissionSet(NamedPermissionSet permSet)
{
if (permSet == null)
{
throw new ArgumentNullException("permSet");
}
return this.RemoveNamedPermissionSet(permSet.Name);
}
/// Removes the with the specified name from the current policy level.
/// The that was removed.
/// The name of the to remove.
/// The parameter is equal to the name of a reserved permission set.-or- A with the specified name cannot be found.
/// The parameter is null.
///
///
///
// Token: 0x06003465 RID: 13413 RVA: 0x000B479C File Offset: 0x000B299C
public NamedPermissionSet RemoveNamedPermissionSet(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (DefaultPolicies.ReservedNames.IsReserved(name))
{
throw new ArgumentException(Locale.GetText("Reserved name"));
}
foreach (object obj in this.named_permission_sets)
{
NamedPermissionSet namedPermissionSet = (NamedPermissionSet)obj;
if (name == namedPermissionSet.Name)
{
this.named_permission_sets.Remove(namedPermissionSet);
return namedPermissionSet;
}
}
string text = string.Format(Locale.GetText("Name '{0}' cannot be found."), name);
throw new ArgumentException(text, "name");
}
/// Returns the current policy level to the default state.
///
///
///
///
///
// Token: 0x06003466 RID: 13414 RVA: 0x000B4878 File Offset: 0x000B2A78
public void Reset()
{
if (this.fullNames != null)
{
this.fullNames.Clear();
}
if (this._type != PolicyLevelType.AppDomain)
{
this.full_trust_assemblies.Clear();
this.named_permission_sets.Clear();
if (this._location != null && File.Exists(this._location))
{
try
{
File.Delete(this._location);
}
catch
{
}
}
this.LoadFromFile(this._location);
}
else
{
this.CreateDefaultFullTrustAssemblies();
this.CreateDefaultNamedPermissionSets();
}
}
/// Resolves policy based on evidence for the policy level, and returns the resulting .
/// The resulting .
/// The used to resolve the .
/// The policy level contains multiple matching code groups marked as exclusive.
/// The parameter is null.
///
///
///
// Token: 0x06003467 RID: 13415 RVA: 0x000B4928 File Offset: 0x000B2B28
public PolicyStatement Resolve(Evidence evidence)
{
if (evidence == null)
{
throw new ArgumentNullException("evidence");
}
PolicyStatement policyStatement = this.root_code_group.Resolve(evidence);
return (policyStatement == null) ? PolicyStatement.Empty() : policyStatement;
}
/// Resolves policy at the policy level and returns the root of a code group tree that matches the evidence.
/// A representing the root of a tree of code groups matching the specified evidence.
/// The used to resolve policy.
/// The policy level contains multiple matching code groups marked as exclusive.
/// The parameter is null.
///
///
///
// Token: 0x06003468 RID: 13416 RVA: 0x000B4964 File Offset: 0x000B2B64
public CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
{
if (evidence == null)
{
throw new ArgumentNullException("evidence");
}
CodeGroup codeGroup = this.root_code_group.ResolveMatchingCodeGroups(evidence);
return (codeGroup == null) ? null : codeGroup;
}
/// Creates an XML encoding of the security object and its current state.
/// An XML encoding of the security object, including any state information.
///
///
///
// Token: 0x06003469 RID: 13417 RVA: 0x000B499C File Offset: 0x000B2B9C
public SecurityElement ToXml()
{
Hashtable hashtable = new Hashtable();
if (this.full_trust_assemblies.Count > 0 && !hashtable.Contains("StrongNameMembershipCondition"))
{
hashtable.Add("StrongNameMembershipCondition", typeof(StrongNameMembershipCondition).FullName);
}
SecurityElement securityElement = new SecurityElement("NamedPermissionSets");
foreach (object obj in this.named_permission_sets)
{
NamedPermissionSet namedPermissionSet = (NamedPermissionSet)obj;
SecurityElement securityElement2 = namedPermissionSet.ToXml();
object obj2 = securityElement2.Attributes["class"];
if (!hashtable.Contains(obj2))
{
hashtable.Add(obj2, namedPermissionSet.GetType().FullName);
}
securityElement.AddChild(securityElement2);
}
SecurityElement securityElement3 = new SecurityElement("FullTrustAssemblies");
foreach (object obj3 in this.full_trust_assemblies)
{
StrongNameMembershipCondition strongNameMembershipCondition = (StrongNameMembershipCondition)obj3;
securityElement3.AddChild(strongNameMembershipCondition.ToXml(this));
}
SecurityElement securityElement4 = new SecurityElement("SecurityClasses");
if (hashtable.Count > 0)
{
foreach (object obj4 in hashtable)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj4;
SecurityElement securityElement5 = new SecurityElement("SecurityClass");
securityElement5.AddAttribute("Name", (string)dictionaryEntry.Key);
securityElement5.AddAttribute("Description", (string)dictionaryEntry.Value);
securityElement4.AddChild(securityElement5);
}
}
SecurityElement securityElement6 = new SecurityElement(typeof(PolicyLevel).Name);
securityElement6.AddAttribute("version", "1");
securityElement6.AddChild(securityElement4);
securityElement6.AddChild(securityElement);
if (this.root_code_group != null)
{
securityElement6.AddChild(this.root_code_group.ToXml(this));
}
securityElement6.AddChild(securityElement3);
return securityElement6;
}
// Token: 0x0600346A RID: 13418 RVA: 0x000B4C28 File Offset: 0x000B2E28
internal void Save()
{
if (this._type == PolicyLevelType.AppDomain)
{
throw new PolicyException(Locale.GetText("Can't save AppDomain PolicyLevel"));
}
if (this._location != null)
{
try
{
if (File.Exists(this._location))
{
File.Copy(this._location, this._location + ".backup", true);
}
}
catch (Exception)
{
}
finally
{
using (StreamWriter streamWriter = new StreamWriter(this._location))
{
streamWriter.Write(this.ToXml().ToString());
streamWriter.Close();
}
}
}
}
// Token: 0x0600346B RID: 13419 RVA: 0x000B4D18 File Offset: 0x000B2F18
internal void CreateDefaultLevel(PolicyLevelType type)
{
PolicyStatement policyStatement = new PolicyStatement(DefaultPolicies.FullTrust);
switch (type)
{
case PolicyLevelType.User:
case PolicyLevelType.Enterprise:
case PolicyLevelType.AppDomain:
this.root_code_group = new UnionCodeGroup(new AllMembershipCondition(), policyStatement);
this.root_code_group.Name = "All_Code";
break;
case PolicyLevelType.Machine:
{
PolicyStatement policyStatement2 = new PolicyStatement(DefaultPolicies.Nothing);
this.root_code_group = new UnionCodeGroup(new AllMembershipCondition(), policyStatement2);
this.root_code_group.Name = "All_Code";
UnionCodeGroup unionCodeGroup = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.MyComputer), policyStatement);
unionCodeGroup.Name = "My_Computer_Zone";
this.root_code_group.AddChild(unionCodeGroup);
UnionCodeGroup unionCodeGroup2 = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Intranet), new PolicyStatement(DefaultPolicies.LocalIntranet));
unionCodeGroup2.Name = "LocalIntranet_Zone";
this.root_code_group.AddChild(unionCodeGroup2);
PolicyStatement policyStatement3 = new PolicyStatement(DefaultPolicies.Internet);
UnionCodeGroup unionCodeGroup3 = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Internet), policyStatement3);
unionCodeGroup3.Name = "Internet_Zone";
this.root_code_group.AddChild(unionCodeGroup3);
UnionCodeGroup unionCodeGroup4 = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Untrusted), policyStatement2);
unionCodeGroup4.Name = "Restricted_Zone";
this.root_code_group.AddChild(unionCodeGroup4);
UnionCodeGroup unionCodeGroup5 = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Trusted), policyStatement3);
unionCodeGroup5.Name = "Trusted_Zone";
this.root_code_group.AddChild(unionCodeGroup5);
break;
}
}
}
// Token: 0x0600346C RID: 13420 RVA: 0x000B4E7C File Offset: 0x000B307C
internal void CreateDefaultFullTrustAssemblies()
{
this.full_trust_assemblies.Clear();
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("mscorlib", DefaultPolicies.Key.Ecma));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System", DefaultPolicies.Key.Ecma));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System.Data", DefaultPolicies.Key.Ecma));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System.DirectoryServices", DefaultPolicies.Key.MsFinal));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System.Drawing", DefaultPolicies.Key.MsFinal));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System.Messaging", DefaultPolicies.Key.MsFinal));
this.full_trust_assemblies.Add(DefaultPolicies.FullTrustMembership("System.ServiceProcess", DefaultPolicies.Key.MsFinal));
}
// Token: 0x0600346D RID: 13421 RVA: 0x000B4F38 File Offset: 0x000B3138
internal void CreateDefaultNamedPermissionSets()
{
this.named_permission_sets.Clear();
try
{
SecurityManager.ResolvingPolicyLevel = this;
this.named_permission_sets.Add(DefaultPolicies.LocalIntranet);
this.named_permission_sets.Add(DefaultPolicies.Internet);
this.named_permission_sets.Add(DefaultPolicies.SkipVerification);
this.named_permission_sets.Add(DefaultPolicies.Execution);
this.named_permission_sets.Add(DefaultPolicies.Nothing);
this.named_permission_sets.Add(DefaultPolicies.Everything);
this.named_permission_sets.Add(DefaultPolicies.FullTrust);
}
finally
{
SecurityManager.ResolvingPolicyLevel = null;
}
}
// Token: 0x0600346E RID: 13422 RVA: 0x000B4FF8 File Offset: 0x000B31F8
internal string ResolveClassName(string className)
{
if (this.fullNames != null)
{
object obj = this.fullNames[className];
if (obj != null)
{
return (string)obj;
}
}
return className;
}
// Token: 0x0600346F RID: 13423 RVA: 0x000B502C File Offset: 0x000B322C
internal bool IsFullTrustAssembly(Assembly a)
{
AssemblyName assemblyName = a.UnprotectedGetName();
StrongNamePublicKeyBlob strongNamePublicKeyBlob = new StrongNamePublicKeyBlob(assemblyName.GetPublicKey());
StrongNameMembershipCondition strongNameMembershipCondition = new StrongNameMembershipCondition(strongNamePublicKeyBlob, assemblyName.Name, assemblyName.Version);
foreach (object obj in this.full_trust_assemblies)
{
StrongNameMembershipCondition strongNameMembershipCondition2 = (StrongNameMembershipCondition)obj;
if (strongNameMembershipCondition2.Equals(strongNameMembershipCondition))
{
return true;
}
}
return false;
}
// Token: 0x04001561 RID: 5473
private string label;
// Token: 0x04001562 RID: 5474
private CodeGroup root_code_group;
// Token: 0x04001563 RID: 5475
private ArrayList full_trust_assemblies;
// Token: 0x04001564 RID: 5476
private ArrayList named_permission_sets;
// Token: 0x04001565 RID: 5477
private string _location;
// Token: 0x04001566 RID: 5478
private PolicyLevelType _type;
// Token: 0x04001567 RID: 5479
private Hashtable fullNames;
// Token: 0x04001568 RID: 5480
private SecurityElement xml;
}
}