using System;
using System.Reflection;
using System.Runtime.Hosting;
using System.Runtime.InteropServices;
using System.Security.Policy;
namespace System.Security
{
/// Allows the control and customization of security behavior for application domains.
// Token: 0x020005BE RID: 1470
[ComVisible(true)]
[Serializable]
public class HostSecurityManager
{
/// When overridden in a derived class, gets the security policy for the current application domain.
/// A object. The default is null.
///
///
///
// Token: 0x17000A88 RID: 2696
// (get) Token: 0x060035BC RID: 13756 RVA: 0x000B8354 File Offset: 0x000B6554
public virtual PolicyLevel DomainPolicy
{
get
{
return null;
}
}
/// Gets the flag representing the security policy components of concern to the host.
/// One of the values. The default is .
///
///
///
// Token: 0x17000A89 RID: 2697
// (get) Token: 0x060035BD RID: 13757 RVA: 0x000B8358 File Offset: 0x000B6558
public virtual HostSecurityManagerOptions Flags
{
get
{
return HostSecurityManagerOptions.AllFlags;
}
}
/// Determines whether an application should be executed.
/// An object that contains trust information about the application.
/// The for the application to be activated.
/// Optionally, the for the activating application domain.
/// A that specifies the trust context.
///
/// is null.
/// An object could not be found in the application evidence.-or-The property in the activation arguments is null.
/// The grant set does not contain the minimum request set specified by the .
// Token: 0x060035BE RID: 13758 RVA: 0x000B835C File Offset: 0x000B655C
public virtual ApplicationTrust DetermineApplicationTrust(Evidence applicationEvidence, Evidence activatorEvidence, TrustManagerContext context)
{
if (applicationEvidence == null)
{
throw new ArgumentNullException("applicationEvidence");
}
ActivationArguments activationArguments = null;
foreach (object obj in applicationEvidence)
{
activationArguments = obj as ActivationArguments;
if (activationArguments != null)
{
break;
}
}
if (activationArguments == null)
{
string text = Locale.GetText("No {0} found in {1}.");
throw new ArgumentException(string.Format(text, "ActivationArguments", "Evidence"), "applicationEvidence");
}
if (activationArguments.ActivationContext == null)
{
string text2 = Locale.GetText("No {0} found in {1}.");
throw new ArgumentException(string.Format(text2, "ActivationContext", "ActivationArguments"), "applicationEvidence");
}
if (!ApplicationSecurityManager.DetermineApplicationTrust(activationArguments.ActivationContext, context))
{
return null;
}
if (activationArguments.ApplicationIdentity == null)
{
return new ApplicationTrust();
}
return new ApplicationTrust(activationArguments.ApplicationIdentity);
}
/// Provides the application domain evidence for an assembly being loaded.
/// An object representing the evidence to be used for the .
/// Additional to add to the evidence.
// Token: 0x060035BF RID: 13759 RVA: 0x000B8470 File Offset: 0x000B6670
public virtual Evidence ProvideAppDomainEvidence(Evidence inputEvidence)
{
return inputEvidence;
}
/// Provides the assembly evidence for an assembly being loaded.
/// An object representing the evidence to be used for the assembly.
/// An object representing the loaded assembly.
/// Additional to add to the assembly evidence.
///
///
///
// Token: 0x060035C0 RID: 13760 RVA: 0x000B8474 File Offset: 0x000B6674
public virtual Evidence ProvideAssemblyEvidence(Assembly loadedAssembly, Evidence inputEvidence)
{
return inputEvidence;
}
/// Determines what permissions to grant to code based on the specified evidence.
/// The that can be granted by the security system.
/// The set used to evaluate policy.
// Token: 0x060035C1 RID: 13761 RVA: 0x000B8478 File Offset: 0x000B6678
public virtual PermissionSet ResolvePolicy(Evidence evidence)
{
if (evidence == null)
{
throw new NullReferenceException("evidence");
}
return SecurityManager.ResolvePolicy(evidence);
}
}
}