This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,43 @@
using System;
namespace System.Security.Permissions
{
// Token: 0x0200054D RID: 1357
internal enum BuiltInToken
{
// Token: 0x0400144A RID: 5194
Environment,
// Token: 0x0400144B RID: 5195
FileDialog,
// Token: 0x0400144C RID: 5196
FileIO,
// Token: 0x0400144D RID: 5197
IsolatedStorageFile,
// Token: 0x0400144E RID: 5198
Reflection,
// Token: 0x0400144F RID: 5199
Registry,
// Token: 0x04001450 RID: 5200
Security,
// Token: 0x04001451 RID: 5201
UI,
// Token: 0x04001452 RID: 5202
Principal,
// Token: 0x04001453 RID: 5203
HostProtection,
// Token: 0x04001454 RID: 5204
PublisherIdentity,
// Token: 0x04001455 RID: 5205
SiteIdentity,
// Token: 0x04001456 RID: 5206
StrongNameIdentity,
// Token: 0x04001457 RID: 5207
UrlIdentity,
// Token: 0x04001458 RID: 5208
ZoneIdentity,
// Token: 0x04001459 RID: 5209
GacIdentity,
// Token: 0x0400145A RID: 5210
KeyContainer
}
}
@@ -0,0 +1,22 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the base attribute class for code access security.</summary>
// Token: 0x0200053D RID: 1341
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Obsolete("CAS support is not available with Silverlight applications.")]
[ComVisible(true)]
[Serializable]
public abstract class CodeAccessSecurityAttribute : SecurityAttribute
{
/// <summary>Initializes a new instance of <see cref="T:System.Security.Permissions.CodeAccessSecurityAttribute" /> with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x06003117 RID: 12567 RVA: 0x000A8BB4 File Offset: 0x000A6DB4
protected CodeAccessSecurityAttribute(SecurityAction action)
: base(action)
{
}
}
}
@@ -0,0 +1,461 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
namespace System.Security.Permissions
{
/// <summary>Controls access to system and user environment variables. This class cannot be inherited.</summary>
// Token: 0x0200053E RID: 1342
[ComVisible(true)]
[Serializable]
public sealed class EnvironmentPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.EnvironmentPermission" /> class with either restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003118 RID: 12568 RVA: 0x000A8BC0 File Offset: 0x000A6DC0
public EnvironmentPermission(PermissionState state)
{
this._state = CodeAccessPermission.CheckPermissionState(state, true);
this.readList = new ArrayList();
this.writeList = new ArrayList();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.EnvironmentPermission" /> class with the specified access to the specified environment variables.</summary>
/// <param name="flag">One of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values. </param>
/// <param name="pathList">A list of environment variables (semicolon-separated) to which access is granted. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pathList" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" />. </exception>
// Token: 0x06003119 RID: 12569 RVA: 0x000A8BEC File Offset: 0x000A6DEC
public EnvironmentPermission(EnvironmentPermissionAccess flag, string pathList)
{
this.readList = new ArrayList();
this.writeList = new ArrayList();
this.SetPathList(flag, pathList);
}
// Token: 0x0600311A RID: 12570 RVA: 0x000A8C20 File Offset: 0x000A6E20
int IBuiltInPermission.GetTokenIndex()
{
return 0;
}
/// <summary>Adds access for the specified environment variables to the existing state of the permission.</summary>
/// <param name="flag">One of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values. </param>
/// <param name="pathList">A list of environment variables (semicolon-separated). </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pathList" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" />. </exception>
// Token: 0x0600311B RID: 12571 RVA: 0x000A8C24 File Offset: 0x000A6E24
public void AddPathList(EnvironmentPermissionAccess flag, string pathList)
{
if (pathList == null)
{
throw new ArgumentNullException("pathList");
}
switch (flag)
{
case EnvironmentPermissionAccess.NoAccess:
break;
case EnvironmentPermissionAccess.Read:
{
string[] array = pathList.Split(new char[] { ';' });
foreach (string text in array)
{
if (!this.readList.Contains(text))
{
this.readList.Add(text);
}
}
break;
}
case EnvironmentPermissionAccess.Write:
{
string[] array = pathList.Split(new char[] { ';' });
foreach (string text2 in array)
{
if (!this.writeList.Contains(text2))
{
this.writeList.Add(text2);
}
}
break;
}
case EnvironmentPermissionAccess.AllAccess:
{
string[] array = pathList.Split(new char[] { ';' });
foreach (string text3 in array)
{
if (!this.readList.Contains(text3))
{
this.readList.Add(text3);
}
if (!this.writeList.Contains(text3))
{
this.writeList.Add(text3);
}
}
break;
}
default:
this.ThrowInvalidFlag(flag, false);
break;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x0600311C RID: 12572 RVA: 0x000A8D94 File Offset: 0x000A6F94
public override IPermission Copy()
{
EnvironmentPermission environmentPermission = new EnvironmentPermission(this._state);
string text = this.GetPathList(EnvironmentPermissionAccess.Read);
if (text != null)
{
environmentPermission.SetPathList(EnvironmentPermissionAccess.Read, text);
}
text = this.GetPathList(EnvironmentPermissionAccess.Write);
if (text != null)
{
environmentPermission.SetPathList(EnvironmentPermissionAccess.Write, text);
}
return environmentPermission;
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x0600311D RID: 12573 RVA: 0x000A8DDC File Offset: 0x000A6FDC
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this._state = PermissionState.Unrestricted;
}
string text = esd.Attribute("Read");
if (text != null && text.Length > 0)
{
this.SetPathList(EnvironmentPermissionAccess.Read, text);
}
string text2 = esd.Attribute("Write");
if (text2 != null && text2.Length > 0)
{
this.SetPathList(EnvironmentPermissionAccess.Write, text2);
}
}
/// <summary>Gets all environment variables with the specified <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" />.</summary>
/// <returns>A list of environment variables (semicolon-separated) for the selected flag.</returns>
/// <param name="flag">One of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values that represents a single type of environment variable access. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="flag" /> is not a valid value of <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" />.-or- <paramref name="flag" /> is <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.AllAccess" />, which represents more than one type of environment variable access, or <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.NoAccess" />, which does not represent any type of environment variable access. </exception>
// Token: 0x0600311E RID: 12574 RVA: 0x000A8E58 File Offset: 0x000A7058
public string GetPathList(EnvironmentPermissionAccess flag)
{
switch (flag)
{
case EnvironmentPermissionAccess.NoAccess:
case EnvironmentPermissionAccess.AllAccess:
this.ThrowInvalidFlag(flag, true);
break;
case EnvironmentPermissionAccess.Read:
return this.GetPathList(this.readList);
case EnvironmentPermissionAccess.Write:
return this.GetPathList(this.writeList);
default:
this.ThrowInvalidFlag(flag, false);
break;
}
return null;
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600311F RID: 12575 RVA: 0x000A8EB8 File Offset: 0x000A70B8
public override IPermission Intersect(IPermission target)
{
EnvironmentPermission environmentPermission = this.Cast(target);
if (environmentPermission == null)
{
return null;
}
if (this.IsUnrestricted())
{
return environmentPermission.Copy();
}
if (environmentPermission.IsUnrestricted())
{
return this.Copy();
}
int num = 0;
EnvironmentPermission environmentPermission2 = new EnvironmentPermission(PermissionState.None);
string pathList = environmentPermission.GetPathList(EnvironmentPermissionAccess.Read);
if (pathList != null)
{
string[] array = pathList.Split(new char[] { ';' });
foreach (string text in array)
{
if (this.readList.Contains(text))
{
environmentPermission2.AddPathList(EnvironmentPermissionAccess.Read, text);
num++;
}
}
}
string pathList2 = environmentPermission.GetPathList(EnvironmentPermissionAccess.Write);
if (pathList2 != null)
{
string[] array3 = pathList2.Split(new char[] { ';' });
foreach (string text2 in array3)
{
if (this.writeList.Contains(text2))
{
environmentPermission2.AddPathList(EnvironmentPermissionAccess.Write, text2);
num++;
}
}
}
return (num <= 0) ? null : environmentPermission2;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003120 RID: 12576 RVA: 0x000A8FDC File Offset: 0x000A71DC
public override bool IsSubsetOf(IPermission target)
{
EnvironmentPermission environmentPermission = this.Cast(target);
if (environmentPermission == null)
{
return false;
}
if (this.IsUnrestricted())
{
return environmentPermission.IsUnrestricted();
}
if (environmentPermission.IsUnrestricted())
{
return true;
}
foreach (object obj in this.readList)
{
string text = (string)obj;
if (!environmentPermission.readList.Contains(text))
{
return false;
}
}
foreach (object obj2 in this.writeList)
{
string text2 = (string)obj2;
if (!environmentPermission.writeList.Contains(text2))
{
return false;
}
}
return true;
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003121 RID: 12577 RVA: 0x000A910C File Offset: 0x000A730C
public bool IsUnrestricted()
{
return this._state == PermissionState.Unrestricted;
}
/// <summary>Sets the specified access to the specified environment variables to the existing state of the permission.</summary>
/// <param name="flag">One of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values. </param>
/// <param name="pathList">A list of environment variables (semicolon-separated). </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pathList" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" />. </exception>
// Token: 0x06003122 RID: 12578 RVA: 0x000A9118 File Offset: 0x000A7318
public void SetPathList(EnvironmentPermissionAccess flag, string pathList)
{
if (pathList == null)
{
throw new ArgumentNullException("pathList");
}
switch (flag)
{
case EnvironmentPermissionAccess.NoAccess:
break;
case EnvironmentPermissionAccess.Read:
{
this.readList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text in array)
{
this.readList.Add(text);
}
break;
}
case EnvironmentPermissionAccess.Write:
{
this.writeList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text2 in array)
{
this.writeList.Add(text2);
}
break;
}
case EnvironmentPermissionAccess.AllAccess:
{
this.readList.Clear();
this.writeList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text3 in array)
{
this.readList.Add(text3);
this.writeList.Add(text3);
}
break;
}
default:
this.ThrowInvalidFlag(flag, false);
break;
}
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003123 RID: 12579 RVA: 0x000A9270 File Offset: 0x000A7470
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this._state == PermissionState.Unrestricted)
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
string text = this.GetPathList(EnvironmentPermissionAccess.Read);
if (text != null)
{
securityElement.AddAttribute("Read", text);
}
text = this.GetPathList(EnvironmentPermissionAccess.Write);
if (text != null)
{
securityElement.AddAttribute("Write", text);
}
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="other">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="other" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003124 RID: 12580 RVA: 0x000A92DC File Offset: 0x000A74DC
public override IPermission Union(IPermission other)
{
EnvironmentPermission environmentPermission = this.Cast(other);
if (environmentPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || environmentPermission.IsUnrestricted())
{
return new EnvironmentPermission(PermissionState.Unrestricted);
}
if (this.IsEmpty() && environmentPermission.IsEmpty())
{
return null;
}
EnvironmentPermission environmentPermission2 = (EnvironmentPermission)this.Copy();
string text = environmentPermission.GetPathList(EnvironmentPermissionAccess.Read);
if (text != null)
{
environmentPermission2.AddPathList(EnvironmentPermissionAccess.Read, text);
}
text = environmentPermission.GetPathList(EnvironmentPermissionAccess.Write);
if (text != null)
{
environmentPermission2.AddPathList(EnvironmentPermissionAccess.Write, text);
}
return environmentPermission2;
}
// Token: 0x06003125 RID: 12581 RVA: 0x000A936C File Offset: 0x000A756C
private bool IsEmpty()
{
return this._state == PermissionState.None && this.readList.Count == 0 && this.writeList.Count == 0;
}
// Token: 0x06003126 RID: 12582 RVA: 0x000A93A8 File Offset: 0x000A75A8
private EnvironmentPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
EnvironmentPermission environmentPermission = target as EnvironmentPermission;
if (environmentPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(EnvironmentPermission));
}
return environmentPermission;
}
// Token: 0x06003127 RID: 12583 RVA: 0x000A93DC File Offset: 0x000A75DC
internal void ThrowInvalidFlag(EnvironmentPermissionAccess flag, bool context)
{
string text;
if (context)
{
text = Locale.GetText("Unknown flag '{0}'.");
}
else
{
text = Locale.GetText("Invalid flag '{0}' in this context.");
}
throw new ArgumentException(string.Format(text, flag), "flag");
}
// Token: 0x06003128 RID: 12584 RVA: 0x000A9424 File Offset: 0x000A7624
private string GetPathList(ArrayList list)
{
if (this.IsUnrestricted())
{
return string.Empty;
}
if (list.Count == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder();
foreach (object obj in list)
{
string text = (string)obj;
stringBuilder.Append(text);
stringBuilder.Append(";");
}
string text2 = stringBuilder.ToString();
int length = text2.Length;
if (length > 0)
{
return text2.Substring(0, length - 1);
}
return string.Empty;
}
// Token: 0x0400140C RID: 5132
private const int version = 1;
// Token: 0x0400140D RID: 5133
private PermissionState _state;
// Token: 0x0400140E RID: 5134
private ArrayList readList;
// Token: 0x0400140F RID: 5135
private ArrayList writeList;
}
}
@@ -0,0 +1,27 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies access to environment variables.</summary>
// Token: 0x0200053F RID: 1343
[Flags]
[ComVisible(true)]
[Serializable]
public enum EnvironmentPermissionAccess
{
/// <summary>No access to environment variables. <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.NoAccess" /> represents no valid <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the parameter for <see cref="M:System.Security.Permissions.EnvironmentPermission.GetPathList(System.Security.Permissions.EnvironmentPermissionAccess)" />, which expects a single value.</summary>
// Token: 0x04001411 RID: 5137
NoAccess = 0,
/// <summary>Only read access to environment variables is specified. Changing, deleting and creating environment variables is not included in this access level.</summary>
// Token: 0x04001412 RID: 5138
Read = 1,
/// <summary>Only write access to environment variables is specified. Write access includes creating and deleting environment variables as well as changing existing values. Reading environment variables is not included in this access level.</summary>
// Token: 0x04001413 RID: 5139
Write = 2,
/// <summary>
/// <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.Read" /> and <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.Write" /> access to environment variables. <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.AllAccess" /> represents multiple <see cref="T:System.Security.Permissions.EnvironmentPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the <paramref name="flag" /> parameter for the <see cref="M:System.Security.Permissions.EnvironmentPermission.GetPathList(System.Security.Permissions.EnvironmentPermissionAccess)" /> method, which expects a single value.</summary>
// Token: 0x04001414 RID: 5140
AllAccess = 3
}
}
@@ -0,0 +1,89 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.EnvironmentPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000540 RID: 1344
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class EnvironmentPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.EnvironmentPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="action" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.SecurityAction" />. </exception>
// Token: 0x06003129 RID: 12585 RVA: 0x000A94F0 File Offset: 0x000A76F0
public EnvironmentPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Sets full access for the environment variables specified by the string value.</summary>
/// <returns>A list of environment variables for full access.</returns>
/// <exception cref="T:System.NotSupportedException">The get method is not supported for this property.</exception>
// Token: 0x1700099D RID: 2461
// (get) Token: 0x0600312A RID: 12586 RVA: 0x000A94FC File Offset: 0x000A76FC
// (set) Token: 0x0600312B RID: 12587 RVA: 0x000A9508 File Offset: 0x000A7708
public string All
{
get
{
throw new NotSupportedException("All");
}
set
{
this.read = value;
this.write = value;
}
}
/// <summary>Gets or sets read access for the environment variables specified by the string value.</summary>
/// <returns>A list of environment variables for read access.</returns>
// Token: 0x1700099E RID: 2462
// (get) Token: 0x0600312C RID: 12588 RVA: 0x000A9518 File Offset: 0x000A7718
// (set) Token: 0x0600312D RID: 12589 RVA: 0x000A9520 File Offset: 0x000A7720
public string Read
{
get
{
return this.read;
}
set
{
this.read = value;
}
}
/// <summary>Gets or sets write access for the environment variables specified by the string value.</summary>
/// <returns>A list of environment variables for write access.</returns>
// Token: 0x1700099F RID: 2463
// (get) Token: 0x0600312E RID: 12590 RVA: 0x000A952C File Offset: 0x000A772C
// (set) Token: 0x0600312F RID: 12591 RVA: 0x000A9534 File Offset: 0x000A7734
public string Write
{
get
{
return this.write;
}
set
{
this.write = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.EnvironmentPermission" />.</summary>
/// <returns>An <see cref="T:System.Security.Permissions.EnvironmentPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003130 RID: 12592 RVA: 0x000A9540 File Offset: 0x000A7740
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x04001415 RID: 5141
private string read;
// Token: 0x04001416 RID: 5142
private string write;
}
}
@@ -0,0 +1,196 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Controls the ability to access files or folders through a File dialog box. This class cannot be inherited.</summary>
// Token: 0x02000541 RID: 1345
[ComVisible(true)]
[Serializable]
public sealed class FileDialogPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileDialogPermission" /> class with either restricted or unrestricted permission, as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values (Unrestricted or None). </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003131 RID: 12593 RVA: 0x000A9544 File Offset: 0x000A7744
public FileDialogPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this._access = FileDialogPermissionAccess.OpenSave;
}
else
{
this._access = FileDialogPermissionAccess.None;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileDialogPermission" /> class with the specified access.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileDialogPermissionAccess" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid combination of the <see cref="T:System.Security.Permissions.FileDialogPermissionAccess" /> values. </exception>
// Token: 0x06003132 RID: 12594 RVA: 0x000A9578 File Offset: 0x000A7778
public FileDialogPermission(FileDialogPermissionAccess access)
{
this.Access = access;
}
// Token: 0x06003133 RID: 12595 RVA: 0x000A9588 File Offset: 0x000A7788
int IBuiltInPermission.GetTokenIndex()
{
return 1;
}
/// <summary>Gets or sets the permitted access to files.</summary>
/// <returns>The permitted access to files.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set the <paramref name="access" /> parameter to a value that is not a valid combination of the <see cref="T:System.Security.Permissions.FileDialogPermissionAccess" /> values. </exception>
// Token: 0x170009A0 RID: 2464
// (get) Token: 0x06003134 RID: 12596 RVA: 0x000A958C File Offset: 0x000A778C
// (set) Token: 0x06003135 RID: 12597 RVA: 0x000A9594 File Offset: 0x000A7794
public FileDialogPermissionAccess Access
{
get
{
return this._access;
}
set
{
if (!Enum.IsDefined(typeof(FileDialogPermissionAccess), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "FileDialogPermissionAccess");
}
this._access = value;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003136 RID: 12598 RVA: 0x000A95E4 File Offset: 0x000A77E4
public override IPermission Copy()
{
return new FileDialogPermission(this._access);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding used to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The version number of the <paramref name="esd" /> parameter is not supported. </exception>
// Token: 0x06003137 RID: 12599 RVA: 0x000A95F4 File Offset: 0x000A77F4
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this._access = FileDialogPermissionAccess.OpenSave;
}
else
{
string text = esd.Attribute("Access");
if (text == null)
{
this._access = FileDialogPermissionAccess.None;
}
else
{
this._access = (FileDialogPermissionAccess)((int)Enum.Parse(typeof(FileDialogPermissionAccess), text));
}
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003138 RID: 12600 RVA: 0x000A9660 File Offset: 0x000A7860
public override IPermission Intersect(IPermission target)
{
FileDialogPermission fileDialogPermission = this.Cast(target);
if (fileDialogPermission == null)
{
return null;
}
FileDialogPermissionAccess fileDialogPermissionAccess = this._access & fileDialogPermission._access;
return (fileDialogPermissionAccess != FileDialogPermissionAccess.None) ? new FileDialogPermission(fileDialogPermissionAccess) : null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003139 RID: 12601 RVA: 0x000A96A0 File Offset: 0x000A78A0
public override bool IsSubsetOf(IPermission target)
{
FileDialogPermission fileDialogPermission = this.Cast(target);
return fileDialogPermission != null && (this._access & fileDialogPermission._access) == this._access;
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x0600313A RID: 12602 RVA: 0x000A96D4 File Offset: 0x000A78D4
public bool IsUnrestricted()
{
return this._access == FileDialogPermissionAccess.OpenSave;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including state information.</returns>
// Token: 0x0600313B RID: 12603 RVA: 0x000A96E0 File Offset: 0x000A78E0
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
switch (this._access)
{
case FileDialogPermissionAccess.Open:
securityElement.AddAttribute("Access", "Open");
break;
case FileDialogPermissionAccess.Save:
securityElement.AddAttribute("Access", "Save");
break;
case FileDialogPermissionAccess.OpenSave:
securityElement.AddAttribute("Unrestricted", "true");
break;
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600313C RID: 12604 RVA: 0x000A9758 File Offset: 0x000A7958
public override IPermission Union(IPermission target)
{
FileDialogPermission fileDialogPermission = this.Cast(target);
if (fileDialogPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || fileDialogPermission.IsUnrestricted())
{
return new FileDialogPermission(PermissionState.Unrestricted);
}
return new FileDialogPermission(this._access | fileDialogPermission._access);
}
// Token: 0x0600313D RID: 12605 RVA: 0x000A97AC File Offset: 0x000A79AC
private FileDialogPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
FileDialogPermission fileDialogPermission = target as FileDialogPermission;
if (fileDialogPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(FileDialogPermission));
}
return fileDialogPermission;
}
// Token: 0x04001417 RID: 5143
private const int version = 1;
// Token: 0x04001418 RID: 5144
private FileDialogPermissionAccess _access;
}
}
@@ -0,0 +1,26 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the type of access to files allowed through the File dialog boxes.</summary>
// Token: 0x02000542 RID: 1346
[ComVisible(true)]
[Flags]
[Serializable]
public enum FileDialogPermissionAccess
{
/// <summary>No access to files through the File dialog boxes.</summary>
// Token: 0x0400141A RID: 5146
None = 0,
/// <summary>Ability to open files through the File dialog boxes.</summary>
// Token: 0x0400141B RID: 5147
Open = 1,
/// <summary>Ability to save files through the File dialog boxes.</summary>
// Token: 0x0400141C RID: 5148
Save = 2,
/// <summary>Ability to open and save files through the File dialog boxes.</summary>
// Token: 0x0400141D RID: 5149
OpenSave = 3
}
}
@@ -0,0 +1,87 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.FileDialogPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000543 RID: 1347
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileDialogPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600313E RID: 12606 RVA: 0x000A97E0 File Offset: 0x000A79E0
public FileDialogPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets a value indicating whether permission to open files through the file dialog is declared.</summary>
/// <returns>true if permission to open files through the file dialog is declared; otherwise, false.</returns>
// Token: 0x170009A1 RID: 2465
// (get) Token: 0x0600313F RID: 12607 RVA: 0x000A97EC File Offset: 0x000A79EC
// (set) Token: 0x06003140 RID: 12608 RVA: 0x000A97F4 File Offset: 0x000A79F4
public bool Open
{
get
{
return this.canOpen;
}
set
{
this.canOpen = value;
}
}
/// <summary>Gets or sets a value indicating whether permission to save files through the file dialog is declared.</summary>
/// <returns>true if permission to save files through the file dialog is declared; otherwise, false.</returns>
// Token: 0x170009A2 RID: 2466
// (get) Token: 0x06003141 RID: 12609 RVA: 0x000A9800 File Offset: 0x000A7A00
// (set) Token: 0x06003142 RID: 12610 RVA: 0x000A9808 File Offset: 0x000A7A08
public bool Save
{
get
{
return this.canSave;
}
set
{
this.canSave = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.FileDialogPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.FileDialogPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003143 RID: 12611 RVA: 0x000A9814 File Offset: 0x000A7A14
public override IPermission CreatePermission()
{
FileDialogPermission fileDialogPermission;
if (base.Unrestricted)
{
fileDialogPermission = new FileDialogPermission(PermissionState.Unrestricted);
}
else
{
FileDialogPermissionAccess fileDialogPermissionAccess = FileDialogPermissionAccess.None;
if (this.canOpen)
{
fileDialogPermissionAccess |= FileDialogPermissionAccess.Open;
}
if (this.canSave)
{
fileDialogPermissionAccess |= FileDialogPermissionAccess.Save;
}
fileDialogPermission = new FileDialogPermission(fileDialogPermissionAccess);
}
return fileDialogPermission;
}
// Token: 0x0400141E RID: 5150
private bool canOpen;
// Token: 0x0400141F RID: 5151
private bool canSave;
}
}
@@ -0,0 +1,692 @@
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
namespace System.Security.Permissions
{
/// <summary>Controls the ability to access files and folders. This class cannot be inherited.</summary>
// Token: 0x02000544 RID: 1348
[ComVisible(true)]
[Serializable]
public sealed class FileIOPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermission" /> class with fully restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> enumeration values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003144 RID: 12612 RVA: 0x000A9864 File Offset: 0x000A7A64
public FileIOPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this.m_Unrestricted = true;
this.m_AllFilesAccess = FileIOPermissionAccess.AllAccess;
this.m_AllLocalFilesAccess = FileIOPermissionAccess.AllAccess;
}
this.CreateLists();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermission" /> class with the specified access to the designated file or directory.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> enumeration values. </param>
/// <param name="path">The absolute path of the file or directory. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- The <paramref name="path" /> parameter is not a valid string.-or- The <paramref name="path" /> parameter does not specify the absolute path to the file or directory. </exception>
// Token: 0x06003145 RID: 12613 RVA: 0x000A98A4 File Offset: 0x000A7AA4
public FileIOPermission(FileIOPermissionAccess access, string path)
{
if (path == null)
{
throw new ArgumentNullException("path");
}
this.CreateLists();
this.AddPathList(access, path);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermission" /> class with the specified access to the designated files and directories.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> enumeration values. </param>
/// <param name="pathList">An array containing the absolute paths of the files and directories. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- An entry in the <paramref name="pathList" /> array is not a valid string. </exception>
// Token: 0x06003146 RID: 12614 RVA: 0x000A98D8 File Offset: 0x000A7AD8
public FileIOPermission(FileIOPermissionAccess access, string[] pathList)
{
if (pathList == null)
{
throw new ArgumentNullException("pathList");
}
this.CreateLists();
this.AddPathList(access, pathList);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermission" /> class with the specified access to the designated file or directory and the specified access rights to file control information.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> enumeration values.</param>
/// <param name="control">A bitwise combination of the <see cref="T:System.Security.AccessControl.AccessControlActions" /> enumeration values.</param>
/// <param name="path">The absolute path of the file or directory.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- The <paramref name="path" /> parameter is not a valid string.-or- The <paramref name="path" /> parameter does not specify the absolute path to the file or directory. </exception>
// Token: 0x06003147 RID: 12615 RVA: 0x000A990C File Offset: 0x000A7B0C
[MonoTODO("(2.0) Access Control isn't implemented")]
public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string path)
{
throw new NotImplementedException();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermission" /> class with the specified access to the designated files and directories and the specified access rights to file control information.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> enumeration values. </param>
/// <param name="control">A bitwise combination of the <see cref="T:System.Security.AccessControl.AccessControlActions" /> enumeration values.</param>
/// <param name="pathList">An array containing the absolute paths of the files and directories.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- An entry in the <paramref name="pathList" /> array is not a valid string. </exception>
// Token: 0x06003148 RID: 12616 RVA: 0x000A991C File Offset: 0x000A7B1C
[MonoTODO("(2.0) Access Control isn't implemented")]
public FileIOPermission(FileIOPermissionAccess access, AccessControlActions control, string[] pathList)
{
throw new NotImplementedException();
}
// Token: 0x0600314A RID: 12618 RVA: 0x000A9944 File Offset: 0x000A7B44
int IBuiltInPermission.GetTokenIndex()
{
return 2;
}
// Token: 0x0600314B RID: 12619 RVA: 0x000A9948 File Offset: 0x000A7B48
internal void CreateLists()
{
this.readList = new ArrayList();
this.writeList = new ArrayList();
this.appendList = new ArrayList();
this.pathList = new ArrayList();
}
/// <summary>Gets or sets the permitted access to all files.</summary>
/// <returns>The set of file I/O flags for all files.</returns>
// Token: 0x170009A3 RID: 2467
// (get) Token: 0x0600314C RID: 12620 RVA: 0x000A9984 File Offset: 0x000A7B84
// (set) Token: 0x0600314D RID: 12621 RVA: 0x000A998C File Offset: 0x000A7B8C
public FileIOPermissionAccess AllFiles
{
get
{
return this.m_AllFilesAccess;
}
set
{
if (!this.m_Unrestricted)
{
this.m_AllFilesAccess = value;
}
}
}
/// <summary>Gets or sets the permitted access to all local files.</summary>
/// <returns>The set of file I/O flags for all local files.</returns>
// Token: 0x170009A4 RID: 2468
// (get) Token: 0x0600314E RID: 12622 RVA: 0x000A99A0 File Offset: 0x000A7BA0
// (set) Token: 0x0600314F RID: 12623 RVA: 0x000A99A8 File Offset: 0x000A7BA8
public FileIOPermissionAccess AllLocalFiles
{
get
{
return this.m_AllLocalFilesAccess;
}
set
{
if (!this.m_Unrestricted)
{
this.m_AllLocalFilesAccess = value;
}
}
}
/// <summary>Adds access for the specified file or directory to the existing state of the permission.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values. </param>
/// <param name="path">The absolute path of a file or directory. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- The <paramref name="path" /> parameter is not a valid string.-or- The <paramref name="path" /> parameter did not specify the absolute path to the file or directory. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> parameter is null. </exception>
// Token: 0x06003150 RID: 12624 RVA: 0x000A99BC File Offset: 0x000A7BBC
public void AddPathList(FileIOPermissionAccess access, string path)
{
if ((FileIOPermissionAccess.AllAccess & access) != access)
{
FileIOPermission.ThrowInvalidFlag(access, true);
}
FileIOPermission.ThrowIfInvalidPath(path);
this.AddPathInternal(access, path);
}
/// <summary>Adds access for the specified files and directories to the existing state of the permission.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values. </param>
/// <param name="pathList">An array containing the absolute paths of the files and directories. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- An entry in the <paramref name="pathList" /> array is not valid. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pathList" /> parameter is null. </exception>
// Token: 0x06003151 RID: 12625 RVA: 0x000A99E0 File Offset: 0x000A7BE0
public void AddPathList(FileIOPermissionAccess access, string[] pathList)
{
if ((FileIOPermissionAccess.AllAccess & access) != access)
{
FileIOPermission.ThrowInvalidFlag(access, true);
}
FileIOPermission.ThrowIfInvalidPath(pathList);
foreach (string text in pathList)
{
this.AddPathInternal(access, text);
}
}
// Token: 0x06003152 RID: 12626 RVA: 0x000A9A28 File Offset: 0x000A7C28
internal void AddPathInternal(FileIOPermissionAccess access, string path)
{
path = Path.InsecureGetFullPath(path);
if ((access & FileIOPermissionAccess.Read) == FileIOPermissionAccess.Read)
{
this.readList.Add(path);
}
if ((access & FileIOPermissionAccess.Write) == FileIOPermissionAccess.Write)
{
this.writeList.Add(path);
}
if ((access & FileIOPermissionAccess.Append) == FileIOPermissionAccess.Append)
{
this.appendList.Add(path);
}
if ((access & FileIOPermissionAccess.PathDiscovery) == FileIOPermissionAccess.PathDiscovery)
{
this.pathList.Add(path);
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003153 RID: 12627 RVA: 0x000A9A98 File Offset: 0x000A7C98
public override IPermission Copy()
{
if (this.m_Unrestricted)
{
return new FileIOPermission(PermissionState.Unrestricted);
}
return new FileIOPermission(PermissionState.None)
{
readList = (ArrayList)this.readList.Clone(),
writeList = (ArrayList)this.writeList.Clone(),
appendList = (ArrayList)this.appendList.Clone(),
pathList = (ArrayList)this.pathList.Clone(),
m_AllFilesAccess = this.m_AllFilesAccess,
m_AllLocalFilesAccess = this.m_AllLocalFilesAccess
};
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding used to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not compatible. </exception>
// Token: 0x06003154 RID: 12628 RVA: 0x000A9B30 File Offset: 0x000A7D30
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this.m_Unrestricted = true;
}
else
{
this.m_Unrestricted = false;
string text = esd.Attribute("Read");
if (text != null)
{
string[] array = text.Split(new char[] { ';' });
this.AddPathList(FileIOPermissionAccess.Read, array);
}
text = esd.Attribute("Write");
if (text != null)
{
string[] array = text.Split(new char[] { ';' });
this.AddPathList(FileIOPermissionAccess.Write, array);
}
text = esd.Attribute("Append");
if (text != null)
{
string[] array = text.Split(new char[] { ';' });
this.AddPathList(FileIOPermissionAccess.Append, array);
}
text = esd.Attribute("PathDiscovery");
if (text != null)
{
string[] array = text.Split(new char[] { ';' });
this.AddPathList(FileIOPermissionAccess.PathDiscovery, array);
}
}
}
/// <summary>Gets all files and directories with the specified <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.</summary>
/// <returns>An array containing the paths of the files and directories to which access specified by the <paramref name="access" /> parameter is granted.</returns>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values that represents a single type of file access. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="access" /> is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- <paramref name="access" /> is <see cref="F:System.Security.Permissions.FileIOPermissionAccess.AllAccess" />, which represents more than one type of file access, or <see cref="F:System.Security.Permissions.FileIOPermissionAccess.NoAccess" />, which does not represent any type of file access. </exception>
// Token: 0x06003155 RID: 12629 RVA: 0x000A9C1C File Offset: 0x000A7E1C
public string[] GetPathList(FileIOPermissionAccess access)
{
if ((FileIOPermissionAccess.AllAccess & access) != access)
{
FileIOPermission.ThrowInvalidFlag(access, true);
}
ArrayList arrayList = new ArrayList();
switch (access)
{
case FileIOPermissionAccess.NoAccess:
goto IL_9D;
case FileIOPermissionAccess.Read:
arrayList.AddRange(this.readList);
goto IL_9D;
case FileIOPermissionAccess.Write:
arrayList.AddRange(this.writeList);
goto IL_9D;
case FileIOPermissionAccess.Append:
arrayList.AddRange(this.appendList);
goto IL_9D;
case FileIOPermissionAccess.PathDiscovery:
arrayList.AddRange(this.pathList);
goto IL_9D;
}
FileIOPermission.ThrowInvalidFlag(access, false);
IL_9D:
return (arrayList.Count <= 0) ? null : ((string[])arrayList.ToArray(typeof(string)));
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003156 RID: 12630 RVA: 0x000A9CF0 File Offset: 0x000A7EF0
public override IPermission Intersect(IPermission target)
{
FileIOPermission fileIOPermission = FileIOPermission.Cast(target);
if (fileIOPermission == null)
{
return null;
}
if (this.IsUnrestricted())
{
return fileIOPermission.Copy();
}
if (fileIOPermission.IsUnrestricted())
{
return this.Copy();
}
FileIOPermission fileIOPermission2 = new FileIOPermission(PermissionState.None);
fileIOPermission2.AllFiles = this.m_AllFilesAccess & fileIOPermission.AllFiles;
fileIOPermission2.AllLocalFiles = this.m_AllLocalFilesAccess & fileIOPermission.AllLocalFiles;
FileIOPermission.IntersectKeys(this.readList, fileIOPermission.readList, fileIOPermission2.readList);
FileIOPermission.IntersectKeys(this.writeList, fileIOPermission.writeList, fileIOPermission2.writeList);
FileIOPermission.IntersectKeys(this.appendList, fileIOPermission.appendList, fileIOPermission2.appendList);
FileIOPermission.IntersectKeys(this.pathList, fileIOPermission.pathList, fileIOPermission2.pathList);
return (!fileIOPermission2.IsEmpty()) ? fileIOPermission2 : null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003157 RID: 12631 RVA: 0x000A9DCC File Offset: 0x000A7FCC
public override bool IsSubsetOf(IPermission target)
{
FileIOPermission fileIOPermission = FileIOPermission.Cast(target);
if (fileIOPermission == null)
{
return false;
}
if (fileIOPermission.IsEmpty())
{
return this.IsEmpty();
}
if (this.IsUnrestricted())
{
return fileIOPermission.IsUnrestricted();
}
return fileIOPermission.IsUnrestricted() || ((this.m_AllFilesAccess & fileIOPermission.AllFiles) == this.m_AllFilesAccess && (this.m_AllLocalFilesAccess & fileIOPermission.AllLocalFiles) == this.m_AllLocalFilesAccess && FileIOPermission.KeyIsSubsetOf(this.appendList, fileIOPermission.appendList) && FileIOPermission.KeyIsSubsetOf(this.readList, fileIOPermission.readList) && FileIOPermission.KeyIsSubsetOf(this.writeList, fileIOPermission.writeList) && FileIOPermission.KeyIsSubsetOf(this.pathList, fileIOPermission.pathList));
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003158 RID: 12632 RVA: 0x000A9EB0 File Offset: 0x000A80B0
public bool IsUnrestricted()
{
return this.m_Unrestricted;
}
/// <summary>Sets the specified access to the specified file or directory, replacing the existing state of the permission.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values. </param>
/// <param name="path">The absolute path of the file or directory. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- The <paramref name="path" /> parameter is not a valid string.-or- The <paramref name="path" /> parameter did not specify the absolute path to the file or directory. </exception>
// Token: 0x06003159 RID: 12633 RVA: 0x000A9EB8 File Offset: 0x000A80B8
public void SetPathList(FileIOPermissionAccess access, string path)
{
if ((FileIOPermissionAccess.AllAccess & access) != access)
{
FileIOPermission.ThrowInvalidFlag(access, true);
}
FileIOPermission.ThrowIfInvalidPath(path);
this.Clear(access);
this.AddPathInternal(access, path);
}
/// <summary>Sets the specified access to the specified files and directories, replacing the current state for the specified access with the new set of paths.</summary>
/// <param name="access">A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values. </param>
/// <param name="pathList">An array containing the absolute paths of the files and directories. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.FileIOPermissionAccess" />.-or- An entry in the <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x0600315A RID: 12634 RVA: 0x000A9EEC File Offset: 0x000A80EC
public void SetPathList(FileIOPermissionAccess access, string[] pathList)
{
if ((FileIOPermissionAccess.AllAccess & access) != access)
{
FileIOPermission.ThrowInvalidFlag(access, true);
}
FileIOPermission.ThrowIfInvalidPath(pathList);
this.Clear(access);
foreach (string text in pathList)
{
this.AddPathInternal(access, text);
}
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x0600315B RID: 12635 RVA: 0x000A9F3C File Offset: 0x000A813C
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.m_Unrestricted)
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
string[] array = this.GetPathList(FileIOPermissionAccess.Append);
if (array != null && array.Length > 0)
{
securityElement.AddAttribute("Append", string.Join(";", array));
}
array = this.GetPathList(FileIOPermissionAccess.Read);
if (array != null && array.Length > 0)
{
securityElement.AddAttribute("Read", string.Join(";", array));
}
array = this.GetPathList(FileIOPermissionAccess.Write);
if (array != null && array.Length > 0)
{
securityElement.AddAttribute("Write", string.Join(";", array));
}
array = this.GetPathList(FileIOPermissionAccess.PathDiscovery);
if (array != null && array.Length > 0)
{
securityElement.AddAttribute("PathDiscovery", string.Join(";", array));
}
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="other">A permission to combine with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="other" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600315C RID: 12636 RVA: 0x000AA028 File Offset: 0x000A8228
public override IPermission Union(IPermission other)
{
FileIOPermission fileIOPermission = FileIOPermission.Cast(other);
if (fileIOPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || fileIOPermission.IsUnrestricted())
{
return new FileIOPermission(PermissionState.Unrestricted);
}
if (this.IsEmpty() && fileIOPermission.IsEmpty())
{
return null;
}
FileIOPermission fileIOPermission2 = (FileIOPermission)this.Copy();
fileIOPermission2.AllFiles |= fileIOPermission.AllFiles;
fileIOPermission2.AllLocalFiles |= fileIOPermission.AllLocalFiles;
string[] array = fileIOPermission.GetPathList(FileIOPermissionAccess.Read);
if (array != null)
{
FileIOPermission.UnionKeys(fileIOPermission2.readList, array);
}
array = fileIOPermission.GetPathList(FileIOPermissionAccess.Write);
if (array != null)
{
FileIOPermission.UnionKeys(fileIOPermission2.writeList, array);
}
array = fileIOPermission.GetPathList(FileIOPermissionAccess.Append);
if (array != null)
{
FileIOPermission.UnionKeys(fileIOPermission2.appendList, array);
}
array = fileIOPermission.GetPathList(FileIOPermissionAccess.PathDiscovery);
if (array != null)
{
FileIOPermission.UnionKeys(fileIOPermission2.pathList, array);
}
return fileIOPermission2;
}
/// <summary>Determines whether the specified <see cref="T:System.Security.Permissions.FileIOPermission" /> object is equal to the current <see cref="T:System.Security.Permissions.FileIOPermission" />.</summary>
/// <returns>true if the specified <see cref="T:System.Security.Permissions.FileIOPermission" /> is equal to the current <see cref="T:System.Security.Permissions.FileIOPermission" /> object; otherwise, false.</returns>
/// <param name="obj">The <see cref="T:System.Security.Permissions.FileIOPermission" /> object to compare with the current <see cref="T:System.Security.Permissions.FileIOPermission" />. </param>
// Token: 0x0600315D RID: 12637 RVA: 0x000AA11C File Offset: 0x000A831C
[MonoTODO("(2.0)")]
[ComVisible(false)]
public override bool Equals(object obj)
{
return false;
}
/// <summary>Gets a hash code for the <see cref="T:System.Security.Permissions.FileIOPermission" /> object that is suitable for use in hashing algorithms and data structures such as a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Security.Permissions.FileIOPermission" /> object.</returns>
// Token: 0x0600315E RID: 12638 RVA: 0x000AA120 File Offset: 0x000A8320
[MonoTODO("(2.0)")]
[ComVisible(false)]
public override int GetHashCode()
{
return base.GetHashCode();
}
// Token: 0x0600315F RID: 12639 RVA: 0x000AA128 File Offset: 0x000A8328
private bool IsEmpty()
{
return !this.m_Unrestricted && this.appendList.Count == 0 && this.readList.Count == 0 && this.writeList.Count == 0 && this.pathList.Count == 0;
}
// Token: 0x06003160 RID: 12640 RVA: 0x000AA184 File Offset: 0x000A8384
private static FileIOPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
FileIOPermission fileIOPermission = target as FileIOPermission;
if (fileIOPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(FileIOPermission));
}
return fileIOPermission;
}
// Token: 0x06003161 RID: 12641 RVA: 0x000AA1B8 File Offset: 0x000A83B8
internal static void ThrowInvalidFlag(FileIOPermissionAccess access, bool context)
{
string text;
if (context)
{
text = Locale.GetText("Unknown flag '{0}'.");
}
else
{
text = Locale.GetText("Invalid flag '{0}' in this context.");
}
throw new ArgumentException(string.Format(text, access), "access");
}
// Token: 0x06003162 RID: 12642 RVA: 0x000AA200 File Offset: 0x000A8400
internal static void ThrowIfInvalidPath(string path)
{
string directoryName = Path.GetDirectoryName(path);
if (directoryName != null && directoryName.LastIndexOfAny(FileIOPermission.BadPathNameCharacters) >= 0)
{
string text = string.Format(Locale.GetText("Invalid path characters in path: '{0}'"), path);
throw new ArgumentException(text, "path");
}
string fileName = Path.GetFileName(path);
if (fileName != null && fileName.LastIndexOfAny(FileIOPermission.BadFileNameCharacters) >= 0)
{
string text2 = string.Format(Locale.GetText("Invalid filename characters in path: '{0}'"), path);
throw new ArgumentException(text2, "path");
}
if (!Path.IsPathRooted(path))
{
string text3 = Locale.GetText("Absolute path information is required.");
throw new ArgumentException(text3, "path");
}
}
// Token: 0x06003163 RID: 12643 RVA: 0x000AA2A8 File Offset: 0x000A84A8
internal static void ThrowIfInvalidPath(string[] paths)
{
foreach (string text in paths)
{
FileIOPermission.ThrowIfInvalidPath(text);
}
}
// Token: 0x06003164 RID: 12644 RVA: 0x000AA2D8 File Offset: 0x000A84D8
internal void Clear(FileIOPermissionAccess access)
{
if ((access & FileIOPermissionAccess.Read) == FileIOPermissionAccess.Read)
{
this.readList.Clear();
}
if ((access & FileIOPermissionAccess.Write) == FileIOPermissionAccess.Write)
{
this.writeList.Clear();
}
if ((access & FileIOPermissionAccess.Append) == FileIOPermissionAccess.Append)
{
this.appendList.Clear();
}
if ((access & FileIOPermissionAccess.PathDiscovery) == FileIOPermissionAccess.PathDiscovery)
{
this.pathList.Clear();
}
}
// Token: 0x06003165 RID: 12645 RVA: 0x000AA338 File Offset: 0x000A8538
internal static bool KeyIsSubsetOf(IList local, IList target)
{
bool flag = false;
foreach (object obj in local)
{
string text = (string)obj;
foreach (object obj2 in target)
{
string text2 = (string)obj2;
if (Path.IsPathSubsetOf(text2, text))
{
flag = true;
break;
}
}
if (!flag)
{
return false;
}
}
return true;
}
// Token: 0x06003166 RID: 12646 RVA: 0x000AA420 File Offset: 0x000A8620
internal static void UnionKeys(IList list, string[] paths)
{
foreach (string text in paths)
{
int count = list.Count;
if (count == 0)
{
list.Add(text);
}
else
{
int j;
for (j = 0; j < count; j++)
{
string text2 = (string)list[j];
if (Path.IsPathSubsetOf(text, text2))
{
list[j] = text;
break;
}
if (Path.IsPathSubsetOf(text2, text))
{
break;
}
}
if (j == count)
{
list.Add(text);
}
}
}
}
// Token: 0x06003167 RID: 12647 RVA: 0x000AA4C4 File Offset: 0x000A86C4
internal static void IntersectKeys(IList local, IList target, IList result)
{
foreach (object obj in local)
{
string text = (string)obj;
foreach (object obj2 in target)
{
string text2 = (string)obj2;
if (text2.Length > text.Length)
{
if (Path.IsPathSubsetOf(text, text2))
{
result.Add(text2);
}
}
else if (Path.IsPathSubsetOf(text2, text))
{
result.Add(text);
}
}
}
}
// Token: 0x04001420 RID: 5152
private const int version = 1;
// Token: 0x04001421 RID: 5153
private static char[] BadPathNameCharacters = Path.GetInvalidPathChars();
// Token: 0x04001422 RID: 5154
private static char[] BadFileNameCharacters = Path.GetInvalidFileNameChars();
// Token: 0x04001423 RID: 5155
private bool m_Unrestricted;
// Token: 0x04001424 RID: 5156
private FileIOPermissionAccess m_AllFilesAccess;
// Token: 0x04001425 RID: 5157
private FileIOPermissionAccess m_AllLocalFilesAccess;
// Token: 0x04001426 RID: 5158
private ArrayList readList;
// Token: 0x04001427 RID: 5159
private ArrayList writeList;
// Token: 0x04001428 RID: 5160
private ArrayList appendList;
// Token: 0x04001429 RID: 5161
private ArrayList pathList;
}
}
@@ -0,0 +1,33 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the type of file access requested.</summary>
// Token: 0x02000545 RID: 1349
[ComVisible(true)]
[Flags]
[Serializable]
public enum FileIOPermissionAccess
{
/// <summary>No access to a file or directory. <see cref="F:System.Security.Permissions.FileIOPermissionAccess.NoAccess" /> represents no valid <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the parameter for <see cref="M:System.Security.Permissions.FileIOPermission.GetPathList(System.Security.Permissions.FileIOPermissionAccess)" />, which expects a single value.</summary>
// Token: 0x0400142B RID: 5163
NoAccess = 0,
/// <summary>Access to read from a file or directory.</summary>
// Token: 0x0400142C RID: 5164
Read = 1,
/// <summary>Access to write to or delete a file or directory. <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /> access includes deleting and overwriting files or directories.</summary>
// Token: 0x0400142D RID: 5165
Write = 2,
/// <summary>Access to append material to a file or directory. <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Append" /> access includes the ability to create a new file or directory.</summary>
// Token: 0x0400142E RID: 5166
Append = 4,
/// <summary>Access to the information in the path itself. This helps protect sensitive information in the path, such as user names, as well as information about the directory structure revealed in the path. This value does not grant access to files or folders represented by the path.</summary>
// Token: 0x0400142F RID: 5167
PathDiscovery = 8,
/// <summary>
/// <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Append" />, <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" />, <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />, and <see cref="F:System.Security.Permissions.FileIOPermissionAccess.PathDiscovery" /> access to a file or directory. <see cref="F:System.Security.Permissions.FileIOPermissionAccess.AllAccess" /> represents multiple <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the <paramref name="access" /> parameter for the <see cref="M:System.Security.Permissions.FileIOPermission.GetPathList(System.Security.Permissions.FileIOPermissionAccess)" /> method, which expects a single value.</summary>
// Token: 0x04001430 RID: 5168
AllAccess = 15
}
}
@@ -0,0 +1,234 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.FileIOPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000546 RID: 1350
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class FileIOPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.FileIOPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="action" /> parameter is not a valid <see cref="T:System.Security.Permissions.SecurityAction" />. </exception>
// Token: 0x06003168 RID: 12648 RVA: 0x000AA5C0 File Offset: 0x000A87C0
public FileIOPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets full access for the file or directory that is specified by the string value.</summary>
/// <returns>The absolute path of the file or directory for full access.</returns>
/// <exception cref="T:System.NotSupportedException">The get method is not supported for this property.</exception>
// Token: 0x170009A5 RID: 2469
// (get) Token: 0x06003169 RID: 12649 RVA: 0x000AA5CC File Offset: 0x000A87CC
// (set) Token: 0x0600316A RID: 12650 RVA: 0x000AA5D8 File Offset: 0x000A87D8
[Obsolete("use newer properties")]
public string All
{
get
{
throw new NotSupportedException("All");
}
set
{
this.append = value;
this.path = value;
this.read = value;
this.write = value;
}
}
/// <summary>Gets or sets append access for the file or directory that is specified by the string value.</summary>
/// <returns>The absolute path of the file or directory for append access.</returns>
// Token: 0x170009A6 RID: 2470
// (get) Token: 0x0600316B RID: 12651 RVA: 0x000AA5F8 File Offset: 0x000A87F8
// (set) Token: 0x0600316C RID: 12652 RVA: 0x000AA600 File Offset: 0x000A8800
public string Append
{
get
{
return this.append;
}
set
{
this.append = value;
}
}
/// <summary>Gets or sets the file or directory to which to grant path discovery.</summary>
/// <returns>The absolute path of the file or directory.</returns>
// Token: 0x170009A7 RID: 2471
// (get) Token: 0x0600316D RID: 12653 RVA: 0x000AA60C File Offset: 0x000A880C
// (set) Token: 0x0600316E RID: 12654 RVA: 0x000AA614 File Offset: 0x000A8814
public string PathDiscovery
{
get
{
return this.path;
}
set
{
this.path = value;
}
}
/// <summary>Gets or sets read access for the file or directory specified by the string value.</summary>
/// <returns>The absolute path of the file or directory for read access.</returns>
// Token: 0x170009A8 RID: 2472
// (get) Token: 0x0600316F RID: 12655 RVA: 0x000AA620 File Offset: 0x000A8820
// (set) Token: 0x06003170 RID: 12656 RVA: 0x000AA628 File Offset: 0x000A8828
public string Read
{
get
{
return this.read;
}
set
{
this.read = value;
}
}
/// <summary>Gets or sets write access for the file or directory specified by the string value.</summary>
/// <returns>The absolute path of the file or directory for write access.</returns>
// Token: 0x170009A9 RID: 2473
// (get) Token: 0x06003171 RID: 12657 RVA: 0x000AA634 File Offset: 0x000A8834
// (set) Token: 0x06003172 RID: 12658 RVA: 0x000AA63C File Offset: 0x000A883C
public string Write
{
get
{
return this.write;
}
set
{
this.write = value;
}
}
/// <summary>Gets or sets the permitted access to all files.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values that represents the permissions for all files. The default is <see cref="F:System.Security.Permissions.FileIOPermissionAccess.NoAccess" />.</returns>
// Token: 0x170009AA RID: 2474
// (get) Token: 0x06003173 RID: 12659 RVA: 0x000AA648 File Offset: 0x000A8848
// (set) Token: 0x06003174 RID: 12660 RVA: 0x000AA650 File Offset: 0x000A8850
public FileIOPermissionAccess AllFiles
{
get
{
return this.allFiles;
}
set
{
this.allFiles = value;
}
}
/// <summary>Gets or sets the permitted access to all local files.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.FileIOPermissionAccess" /> values that represents the permissions for all local files. The default is <see cref="F:System.Security.Permissions.FileIOPermissionAccess.NoAccess" />.</returns>
// Token: 0x170009AB RID: 2475
// (get) Token: 0x06003175 RID: 12661 RVA: 0x000AA65C File Offset: 0x000A885C
// (set) Token: 0x06003176 RID: 12662 RVA: 0x000AA664 File Offset: 0x000A8864
public FileIOPermissionAccess AllLocalFiles
{
get
{
return this.allLocalFiles;
}
set
{
this.allLocalFiles = value;
}
}
/// <summary>Gets or sets the file or directory in which access control information can be changed.</summary>
/// <returns>The absolute path of the file or directory in which access control information can be changed.</returns>
// Token: 0x170009AC RID: 2476
// (get) Token: 0x06003177 RID: 12663 RVA: 0x000AA670 File Offset: 0x000A8870
// (set) Token: 0x06003178 RID: 12664 RVA: 0x000AA678 File Offset: 0x000A8878
public string ChangeAccessControl
{
get
{
return this.changeAccessControl;
}
set
{
this.changeAccessControl = value;
}
}
/// <summary>Gets or sets the file or directory in which access control information can be viewed.</summary>
/// <returns>The absolute path of the file or directory in which access control information can be viewed.</returns>
// Token: 0x170009AD RID: 2477
// (get) Token: 0x06003179 RID: 12665 RVA: 0x000AA684 File Offset: 0x000A8884
// (set) Token: 0x0600317A RID: 12666 RVA: 0x000AA68C File Offset: 0x000A888C
public string ViewAccessControl
{
get
{
return this.viewAccessControl;
}
set
{
this.viewAccessControl = value;
}
}
/// <summary>Gets or sets the file or directory in which file data can be viewed and modified.</summary>
/// <returns>The absolute path of the file or directory in which file data can be viewed and modified.</returns>
/// <exception cref="T:System.NotSupportedException">The get accessor is called. The accessor is provided only for C# compiler compatibility.</exception>
// Token: 0x170009AE RID: 2478
// (get) Token: 0x0600317B RID: 12667 RVA: 0x000AA698 File Offset: 0x000A8898
// (set) Token: 0x0600317C RID: 12668 RVA: 0x000AA6A0 File Offset: 0x000A88A0
public string ViewAndModify
{
get
{
throw new NotSupportedException();
}
set
{
this.append = value;
this.path = value;
this.read = value;
this.write = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.FileIOPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.FileIOPermission" /> that corresponds to this attribute.</returns>
/// <exception cref="T:System.ArgumentException">The path information for a file or directory for which access is to be secured contains invalid characters or wildcard specifiers. </exception>
// Token: 0x0600317D RID: 12669 RVA: 0x000AA6C0 File Offset: 0x000A88C0
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x04001431 RID: 5169
private string append;
// Token: 0x04001432 RID: 5170
private string path;
// Token: 0x04001433 RID: 5171
private string read;
// Token: 0x04001434 RID: 5172
private string write;
// Token: 0x04001435 RID: 5173
private FileIOPermissionAccess allFiles;
// Token: 0x04001436 RID: 5174
private FileIOPermissionAccess allLocalFiles;
// Token: 0x04001437 RID: 5175
private string changeAccessControl;
// Token: 0x04001438 RID: 5176
private string viewAccessControl;
}
}
@@ -0,0 +1,119 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Defines the identity permission for files originating in the global assembly cache. This class cannot be inherited.</summary>
// Token: 0x02000547 RID: 1351
[ComVisible(true)]
[Serializable]
public sealed class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.GacIdentityPermission" /> class.</summary>
// Token: 0x0600317E RID: 12670 RVA: 0x000AA6C4 File Offset: 0x000A88C4
public GacIdentityPermission()
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.GacIdentityPermission" /> class with fully restricted <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values.</param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="state" /> is not a valid <see cref="T:System.Security.Permissions.PermissionState" /> value. </exception>
// Token: 0x0600317F RID: 12671 RVA: 0x000AA6CC File Offset: 0x000A88CC
public GacIdentityPermission(PermissionState state)
{
CodeAccessPermission.CheckPermissionState(state, false);
}
// Token: 0x06003180 RID: 12672 RVA: 0x000AA6DC File Offset: 0x000A88DC
int IBuiltInPermission.GetTokenIndex()
{
return 15;
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003181 RID: 12673 RVA: 0x000AA6E0 File Offset: 0x000A88E0
public override IPermission Copy()
{
return new GacIdentityPermission();
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. The new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003182 RID: 12674 RVA: 0x000AA6E8 File Offset: 0x000A88E8
public override IPermission Intersect(IPermission target)
{
if (this.Cast(target) == null)
{
return null;
}
return this.Copy();
}
/// <summary>Indicates whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission object to test for the subset relationship. The permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003183 RID: 12675 RVA: 0x000AA70C File Offset: 0x000A890C
public override bool IsSubsetOf(IPermission target)
{
GacIdentityPermission gacIdentityPermission = this.Cast(target);
return gacIdentityPermission != null;
}
/// <summary>Creates and returns a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003184 RID: 12676 RVA: 0x000AA728 File Offset: 0x000A8928
public override IPermission Union(IPermission target)
{
this.Cast(target);
return this.Copy();
}
/// <summary>Creates a permission from an XML encoding.</summary>
/// <param name="securityElement">A <see cref="T:System.Security.SecurityElement" /> that contains the XML encoding to use to create the permission. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="securityElement" />is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="securityElement" /> is not a valid permission element. -or- The version number of <paramref name="securityElement" /> is not valid. </exception>
// Token: 0x06003185 RID: 12677 RVA: 0x000AA738 File Offset: 0x000A8938
public override void FromXml(SecurityElement securityElement)
{
CodeAccessPermission.CheckSecurityElement(securityElement, "securityElement", 1, 1);
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>A <see cref="T:System.Security.SecurityElement" /> that represents the XML encoding of the permission, including any state information.</returns>
// Token: 0x06003186 RID: 12678 RVA: 0x000AA748 File Offset: 0x000A8948
public override SecurityElement ToXml()
{
return base.Element(1);
}
// Token: 0x06003187 RID: 12679 RVA: 0x000AA760 File Offset: 0x000A8960
private GacIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
GacIdentityPermission gacIdentityPermission = target as GacIdentityPermission;
if (gacIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(GacIdentityPermission));
}
return gacIdentityPermission;
}
// Token: 0x04001439 RID: 5177
private const int version = 1;
}
}
@@ -0,0 +1,30 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.GacIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000548 RID: 1352
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.GacIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" /> value.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="action" /> parameter is not a valid <see cref="T:System.Security.Permissions.SecurityAction" /> value. </exception>
// Token: 0x06003188 RID: 12680 RVA: 0x000AA794 File Offset: 0x000A8994
public GacIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Creates a new <see cref="T:System.Security.Permissions.GacIdentityPermission" /> object.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.GacIdentityPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003189 RID: 12681 RVA: 0x000AA7A0 File Offset: 0x000A89A0
public override IPermission CreatePermission()
{
return new GacIdentityPermission();
}
}
}
@@ -0,0 +1,280 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows the use of declarative security actions to determine host protection requirements. This class cannot be inherited.</summary>
// Token: 0x02000549 RID: 1353
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class HostProtectionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.HostProtectionAttribute" /> class with default values.</summary>
// Token: 0x0600318A RID: 12682 RVA: 0x000AA7A8 File Offset: 0x000A89A8
public HostProtectionAttribute()
: base(SecurityAction.LinkDemand)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.HostProtectionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" /> value.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="action" /> is not <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" />. </exception>
// Token: 0x0600318B RID: 12683 RVA: 0x000AA7B4 File Offset: 0x000A89B4
public HostProtectionAttribute(SecurityAction action)
: base(action)
{
if (action != SecurityAction.LinkDemand)
{
string text = string.Format(Locale.GetText("Only {0} is accepted."), SecurityAction.LinkDemand);
throw new ArgumentException(text, "action");
}
}
/// <summary>Gets or sets a value indicating whether external process management is exposed.</summary>
/// <returns>true if external process management is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009AF RID: 2479
// (get) Token: 0x0600318C RID: 12684 RVA: 0x000AA7F4 File Offset: 0x000A89F4
// (set) Token: 0x0600318D RID: 12685 RVA: 0x000AA804 File Offset: 0x000A8A04
public bool ExternalProcessMgmt
{
get
{
return (this._resources & HostProtectionResource.ExternalProcessMgmt) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.ExternalProcessMgmt;
}
else
{
this._resources &= ~HostProtectionResource.ExternalProcessMgmt;
}
}
}
/// <summary>Gets or sets a value indicating whether external threading is exposed.</summary>
/// <returns>true if external threading is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B0 RID: 2480
// (get) Token: 0x0600318E RID: 12686 RVA: 0x000AA83C File Offset: 0x000A8A3C
// (set) Token: 0x0600318F RID: 12687 RVA: 0x000AA850 File Offset: 0x000A8A50
public bool ExternalThreading
{
get
{
return (this._resources & HostProtectionResource.ExternalThreading) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.ExternalThreading;
}
else
{
this._resources &= ~HostProtectionResource.ExternalThreading;
}
}
}
/// <summary>Gets or sets a value indicating whether resources might leak memory if the operation is terminated.</summary>
/// <returns>true if resources might leak memory on termination; otherwise, false.</returns>
// Token: 0x170009B1 RID: 2481
// (get) Token: 0x06003190 RID: 12688 RVA: 0x000AA87C File Offset: 0x000A8A7C
// (set) Token: 0x06003191 RID: 12689 RVA: 0x000AA890 File Offset: 0x000A8A90
public bool MayLeakOnAbort
{
get
{
return (this._resources & HostProtectionResource.MayLeakOnAbort) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.MayLeakOnAbort;
}
else
{
this._resources &= ~HostProtectionResource.MayLeakOnAbort;
}
}
}
/// <summary>Gets or sets a value indicating whether the security infrastructure is exposed.</summary>
/// <returns>true if the security infrastructure is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B2 RID: 2482
// (get) Token: 0x06003192 RID: 12690 RVA: 0x000AA8C4 File Offset: 0x000A8AC4
// (set) Token: 0x06003193 RID: 12691 RVA: 0x000AA8D8 File Offset: 0x000A8AD8
[ComVisible(true)]
public bool SecurityInfrastructure
{
get
{
return (this._resources & HostProtectionResource.SecurityInfrastructure) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.SecurityInfrastructure;
}
else
{
this._resources &= ~HostProtectionResource.SecurityInfrastructure;
}
}
}
/// <summary>Gets or sets a value indicating whether self-affecting process management is exposed.</summary>
/// <returns>true if self-affecting process management is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B3 RID: 2483
// (get) Token: 0x06003194 RID: 12692 RVA: 0x000AA904 File Offset: 0x000A8B04
// (set) Token: 0x06003195 RID: 12693 RVA: 0x000AA914 File Offset: 0x000A8B14
public bool SelfAffectingProcessMgmt
{
get
{
return (this._resources & HostProtectionResource.SelfAffectingProcessMgmt) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.SelfAffectingProcessMgmt;
}
else
{
this._resources &= ~HostProtectionResource.SelfAffectingProcessMgmt;
}
}
}
/// <summary>Gets or sets a value indicating whether self-affecting threading is exposed.</summary>
/// <returns>true if self-affecting threading is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B4 RID: 2484
// (get) Token: 0x06003196 RID: 12694 RVA: 0x000AA94C File Offset: 0x000A8B4C
// (set) Token: 0x06003197 RID: 12695 RVA: 0x000AA960 File Offset: 0x000A8B60
public bool SelfAffectingThreading
{
get
{
return (this._resources & HostProtectionResource.SelfAffectingThreading) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.SelfAffectingThreading;
}
else
{
this._resources &= ~HostProtectionResource.SelfAffectingThreading;
}
}
}
/// <summary>Gets or sets a value indicating whether shared state is exposed.</summary>
/// <returns>true if shared state is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B5 RID: 2485
// (get) Token: 0x06003198 RID: 12696 RVA: 0x000AA98C File Offset: 0x000A8B8C
// (set) Token: 0x06003199 RID: 12697 RVA: 0x000AA99C File Offset: 0x000A8B9C
public bool SharedState
{
get
{
return (this._resources & HostProtectionResource.SharedState) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.SharedState;
}
else
{
this._resources &= ~HostProtectionResource.SharedState;
}
}
}
/// <summary>Gets or sets a value indicating whether synchronization is exposed.</summary>
/// <returns>true if synchronization is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B6 RID: 2486
// (get) Token: 0x0600319A RID: 12698 RVA: 0x000AA9D4 File Offset: 0x000A8BD4
// (set) Token: 0x0600319B RID: 12699 RVA: 0x000AA9E4 File Offset: 0x000A8BE4
public bool Synchronization
{
get
{
return (this._resources & HostProtectionResource.Synchronization) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.Synchronization;
}
else
{
this._resources &= ~HostProtectionResource.Synchronization;
}
}
}
/// <summary>Gets or sets a value indicating whether the user interface is exposed.</summary>
/// <returns>true if the user interface is exposed; otherwise, false. The default is false.</returns>
// Token: 0x170009B7 RID: 2487
// (get) Token: 0x0600319C RID: 12700 RVA: 0x000AAA1C File Offset: 0x000A8C1C
// (set) Token: 0x0600319D RID: 12701 RVA: 0x000AAA30 File Offset: 0x000A8C30
public bool UI
{
get
{
return (this._resources & HostProtectionResource.UI) != HostProtectionResource.None;
}
set
{
if (value)
{
this._resources |= HostProtectionResource.UI;
}
else
{
this._resources &= ~HostProtectionResource.UI;
}
}
}
/// <summary>Gets or sets flags specifying categories of functionality that are potentially harmful to the host.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.HostProtectionResource" /> values. The default is <see cref="F:System.Security.Permissions.HostProtectionResource.None" />.</returns>
// Token: 0x170009B8 RID: 2488
// (get) Token: 0x0600319E RID: 12702 RVA: 0x000AAA64 File Offset: 0x000A8C64
// (set) Token: 0x0600319F RID: 12703 RVA: 0x000AAA6C File Offset: 0x000A8C6C
public HostProtectionResource Resources
{
get
{
return this._resources;
}
set
{
this._resources = value;
}
}
/// <summary>Creates and returns a new host protection permission.</summary>
/// <returns>An <see cref="T:System.Security.IPermission" /> that corresponds to the current attribute.</returns>
// Token: 0x060031A0 RID: 12704 RVA: 0x000AAA78 File Offset: 0x000A8C78
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x0400143A RID: 5178
private HostProtectionResource _resources;
}
}
@@ -0,0 +1,151 @@
using System;
namespace System.Security.Permissions
{
// Token: 0x0200054A RID: 1354
[Serializable]
internal sealed class HostProtectionPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
// Token: 0x060031A1 RID: 12705 RVA: 0x000AAA7C File Offset: 0x000A8C7C
public HostProtectionPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this._resources = HostProtectionResource.All;
}
else
{
this._resources = HostProtectionResource.None;
}
}
// Token: 0x060031A2 RID: 12706 RVA: 0x000AAAB4 File Offset: 0x000A8CB4
public HostProtectionPermission(HostProtectionResource resources)
{
this.Resources = this._resources;
}
// Token: 0x060031A3 RID: 12707 RVA: 0x000AAAC8 File Offset: 0x000A8CC8
int IBuiltInPermission.GetTokenIndex()
{
return 9;
}
// Token: 0x170009B9 RID: 2489
// (get) Token: 0x060031A4 RID: 12708 RVA: 0x000AAACC File Offset: 0x000A8CCC
// (set) Token: 0x060031A5 RID: 12709 RVA: 0x000AAAD4 File Offset: 0x000A8CD4
public HostProtectionResource Resources
{
get
{
return this._resources;
}
set
{
if (!Enum.IsDefined(typeof(HostProtectionResource), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "HostProtectionResource");
}
this._resources = value;
}
}
// Token: 0x060031A6 RID: 12710 RVA: 0x000AAB24 File Offset: 0x000A8D24
public override IPermission Copy()
{
return new HostProtectionPermission(this._resources);
}
// Token: 0x060031A7 RID: 12711 RVA: 0x000AAB34 File Offset: 0x000A8D34
public override IPermission Intersect(IPermission target)
{
HostProtectionPermission hostProtectionPermission = this.Cast(target);
if (hostProtectionPermission == null)
{
return null;
}
if (this.IsUnrestricted() && hostProtectionPermission.IsUnrestricted())
{
return new HostProtectionPermission(PermissionState.Unrestricted);
}
if (this.IsUnrestricted())
{
return hostProtectionPermission.Copy();
}
if (hostProtectionPermission.IsUnrestricted())
{
return this.Copy();
}
return new HostProtectionPermission(this._resources & hostProtectionPermission._resources);
}
// Token: 0x060031A8 RID: 12712 RVA: 0x000AABA4 File Offset: 0x000A8DA4
public override IPermission Union(IPermission target)
{
HostProtectionPermission hostProtectionPermission = this.Cast(target);
if (hostProtectionPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || hostProtectionPermission.IsUnrestricted())
{
return new HostProtectionPermission(PermissionState.Unrestricted);
}
return new HostProtectionPermission(this._resources | hostProtectionPermission._resources);
}
// Token: 0x060031A9 RID: 12713 RVA: 0x000AABF8 File Offset: 0x000A8DF8
public override bool IsSubsetOf(IPermission target)
{
HostProtectionPermission hostProtectionPermission = this.Cast(target);
if (hostProtectionPermission == null)
{
return this._resources == HostProtectionResource.None;
}
return hostProtectionPermission.IsUnrestricted() || (!this.IsUnrestricted() && (this._resources & ~hostProtectionPermission._resources) == HostProtectionResource.None);
}
// Token: 0x060031AA RID: 12714 RVA: 0x000AAC48 File Offset: 0x000A8E48
public override void FromXml(SecurityElement e)
{
CodeAccessPermission.CheckSecurityElement(e, "e", 1, 1);
this._resources = (HostProtectionResource)((int)Enum.Parse(typeof(HostProtectionResource), e.Attribute("Resources")));
}
// Token: 0x060031AB RID: 12715 RVA: 0x000AAC80 File Offset: 0x000A8E80
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
securityElement.AddAttribute("Resources", this._resources.ToString());
return securityElement;
}
// Token: 0x060031AC RID: 12716 RVA: 0x000AACB4 File Offset: 0x000A8EB4
public bool IsUnrestricted()
{
return this._resources == HostProtectionResource.All;
}
// Token: 0x060031AD RID: 12717 RVA: 0x000AACC4 File Offset: 0x000A8EC4
private HostProtectionPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
HostProtectionPermission hostProtectionPermission = target as HostProtectionPermission;
if (hostProtectionPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(HostProtectionPermission));
}
return hostProtectionPermission;
}
// Token: 0x0400143B RID: 5179
private const int version = 1;
// Token: 0x0400143C RID: 5180
private HostProtectionResource _resources;
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies categories of functionality potentially harmful to the host if invoked by a method or class.</summary>
// Token: 0x0200054B RID: 1355
[ComVisible(true)]
[Flags]
[Serializable]
public enum HostProtectionResource
{
/// <summary>Exposes no host resources.</summary>
// Token: 0x0400143E RID: 5182
None = 0,
/// <summary>Exposes synchronization.</summary>
// Token: 0x0400143F RID: 5183
Synchronization = 1,
/// <summary>Exposes state that might be shared between threads.</summary>
// Token: 0x04001440 RID: 5184
SharedState = 2,
/// <summary>Might create or destroy other processes.</summary>
// Token: 0x04001441 RID: 5185
ExternalProcessMgmt = 4,
/// <summary>Might exit the current process, terminating the server.</summary>
// Token: 0x04001442 RID: 5186
SelfAffectingProcessMgmt = 8,
/// <summary>Creates or manipulates threads other than its own, which might be harmful to the host.</summary>
// Token: 0x04001443 RID: 5187
ExternalThreading = 16,
/// <summary>Manipulates threads in a way that only affects user code.</summary>
// Token: 0x04001444 RID: 5188
SelfAffectingThreading = 32,
/// <summary>Exposes the security infrastructure.</summary>
// Token: 0x04001445 RID: 5189
SecurityInfrastructure = 64,
/// <summary>Exposes the user interface.</summary>
// Token: 0x04001446 RID: 5190
UI = 128,
/// <summary>Might cause a resource leak on termination, if not protected by a safe handle or some other means of ensuring the release of resources.</summary>
// Token: 0x04001447 RID: 5191
MayLeakOnAbort = 256,
/// <summary>Exposes all host resources.</summary>
// Token: 0x04001448 RID: 5192
All = 511
}
}
@@ -0,0 +1,11 @@
using System;
namespace System.Security.Permissions
{
// Token: 0x0200054C RID: 1356
internal interface IBuiltInPermission
{
// Token: 0x060031AE RID: 12718
int GetTokenIndex();
}
}
@@ -0,0 +1,16 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows a permission to expose an unrestricted state.</summary>
// Token: 0x0200054E RID: 1358
[ComVisible(true)]
public interface IUnrestrictedPermission
{
/// <summary>Returns a value indicating whether unrestricted access to the resource protected by the permission is allowed.</summary>
/// <returns>true if unrestricted use of the resource protected by the permission is allowed; otherwise, false.</returns>
// Token: 0x060031AF RID: 12719
bool IsUnrestricted();
}
}
@@ -0,0 +1,49 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the permitted use of isolated storage.</summary>
// Token: 0x0200054F RID: 1359
[ComVisible(true)]
[Serializable]
public enum IsolatedStorageContainment
{
/// <summary>Use of isolated storage is not allowed.</summary>
// Token: 0x0400145C RID: 5212
None,
/// <summary>Storage is isolated first by user and then by domain and assembly. Storage is also isolated by computer. Data can only be accessed within the context of the same application and only when run by the same user. This is helpful when a third-party assembly wants to keep a private data store.</summary>
// Token: 0x0400145D RID: 5213
DomainIsolationByUser = 16,
/// <summary>Storage is isolated first by user and then by code assembly. Storage is also isolated by computer. This provides a data store for the assembly that is accessible in any domain context. The per-assembly data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x0400145E RID: 5214
AssemblyIsolationByUser = 32,
/// <summary>Storage is isolated first by user and then by domain and assembly. Storage will roam if Windows user data roaming is enabled. Data can only be accessed within the context of the same application and only when run by the same user. This is helpful when a third-party assembly wants to keep a private data store.</summary>
// Token: 0x0400145F RID: 5215
DomainIsolationByRoamingUser = 80,
/// <summary>Storage is isolated first by user and then by assembly evidence. Storage will roam if Windows user data roaming is enabled. This provides a data store for the assembly that is accessible in any domain context. The per-assembly data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x04001460 RID: 5216
AssemblyIsolationByRoamingUser = 96,
/// <summary>Unlimited administration ability for the user store. Allows browsing and deletion of the entire user store, but not read access other than the user's own domain/assembly identity.</summary>
// Token: 0x04001461 RID: 5217
AdministerIsolatedStorageByUser = 112,
/// <summary>Use of isolated storage is allowed without restriction. Code has full access to any part of the user store, regardless of the identity of the domain or assembly. This use of isolated storage includes the ability to enumerate the contents of the isolated storage data store.</summary>
// Token: 0x04001462 RID: 5218
UnrestrictedIsolatedStorage = 240,
/// <summary>Storage is isolated first by user and then by application. Storage is also isolated by computer. This provides a data store for the application that is accessible in any domain context. The per-application data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x04001463 RID: 5219
ApplicationIsolationByUser = 21,
/// <summary>Storage is isolated first by computer and then by domain and assembly. Data can only be accessed within the context of the same application and only when run on the same computer. This is helpful when a third-party assembly wants to keep a private data store.</summary>
// Token: 0x04001464 RID: 5220
DomainIsolationByMachine = 48,
/// <summary>Storage is isolated first by computer and then by code assembly. This provides a data store for the assembly that is accessible in any domain context. The per-assembly data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x04001465 RID: 5221
AssemblyIsolationByMachine = 64,
/// <summary>Storage is isolated first by computer and then by application. This provides a data store for the application that is accessible in any domain context. The per-application data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x04001466 RID: 5222
ApplicationIsolationByMachine = 69,
/// <summary>Storage is isolated first by user and then by application evidence. Storage will roam if Windows user data roaming is enabled. This provides a data store for the application that is accessible in any domain context. The per-application data compartment requires additional trust because it potentially provides a "tunnel" between applications that could compromise the data isolation of applications in particular Web sites.</summary>
// Token: 0x04001467 RID: 5223
ApplicationIsolationByRoamingUser = 101
}
}
@@ -0,0 +1,133 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the allowed usage of a private virtual file system. This class cannot be inherited.</summary>
// Token: 0x02000550 RID: 1360
[ComVisible(true)]
[Serializable]
public sealed class IsolatedStorageFilePermission : IsolatedStoragePermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.IsolatedStorageFilePermission" /> class with either fully restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x060031B0 RID: 12720 RVA: 0x000AACF8 File Offset: 0x000A8EF8
public IsolatedStorageFilePermission(PermissionState state)
: base(state)
{
}
// Token: 0x060031B1 RID: 12721 RVA: 0x000AAD04 File Offset: 0x000A8F04
int IBuiltInPermission.GetTokenIndex()
{
return 3;
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x060031B2 RID: 12722 RVA: 0x000AAD08 File Offset: 0x000A8F08
public override IPermission Copy()
{
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = this.m_userQuota,
m_machineQuota = this.m_machineQuota,
m_expirationDays = this.m_expirationDays,
m_permanentData = this.m_permanentData,
m_allowed = this.m_allowed
};
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission object. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060031B3 RID: 12723 RVA: 0x000AAD5C File Offset: 0x000A8F5C
public override IPermission Intersect(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return null;
}
if (base.IsEmpty() && isolatedStorageFilePermission.IsEmpty())
{
return null;
}
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = ((this.m_userQuota >= isolatedStorageFilePermission.m_userQuota) ? isolatedStorageFilePermission.m_userQuota : this.m_userQuota),
m_machineQuota = ((this.m_machineQuota >= isolatedStorageFilePermission.m_machineQuota) ? isolatedStorageFilePermission.m_machineQuota : this.m_machineQuota),
m_expirationDays = ((this.m_expirationDays >= isolatedStorageFilePermission.m_expirationDays) ? isolatedStorageFilePermission.m_expirationDays : this.m_expirationDays),
m_permanentData = (this.m_permanentData && isolatedStorageFilePermission.m_permanentData),
UsageAllowed = ((this.m_allowed >= isolatedStorageFilePermission.m_allowed) ? isolatedStorageFilePermission.m_allowed : this.m_allowed)
};
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060031B4 RID: 12724 RVA: 0x000AAE54 File Offset: 0x000A9054
public override bool IsSubsetOf(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return base.IsEmpty();
}
return isolatedStorageFilePermission.IsUnrestricted() || (this.m_userQuota <= isolatedStorageFilePermission.m_userQuota && this.m_machineQuota <= isolatedStorageFilePermission.m_machineQuota && this.m_expirationDays <= isolatedStorageFilePermission.m_expirationDays && this.m_permanentData == isolatedStorageFilePermission.m_permanentData && this.m_allowed <= isolatedStorageFilePermission.m_allowed);
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060031B5 RID: 12725 RVA: 0x000AAEE4 File Offset: 0x000A90E4
public override IPermission Union(IPermission target)
{
IsolatedStorageFilePermission isolatedStorageFilePermission = this.Cast(target);
if (isolatedStorageFilePermission == null)
{
return this.Copy();
}
return new IsolatedStorageFilePermission(PermissionState.None)
{
m_userQuota = ((this.m_userQuota <= isolatedStorageFilePermission.m_userQuota) ? isolatedStorageFilePermission.m_userQuota : this.m_userQuota),
m_machineQuota = ((this.m_machineQuota <= isolatedStorageFilePermission.m_machineQuota) ? isolatedStorageFilePermission.m_machineQuota : this.m_machineQuota),
m_expirationDays = ((this.m_expirationDays <= isolatedStorageFilePermission.m_expirationDays) ? isolatedStorageFilePermission.m_expirationDays : this.m_expirationDays),
m_permanentData = (this.m_permanentData || isolatedStorageFilePermission.m_permanentData),
UsageAllowed = ((this.m_allowed <= isolatedStorageFilePermission.m_allowed) ? isolatedStorageFilePermission.m_allowed : this.m_allowed)
};
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x060031B6 RID: 12726 RVA: 0x000AAFC8 File Offset: 0x000A91C8
[MonoTODO("(2.0) new override - something must have been added ???")]
[ComVisible(false)]
public override SecurityElement ToXml()
{
return base.ToXml();
}
// Token: 0x060031B7 RID: 12727 RVA: 0x000AAFD0 File Offset: 0x000A91D0
private IsolatedStorageFilePermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
IsolatedStorageFilePermission isolatedStorageFilePermission = target as IsolatedStorageFilePermission;
if (isolatedStorageFilePermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(IsolatedStorageFilePermission));
}
return isolatedStorageFilePermission;
}
// Token: 0x04001468 RID: 5224
private const int version = 1;
}
}
@@ -0,0 +1,40 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.IsolatedStorageFilePermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000551 RID: 1361
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.IsolatedStorageFilePermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x060031B8 RID: 12728 RVA: 0x000AB004 File Offset: 0x000A9204
public IsolatedStorageFilePermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.IsolatedStorageFilePermission" />.</summary>
/// <returns>An <see cref="T:System.Security.Permissions.IsolatedStorageFilePermission" /> that corresponds to this attribute.</returns>
// Token: 0x060031B9 RID: 12729 RVA: 0x000AB010 File Offset: 0x000A9210
public override IPermission CreatePermission()
{
IsolatedStorageFilePermission isolatedStorageFilePermission;
if (base.Unrestricted)
{
isolatedStorageFilePermission = new IsolatedStorageFilePermission(PermissionState.Unrestricted);
}
else
{
isolatedStorageFilePermission = new IsolatedStorageFilePermission(PermissionState.None);
isolatedStorageFilePermission.UsageAllowed = base.UsageAllowed;
isolatedStorageFilePermission.UserQuota = base.UserQuota;
}
return isolatedStorageFilePermission;
}
}
}
@@ -0,0 +1,156 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Represents access to generic isolated storage capabilities.</summary>
// Token: 0x02000552 RID: 1362
[ComVisible(true)]
[Serializable]
public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.IsolatedStoragePermission" /> class with either restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x060031BA RID: 12730 RVA: 0x000AB058 File Offset: 0x000A9258
protected IsolatedStoragePermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this.UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
}
}
/// <summary>Gets or sets the quota on the overall size of each user's total store.</summary>
/// <returns>The size, in bytes, of the resource allocated to the user.</returns>
// Token: 0x170009BA RID: 2490
// (get) Token: 0x060031BB RID: 12731 RVA: 0x000AB078 File Offset: 0x000A9278
// (set) Token: 0x060031BC RID: 12732 RVA: 0x000AB080 File Offset: 0x000A9280
public long UserQuota
{
get
{
return this.m_userQuota;
}
set
{
this.m_userQuota = value;
}
}
/// <summary>Gets or sets the type of isolated storage containment allowed.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.IsolatedStorageContainment" /> values.</returns>
// Token: 0x170009BB RID: 2491
// (get) Token: 0x060031BD RID: 12733 RVA: 0x000AB08C File Offset: 0x000A928C
// (set) Token: 0x060031BE RID: 12734 RVA: 0x000AB094 File Offset: 0x000A9294
public IsolatedStorageContainment UsageAllowed
{
get
{
return this.m_allowed;
}
set
{
if (!Enum.IsDefined(typeof(IsolatedStorageContainment), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "IsolatedStorageContainment");
}
this.m_allowed = value;
if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
{
this.m_userQuota = long.MaxValue;
this.m_machineQuota = long.MaxValue;
this.m_expirationDays = long.MaxValue;
this.m_permanentData = true;
}
}
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x060031BF RID: 12735 RVA: 0x000AB128 File Offset: 0x000A9328
public bool IsUnrestricted()
{
return IsolatedStorageContainment.UnrestrictedIsolatedStorage == this.m_allowed;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x060031C0 RID: 12736 RVA: 0x000AB138 File Offset: 0x000A9338
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.m_allowed == IsolatedStorageContainment.UnrestrictedIsolatedStorage)
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
securityElement.AddAttribute("Allowed", this.m_allowed.ToString());
if (this.m_userQuota > 0L)
{
securityElement.AddAttribute("UserQuota", this.m_userQuota.ToString());
}
}
return securityElement;
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x060031C1 RID: 12737 RVA: 0x000AB1B4 File Offset: 0x000A93B4
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
this.m_userQuota = 0L;
this.m_machineQuota = 0L;
this.m_expirationDays = 0L;
this.m_permanentData = false;
this.m_allowed = IsolatedStorageContainment.None;
if (CodeAccessPermission.IsUnrestricted(esd))
{
this.UsageAllowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
}
else
{
string text = esd.Attribute("Allowed");
if (text != null)
{
this.UsageAllowed = (IsolatedStorageContainment)((int)Enum.Parse(typeof(IsolatedStorageContainment), text));
}
text = esd.Attribute("UserQuota");
if (text != null)
{
Exception ex;
long.Parse(text, true, out this.m_userQuota, out ex);
}
}
}
// Token: 0x060031C2 RID: 12738 RVA: 0x000AB260 File Offset: 0x000A9460
internal bool IsEmpty()
{
return this.m_userQuota == 0L && this.m_allowed == IsolatedStorageContainment.None;
}
// Token: 0x04001469 RID: 5225
private const int version = 1;
// Token: 0x0400146A RID: 5226
internal long m_userQuota;
// Token: 0x0400146B RID: 5227
internal long m_machineQuota;
// Token: 0x0400146C RID: 5228
internal long m_expirationDays;
// Token: 0x0400146D RID: 5229
internal bool m_permanentData;
// Token: 0x0400146E RID: 5230
internal IsolatedStorageContainment m_allowed;
}
}
@@ -0,0 +1,61 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.IsolatedStoragePermission" /> to be applied to code using declarative security.</summary>
// Token: 0x02000553 RID: 1363
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public abstract class IsolatedStoragePermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.IsolatedStoragePermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x060031C3 RID: 12739 RVA: 0x000AB27C File Offset: 0x000A947C
protected IsolatedStoragePermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the level of isolated storage that should be declared.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.IsolatedStorageContainment" /> values.</returns>
// Token: 0x170009BC RID: 2492
// (get) Token: 0x060031C4 RID: 12740 RVA: 0x000AB288 File Offset: 0x000A9488
// (set) Token: 0x060031C5 RID: 12741 RVA: 0x000AB290 File Offset: 0x000A9490
public IsolatedStorageContainment UsageAllowed
{
get
{
return this.usage_allowed;
}
set
{
this.usage_allowed = value;
}
}
/// <summary>Gets or sets the maximum user storage quota size.</summary>
/// <returns>The maximum user storage quota size in bytes.</returns>
// Token: 0x170009BD RID: 2493
// (get) Token: 0x060031C6 RID: 12742 RVA: 0x000AB29C File Offset: 0x000A949C
// (set) Token: 0x060031C7 RID: 12743 RVA: 0x000AB2A4 File Offset: 0x000A94A4
public long UserQuota
{
get
{
return this.user_quota;
}
set
{
this.user_quota = value;
}
}
// Token: 0x0400146F RID: 5231
private IsolatedStorageContainment usage_allowed;
// Token: 0x04001470 RID: 5232
private long user_quota;
}
}
@@ -0,0 +1,235 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Controls the ability to access key containers. This class cannot be inherited.</summary>
// Token: 0x02000554 RID: 1364
[ComVisible(true)]
[Serializable]
public sealed class KeyContainerPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermission" /> class with either restricted or unrestricted permission.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="state" /> is not a valid <see cref="T:System.Security.Permissions.PermissionState" /> value. </exception>
// Token: 0x060031C8 RID: 12744 RVA: 0x000AB2B0 File Offset: 0x000A94B0
public KeyContainerPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this._flags = KeyContainerPermissionFlags.AllFlags;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermission" /> class with the specified access.</summary>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="flags" /> is not a valid combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </exception>
// Token: 0x060031C9 RID: 12745 RVA: 0x000AB2D0 File Offset: 0x000A94D0
public KeyContainerPermission(KeyContainerPermissionFlags flags)
{
this.SetFlags(flags);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermission" /> class with the specified global access and specific key container access rights.</summary>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <param name="accessList">An array of <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects identifying specific key container access rights. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="flags" /> is not a valid combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="accessList" /> is null. </exception>
// Token: 0x060031CA RID: 12746 RVA: 0x000AB2E0 File Offset: 0x000A94E0
public KeyContainerPermission(KeyContainerPermissionFlags flags, KeyContainerPermissionAccessEntry[] accessList)
{
this.SetFlags(flags);
if (accessList != null)
{
foreach (KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry in accessList)
{
this._accessEntries.Add(keyContainerPermissionAccessEntry);
}
}
}
// Token: 0x060031CB RID: 12747 RVA: 0x000AB328 File Offset: 0x000A9528
int IBuiltInPermission.GetTokenIndex()
{
return 16;
}
/// <summary>Gets the collection of <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects associated with the current permission.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryCollection" /> containing the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects for this <see cref="T:System.Security.Permissions.KeyContainerPermission" />.</returns>
// Token: 0x170009BE RID: 2494
// (get) Token: 0x060031CC RID: 12748 RVA: 0x000AB32C File Offset: 0x000A952C
public KeyContainerPermissionAccessEntryCollection AccessEntries
{
get
{
return this._accessEntries;
}
}
/// <summary>Gets the key container permission flags that apply to all key containers associated with the permission.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values.</returns>
// Token: 0x170009BF RID: 2495
// (get) Token: 0x060031CD RID: 12749 RVA: 0x000AB334 File Offset: 0x000A9534
public KeyContainerPermissionFlags Flags
{
get
{
return this._flags;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x060031CE RID: 12750 RVA: 0x000AB33C File Offset: 0x000A953C
public override IPermission Copy()
{
if (this._accessEntries.Count == 0)
{
return new KeyContainerPermission(this._flags);
}
KeyContainerPermissionAccessEntry[] array = new KeyContainerPermissionAccessEntry[this._accessEntries.Count];
this._accessEntries.CopyTo(array, 0);
return new KeyContainerPermission(this._flags, array);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="securityElement">A <see cref="T:System.Security.SecurityElement" /> that contains the XML encoding used to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="securityElement" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="securityElement" /> is not a valid permission element.-or- The version number of <paramref name="securityElement" /> is not supported. </exception>
// Token: 0x060031CF RID: 12751 RVA: 0x000AB390 File Offset: 0x000A9590
[MonoTODO("(2.0) missing support for AccessEntries")]
public override void FromXml(SecurityElement securityElement)
{
CodeAccessPermission.CheckSecurityElement(securityElement, "securityElement", 1, 1);
if (CodeAccessPermission.IsUnrestricted(securityElement))
{
this._flags = KeyContainerPermissionFlags.AllFlags;
}
else
{
this._flags = (KeyContainerPermissionFlags)((int)Enum.Parse(typeof(KeyContainerPermissionFlags), securityElement.Attribute("Flags")));
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and does not specify a permission of the same type as the current permission. </exception>
// Token: 0x060031D0 RID: 12752 RVA: 0x000AB3EC File Offset: 0x000A95EC
[MonoTODO("(2.0)")]
public override IPermission Intersect(IPermission target)
{
return null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission to test for the subset relationship. This permission must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and does not specify a permission of the same type as the current permission. </exception>
// Token: 0x060031D1 RID: 12753 RVA: 0x000AB3F0 File Offset: 0x000A95F0
[MonoTODO("(2.0)")]
public override bool IsSubsetOf(IPermission target)
{
return false;
}
/// <summary>Determines whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x060031D2 RID: 12754 RVA: 0x000AB3F4 File Offset: 0x000A95F4
public bool IsUnrestricted()
{
return this._flags == KeyContainerPermissionFlags.AllFlags;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>A <see cref="T:System.Security.SecurityElement" /> that contains an XML encoding of the permission, including state information.</returns>
// Token: 0x060031D3 RID: 12755 RVA: 0x000AB404 File Offset: 0x000A9604
[MonoTODO("(2.0) missing support for AccessEntries")]
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.IsUnrestricted())
{
securityElement.AddAttribute("Unrestricted", "true");
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="target" /> is not null and does not specify a permission of the same type as the current permission. </exception>
// Token: 0x060031D4 RID: 12756 RVA: 0x000AB43C File Offset: 0x000A963C
public override IPermission Union(IPermission target)
{
KeyContainerPermission keyContainerPermission = this.Cast(target);
if (keyContainerPermission == null)
{
return this.Copy();
}
KeyContainerPermissionAccessEntryCollection keyContainerPermissionAccessEntryCollection = new KeyContainerPermissionAccessEntryCollection();
foreach (KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry in this._accessEntries)
{
keyContainerPermissionAccessEntryCollection.Add(keyContainerPermissionAccessEntry);
}
foreach (KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry2 in keyContainerPermission._accessEntries)
{
if (this._accessEntries.IndexOf(keyContainerPermissionAccessEntry2) == -1)
{
keyContainerPermissionAccessEntryCollection.Add(keyContainerPermissionAccessEntry2);
}
}
if (keyContainerPermissionAccessEntryCollection.Count == 0)
{
return new KeyContainerPermission(this._flags | keyContainerPermission._flags);
}
KeyContainerPermissionAccessEntry[] array = new KeyContainerPermissionAccessEntry[keyContainerPermissionAccessEntryCollection.Count];
keyContainerPermissionAccessEntryCollection.CopyTo(array, 0);
return new KeyContainerPermission(this._flags | keyContainerPermission._flags, array);
}
// Token: 0x060031D5 RID: 12757 RVA: 0x000AB51C File Offset: 0x000A971C
private void SetFlags(KeyContainerPermissionFlags flags)
{
if ((flags & KeyContainerPermissionFlags.AllFlags) != KeyContainerPermissionFlags.NoFlags)
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), flags);
throw new ArgumentException(text, "KeyContainerPermissionFlags");
}
this._flags = flags;
}
// Token: 0x060031D6 RID: 12758 RVA: 0x000AB560 File Offset: 0x000A9760
private KeyContainerPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
KeyContainerPermission keyContainerPermission = target as KeyContainerPermission;
if (keyContainerPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(KeyContainerPermission));
}
return keyContainerPermission;
}
// Token: 0x04001471 RID: 5233
private const int version = 1;
// Token: 0x04001472 RID: 5234
private KeyContainerPermissionAccessEntryCollection _accessEntries;
// Token: 0x04001473 RID: 5235
private KeyContainerPermissionFlags _flags;
}
}
@@ -0,0 +1,226 @@
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
namespace System.Security.Permissions
{
/// <summary>Specifies access rights for specific key containers. This class cannot be inherited.</summary>
// Token: 0x02000555 RID: 1365
[ComVisible(true)]
[Serializable]
public sealed class KeyContainerPermissionAccessEntry
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class, using the specified cryptographic service provider (CSP) parameters and access permissions.</summary>
/// <param name="parameters">A <see cref="T:System.Security.Cryptography.CspParameters" /> object that contains the cryptographic service provider (CSP) parameters. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D7 RID: 12759 RVA: 0x000AB594 File Offset: 0x000A9794
public KeyContainerPermissionAccessEntry(CspParameters parameters, KeyContainerPermissionFlags flags)
{
if (parameters == null)
{
throw new ArgumentNullException("parameters");
}
this.ProviderName = parameters.ProviderName;
this.ProviderType = parameters.ProviderType;
this.KeyContainerName = parameters.KeyContainerName;
this.KeySpec = parameters.KeyNumber;
this.Flags = flags;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class, using the specified key container name and access permissions.</summary>
/// <param name="keyContainerName">The name of the key container. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D8 RID: 12760 RVA: 0x000AB5F0 File Offset: 0x000A97F0
public KeyContainerPermissionAccessEntry(string keyContainerName, KeyContainerPermissionFlags flags)
{
this.KeyContainerName = keyContainerName;
this.Flags = flags;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> class with the specified property values.</summary>
/// <param name="keyStore">The name of the key store. </param>
/// <param name="providerName">The name of the provider. </param>
/// <param name="providerType">The type code for the provider. See the <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntry.ProviderType" /> property for values. </param>
/// <param name="keyContainerName">The name of the key container. </param>
/// <param name="keySpec">The key specification. See the <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntry.KeySpec" /> property for values. </param>
/// <param name="flags">A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. </param>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x060031D9 RID: 12761 RVA: 0x000AB608 File Offset: 0x000A9808
public KeyContainerPermissionAccessEntry(string keyStore, string providerName, int providerType, string keyContainerName, int keySpec, KeyContainerPermissionFlags flags)
{
this.KeyStore = keyStore;
this.ProviderName = providerName;
this.ProviderType = providerType;
this.KeyContainerName = keyContainerName;
this.KeySpec = keySpec;
this.Flags = flags;
}
/// <summary>Gets or sets the key container permissions.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. The default is <see cref="F:System.Security.Permissions.KeyContainerPermissionFlags.NoFlags" />.</returns>
// Token: 0x170009C0 RID: 2496
// (get) Token: 0x060031DA RID: 12762 RVA: 0x000AB648 File Offset: 0x000A9848
// (set) Token: 0x060031DB RID: 12763 RVA: 0x000AB650 File Offset: 0x000A9850
public KeyContainerPermissionFlags Flags
{
get
{
return this._flags;
}
set
{
if ((value & KeyContainerPermissionFlags.AllFlags) != KeyContainerPermissionFlags.NoFlags)
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "KeyContainerPermissionFlags");
}
this._flags = value;
}
}
/// <summary>Gets or sets the key container name.</summary>
/// <returns>The name of the key container.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C1 RID: 2497
// (get) Token: 0x060031DC RID: 12764 RVA: 0x000AB694 File Offset: 0x000A9894
// (set) Token: 0x060031DD RID: 12765 RVA: 0x000AB69C File Offset: 0x000A989C
public string KeyContainerName
{
get
{
return this._containerName;
}
set
{
this._containerName = value;
}
}
/// <summary>Gets or sets the key specification.</summary>
/// <returns>One of the AT_ values defined in the Wincrypt.h header file.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C2 RID: 2498
// (get) Token: 0x060031DE RID: 12766 RVA: 0x000AB6A8 File Offset: 0x000A98A8
// (set) Token: 0x060031DF RID: 12767 RVA: 0x000AB6B0 File Offset: 0x000A98B0
public int KeySpec
{
get
{
return this._spec;
}
set
{
this._spec = value;
}
}
/// <summary>Gets or sets the name of the key store.</summary>
/// <returns>The name of the key store.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C3 RID: 2499
// (get) Token: 0x060031E0 RID: 12768 RVA: 0x000AB6BC File Offset: 0x000A98BC
// (set) Token: 0x060031E1 RID: 12769 RVA: 0x000AB6C4 File Offset: 0x000A98C4
public string KeyStore
{
get
{
return this._store;
}
set
{
this._store = value;
}
}
/// <summary>Gets or sets the provider name.</summary>
/// <returns>The name of the provider.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C4 RID: 2500
// (get) Token: 0x060031E2 RID: 12770 RVA: 0x000AB6D0 File Offset: 0x000A98D0
// (set) Token: 0x060031E3 RID: 12771 RVA: 0x000AB6D8 File Offset: 0x000A98D8
public string ProviderName
{
get
{
return this._providerName;
}
set
{
this._providerName = value;
}
}
/// <summary>Gets or sets the provider type.</summary>
/// <returns>One of the PROV_ values defined in the Wincrypt.h header file.</returns>
/// <exception cref="T:System.ArgumentException">The resulting entry would have unrestricted access. </exception>
// Token: 0x170009C5 RID: 2501
// (get) Token: 0x060031E4 RID: 12772 RVA: 0x000AB6E4 File Offset: 0x000A98E4
// (set) Token: 0x060031E5 RID: 12773 RVA: 0x000AB6EC File Offset: 0x000A98EC
public int ProviderType
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
/// <summary>Determines whether the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object is equal to the current instance.</summary>
/// <returns>true if the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> is equal to the current <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object; otherwise, false.</returns>
/// <param name="o">The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to compare with the currentinstance. </param>
// Token: 0x060031E6 RID: 12774 RVA: 0x000AB6F8 File Offset: 0x000A98F8
public override bool Equals(object o)
{
if (o == null)
{
return false;
}
KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry = o as KeyContainerPermissionAccessEntry;
return keyContainerPermissionAccessEntry != null && this._flags == keyContainerPermissionAccessEntry._flags && !(this._containerName != keyContainerPermissionAccessEntry._containerName) && !(this._store != keyContainerPermissionAccessEntry._store) && !(this._providerName != keyContainerPermissionAccessEntry._providerName) && this._type == keyContainerPermissionAccessEntry._type;
}
/// <summary>Gets a hash code for the current instance that is suitable for use in hashing algorithms and data structures such as a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object.</returns>
// Token: 0x060031E7 RID: 12775 RVA: 0x000AB78C File Offset: 0x000A998C
public override int GetHashCode()
{
int num = this._type ^ this._spec ^ (int)this._flags;
if (this._containerName != null)
{
num ^= this._containerName.GetHashCode();
}
if (this._store != null)
{
num ^= this._store.GetHashCode();
}
if (this._providerName != null)
{
num ^= this._providerName.GetHashCode();
}
return num;
}
// Token: 0x04001474 RID: 5236
private KeyContainerPermissionFlags _flags;
// Token: 0x04001475 RID: 5237
private string _containerName;
// Token: 0x04001476 RID: 5238
private int _spec;
// Token: 0x04001477 RID: 5239
private string _store;
// Token: 0x04001478 RID: 5240
private string _providerName;
// Token: 0x04001479 RID: 5241
private int _type;
}
}
@@ -0,0 +1,190 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Represents a collection of <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects. This class cannot be inherited.</summary>
// Token: 0x02000556 RID: 1366
[ComVisible(true)]
[Serializable]
public sealed class KeyContainerPermissionAccessEntryCollection : IEnumerable, ICollection
{
// Token: 0x060031E8 RID: 12776 RVA: 0x000AB7FC File Offset: 0x000A99FC
internal KeyContainerPermissionAccessEntryCollection()
{
this._list = new ArrayList();
}
// Token: 0x060031E9 RID: 12777 RVA: 0x000AB810 File Offset: 0x000A9A10
internal KeyContainerPermissionAccessEntryCollection(KeyContainerPermissionAccessEntry[] entries)
{
if (entries != null)
{
foreach (KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry in entries)
{
this.Add(keyContainerPermissionAccessEntry);
}
}
}
/// <summary>Copies the elements of the collection to a compatible one-dimensional array, starting at the specified index of the target array.</summary>
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the current collection.</param>
/// <param name="index">The index in <paramref name="array" /> at which copying begins. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than the lower bound of <paramref name="array" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or- The number of elements in the collection is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />. </exception>
// Token: 0x060031EA RID: 12778 RVA: 0x000AB84C File Offset: 0x000A9A4C
void ICollection.CopyTo(Array array, int index)
{
this._list.CopyTo(array, index);
}
/// <summary>Returns a <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator" /> object that can be used to iterate through the objects in the collection.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator" /> object that can be used to iterate through the collection.</returns>
// Token: 0x060031EB RID: 12779 RVA: 0x000AB85C File Offset: 0x000A9A5C
IEnumerator IEnumerable.GetEnumerator()
{
return new KeyContainerPermissionAccessEntryEnumerator(this._list);
}
/// <summary>Gets the number of items in the collection.</summary>
/// <returns>The number of <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects in the collection.</returns>
// Token: 0x170009C6 RID: 2502
// (get) Token: 0x060031EC RID: 12780 RVA: 0x000AB86C File Offset: 0x000A9A6C
public int Count
{
get
{
return this._list.Count;
}
}
/// <summary>Gets a value indicating whether the collection is synchronized (thread safe).</summary>
/// <returns>false in all cases.</returns>
// Token: 0x170009C7 RID: 2503
// (get) Token: 0x060031ED RID: 12781 RVA: 0x000AB87C File Offset: 0x000A9A7C
public bool IsSynchronized
{
get
{
return false;
}
}
/// <summary>Gets the item at the specified index in the collection.</summary>
/// <returns>The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object at the specified index in the collection.</returns>
/// <param name="index">The zero-based index of the element to access.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is greater than or equal to the collection count. </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="index" /> is negative. </exception>
// Token: 0x170009C8 RID: 2504
public KeyContainerPermissionAccessEntry this[int index]
{
get
{
return (KeyContainerPermissionAccessEntry)this._list[index];
}
}
/// <summary>Gets an object that can be used to synchronize access to the collection.</summary>
/// <returns>An object that can be used to synchronize access to the collection. </returns>
// Token: 0x170009C9 RID: 2505
// (get) Token: 0x060031EF RID: 12783 RVA: 0x000AB894 File Offset: 0x000A9A94
public object SyncRoot
{
get
{
return this;
}
}
/// <summary>Adds a <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to the collection.</summary>
/// <returns>The index at which the new element was inserted.</returns>
/// <param name="accessEntry">The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to add.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="accessEntry" /> is null.</exception>
// Token: 0x060031F0 RID: 12784 RVA: 0x000AB898 File Offset: 0x000A9A98
public int Add(KeyContainerPermissionAccessEntry accessEntry)
{
return this._list.Add(accessEntry);
}
/// <summary>Removes all the <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects from the collection.</summary>
// Token: 0x060031F1 RID: 12785 RVA: 0x000AB8A8 File Offset: 0x000A9AA8
public void Clear()
{
this._list.Clear();
}
/// <summary>Copies the elements of the collection to a compatible one-dimensional array, starting at the specified index of the target array.</summary>
/// <param name="array">The one-dimensional <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> array that is the destination of the elements copied from the current collection. </param>
/// <param name="index">The index in <paramref name="array" /> at which copying begins. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="array" /> is null. </exception>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index" /> is less than the lower bound of <paramref name="array" />. </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="array" /> is multidimensional.-or- The number of elements in the collection is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />. </exception>
// Token: 0x060031F2 RID: 12786 RVA: 0x000AB8B8 File Offset: 0x000A9AB8
public void CopyTo(KeyContainerPermissionAccessEntry[] array, int index)
{
this._list.CopyTo(array, index);
}
/// <summary>Returns a <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator" /> object that can be used to iterate through the objects in the collection.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator" /> object that can be used to iterate through the collection.</returns>
// Token: 0x060031F3 RID: 12787 RVA: 0x000AB8C8 File Offset: 0x000A9AC8
public KeyContainerPermissionAccessEntryEnumerator GetEnumerator()
{
return new KeyContainerPermissionAccessEntryEnumerator(this._list);
}
/// <summary>Gets the index in the collection of the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object, if it exists in the collection.</summary>
/// <returns>The index of the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object in the collection, or 1 if no match is found.</returns>
/// <param name="accessEntry">The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to locate.</param>
// Token: 0x060031F4 RID: 12788 RVA: 0x000AB8D8 File Offset: 0x000A9AD8
public int IndexOf(KeyContainerPermissionAccessEntry accessEntry)
{
if (accessEntry == null)
{
throw new ArgumentNullException("accessEntry");
}
for (int i = 0; i < this._list.Count; i++)
{
if (accessEntry.Equals(this._list[i]))
{
return i;
}
}
return -1;
}
/// <summary>Removes the specified <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object from thecollection.</summary>
/// <param name="accessEntry">The <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object to remove.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="accessEntry" /> is null.</exception>
// Token: 0x060031F5 RID: 12789 RVA: 0x000AB92C File Offset: 0x000A9B2C
public void Remove(KeyContainerPermissionAccessEntry accessEntry)
{
if (accessEntry == null)
{
throw new ArgumentNullException("accessEntry");
}
for (int i = 0; i < this._list.Count; i++)
{
if (accessEntry.Equals(this._list[i]))
{
this._list.RemoveAt(i);
}
}
}
// Token: 0x0400147A RID: 5242
private ArrayList _list;
}
}
@@ -0,0 +1,62 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Represents the enumerator for <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> objects in a <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntryCollection" />.</summary>
// Token: 0x02000557 RID: 1367
[ComVisible(true)]
[Serializable]
public sealed class KeyContainerPermissionAccessEntryEnumerator : IEnumerator
{
// Token: 0x060031F6 RID: 12790 RVA: 0x000AB98C File Offset: 0x000A9B8C
internal KeyContainerPermissionAccessEntryEnumerator(ArrayList list)
{
this.e = list.GetEnumerator();
}
/// <summary>Gets the current object in the collection.</summary>
/// <returns>The current object in the collection.</returns>
// Token: 0x170009CA RID: 2506
// (get) Token: 0x060031F7 RID: 12791 RVA: 0x000AB9A0 File Offset: 0x000A9BA0
object IEnumerator.Current
{
get
{
return this.e.Current;
}
}
/// <summary>Gets the current entry in the collection.</summary>
/// <returns>The current <see cref="T:System.Security.Permissions.KeyContainerPermissionAccessEntry" /> object in the collection.</returns>
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator.Current" /> property is accessed before first calling the <see cref="M:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator.MoveNext" /> method. The cursor is located before the first object in the collection.-or- The <see cref="P:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator.Current" /> property is accessed after a call to the <see cref="M:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator.MoveNext" /> method returns false, which indicates that the cursor is located after the last object in the collection. </exception>
// Token: 0x170009CB RID: 2507
// (get) Token: 0x060031F8 RID: 12792 RVA: 0x000AB9B0 File Offset: 0x000A9BB0
public KeyContainerPermissionAccessEntry Current
{
get
{
return (KeyContainerPermissionAccessEntry)this.e.Current;
}
}
/// <summary>Moves to the next element in the collection.</summary>
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
// Token: 0x060031F9 RID: 12793 RVA: 0x000AB9C4 File Offset: 0x000A9BC4
public bool MoveNext()
{
return this.e.MoveNext();
}
/// <summary>Resets the enumerator to the beginning of the collection.</summary>
// Token: 0x060031FA RID: 12794 RVA: 0x000AB9D4 File Offset: 0x000A9BD4
public void Reset()
{
this.e.Reset();
}
// Token: 0x0400147B RID: 5243
private IEnumerator e;
}
}
@@ -0,0 +1,169 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.KeyContainerPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000558 RID: 1368
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class KeyContainerPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.KeyContainerPermissionAttribute" /> class with the specified security action.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x060031FB RID: 12795 RVA: 0x000AB9E4 File Offset: 0x000A9BE4
public KeyContainerPermissionAttribute(SecurityAction action)
: base(action)
{
this._spec = -1;
this._type = -1;
}
/// <summary>Gets or sets the key container permissions.</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Security.Permissions.KeyContainerPermissionFlags" /> values. The default is <see cref="F:System.Security.Permissions.KeyContainerPermissionFlags.NoFlags" />.</returns>
// Token: 0x170009CC RID: 2508
// (get) Token: 0x060031FC RID: 12796 RVA: 0x000AB9FC File Offset: 0x000A9BFC
// (set) Token: 0x060031FD RID: 12797 RVA: 0x000ABA04 File Offset: 0x000A9C04
public KeyContainerPermissionFlags Flags
{
get
{
return this._flags;
}
set
{
this._flags = value;
}
}
/// <summary>Gets or sets the name of the key container.</summary>
/// <returns>The name of the key container.</returns>
// Token: 0x170009CD RID: 2509
// (get) Token: 0x060031FE RID: 12798 RVA: 0x000ABA10 File Offset: 0x000A9C10
// (set) Token: 0x060031FF RID: 12799 RVA: 0x000ABA18 File Offset: 0x000A9C18
public string KeyContainerName
{
get
{
return this._containerName;
}
set
{
this._containerName = value;
}
}
/// <summary>Gets or sets the key specification.</summary>
/// <returns>One of the AT_ values defined in the Wincrypt.h header file. </returns>
// Token: 0x170009CE RID: 2510
// (get) Token: 0x06003200 RID: 12800 RVA: 0x000ABA24 File Offset: 0x000A9C24
// (set) Token: 0x06003201 RID: 12801 RVA: 0x000ABA2C File Offset: 0x000A9C2C
public int KeySpec
{
get
{
return this._spec;
}
set
{
this._spec = value;
}
}
/// <summary>Gets or sets the name of the key store.</summary>
/// <returns>The name of the key store. The default is "*".</returns>
// Token: 0x170009CF RID: 2511
// (get) Token: 0x06003202 RID: 12802 RVA: 0x000ABA38 File Offset: 0x000A9C38
// (set) Token: 0x06003203 RID: 12803 RVA: 0x000ABA40 File Offset: 0x000A9C40
public string KeyStore
{
get
{
return this._store;
}
set
{
this._store = value;
}
}
/// <summary>Gets or sets the provider name.</summary>
/// <returns>The name of the provider.</returns>
// Token: 0x170009D0 RID: 2512
// (get) Token: 0x06003204 RID: 12804 RVA: 0x000ABA4C File Offset: 0x000A9C4C
// (set) Token: 0x06003205 RID: 12805 RVA: 0x000ABA54 File Offset: 0x000A9C54
public string ProviderName
{
get
{
return this._providerName;
}
set
{
this._providerName = value;
}
}
/// <summary>Gets or sets the provider type.</summary>
/// <returns>One of the PROV_ values defined in the Wincrypt.h header file. </returns>
// Token: 0x170009D1 RID: 2513
// (get) Token: 0x06003206 RID: 12806 RVA: 0x000ABA60 File Offset: 0x000A9C60
// (set) Token: 0x06003207 RID: 12807 RVA: 0x000ABA68 File Offset: 0x000A9C68
public int ProviderType
{
get
{
return this._type;
}
set
{
this._type = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.KeyContainerPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.KeyContainerPermission" /> that corresponds to the attribute.</returns>
// Token: 0x06003208 RID: 12808 RVA: 0x000ABA74 File Offset: 0x000A9C74
public override IPermission CreatePermission()
{
if (base.Unrestricted)
{
return new KeyContainerPermission(PermissionState.Unrestricted);
}
if (this.EmptyEntry())
{
return new KeyContainerPermission(this._flags);
}
KeyContainerPermissionAccessEntry[] array = new KeyContainerPermissionAccessEntry[]
{
new KeyContainerPermissionAccessEntry(this._store, this._providerName, this._type, this._containerName, this._spec, this._flags)
};
return new KeyContainerPermission(this._flags, array);
}
// Token: 0x06003209 RID: 12809 RVA: 0x000ABAEC File Offset: 0x000A9CEC
private bool EmptyEntry()
{
return this._containerName == null && this._spec == 0 && this._store == null && this._providerName == null && this._type == 0;
}
// Token: 0x0400147C RID: 5244
private KeyContainerPermissionFlags _flags;
// Token: 0x0400147D RID: 5245
private string _containerName;
// Token: 0x0400147E RID: 5246
private int _spec;
// Token: 0x0400147F RID: 5247
private string _store;
// Token: 0x04001480 RID: 5248
private string _providerName;
// Token: 0x04001481 RID: 5249
private int _type;
}
}
@@ -0,0 +1,47 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the type of key container access allowed.</summary>
// Token: 0x02000559 RID: 1369
[Flags]
[ComVisible(true)]
[Serializable]
public enum KeyContainerPermissionFlags
{
/// <summary>No access to a key container.</summary>
// Token: 0x04001483 RID: 5251
NoFlags = 0,
/// <summary>Create a key container.</summary>
// Token: 0x04001484 RID: 5252
Create = 1,
/// <summary>Open a key container and use the public key.</summary>
// Token: 0x04001485 RID: 5253
Open = 2,
/// <summary>Delete a key container.</summary>
// Token: 0x04001486 RID: 5254
Delete = 4,
/// <summary>Import a key into a key container.</summary>
// Token: 0x04001487 RID: 5255
Import = 16,
/// <summary>Export a key from a key container.</summary>
// Token: 0x04001488 RID: 5256
Export = 32,
/// <summary>Sign a file using a key.</summary>
// Token: 0x04001489 RID: 5257
Sign = 256,
/// <summary>Decrypt a key container.</summary>
// Token: 0x0400148A RID: 5258
Decrypt = 512,
/// <summary>View the access control list (ACL) for a key container.</summary>
// Token: 0x0400148B RID: 5259
ViewAcl = 4096,
/// <summary>Change the access control list (ACL) for a key container. </summary>
// Token: 0x0400148C RID: 5260
ChangeAcl = 8192,
/// <summary>Create, decrypt, delete, and open a key container; export and import a key; sign files using a key; and view and change the access control list for a key container.</summary>
// Token: 0x0400148D RID: 5261
AllFlags = 13111
}
}
@@ -0,0 +1,146 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for a <see cref="T:System.Security.PermissionSet" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x0200055A RID: 1370
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class PermissionSetAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PermissionSetAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600320A RID: 12810 RVA: 0x000ABB3C File Offset: 0x000A9D3C
public PermissionSetAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets a file containing the XML representation of a custom permission set to be declared.</summary>
/// <returns>The physical path to the file containing the XML representation of the permission set.</returns>
// Token: 0x170009D2 RID: 2514
// (get) Token: 0x0600320B RID: 12811 RVA: 0x000ABB48 File Offset: 0x000A9D48
// (set) Token: 0x0600320C RID: 12812 RVA: 0x000ABB50 File Offset: 0x000A9D50
public string File
{
get
{
return this.file;
}
set
{
this.file = value;
}
}
/// <summary>Gets or sets the hexadecimal representation of the XML encoded permission set.</summary>
/// <returns>The hexadecimal representation of the XML encoded permission set.</returns>
// Token: 0x170009D3 RID: 2515
// (get) Token: 0x0600320D RID: 12813 RVA: 0x000ABB5C File Offset: 0x000A9D5C
// (set) Token: 0x0600320E RID: 12814 RVA: 0x000ABB64 File Offset: 0x000A9D64
public string Hex
{
get
{
return this.hex;
}
set
{
this.hex = value;
}
}
/// <summary>Gets or sets the name of the permission set.</summary>
/// <returns>The name of an immutable <see cref="T:System.Security.NamedPermissionSet" /> (one of several permission sets that are contained in the default policy and cannot be altered).</returns>
// Token: 0x170009D4 RID: 2516
// (get) Token: 0x0600320F RID: 12815 RVA: 0x000ABB70 File Offset: 0x000A9D70
// (set) Token: 0x06003210 RID: 12816 RVA: 0x000ABB78 File Offset: 0x000A9D78
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>Gets or sets a value indicating whether the file specified by <see cref="P:System.Security.Permissions.PermissionSetAttribute.File" /> is Unicode or ASCII encoded.</summary>
/// <returns>true if the file is Unicode encoded; otherwise, false.</returns>
// Token: 0x170009D5 RID: 2517
// (get) Token: 0x06003211 RID: 12817 RVA: 0x000ABB84 File Offset: 0x000A9D84
// (set) Token: 0x06003212 RID: 12818 RVA: 0x000ABB8C File Offset: 0x000A9D8C
public bool UnicodeEncoded
{
get
{
return this.isUnicodeEncoded;
}
set
{
this.isUnicodeEncoded = value;
}
}
/// <summary>Gets or sets the XML representation of a permission set.</summary>
/// <returns>The XML representation of a permission set.</returns>
// Token: 0x170009D6 RID: 2518
// (get) Token: 0x06003213 RID: 12819 RVA: 0x000ABB98 File Offset: 0x000A9D98
// (set) Token: 0x06003214 RID: 12820 RVA: 0x000ABBA0 File Offset: 0x000A9DA0
public string XML
{
get
{
return this.xml;
}
set
{
this.xml = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.IPermission" />.</summary>
/// <returns>A new <see cref="T:System.Security.IPermission" />.</returns>
// Token: 0x06003215 RID: 12821 RVA: 0x000ABBAC File Offset: 0x000A9DAC
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x06003216 RID: 12822 RVA: 0x000ABBB0 File Offset: 0x000A9DB0
private PermissionSet CreateFromXml(string xml)
{
return null;
}
/// <summary>Creates and returns a new <see cref="T:System.Security.PermissionSet" />.</summary>
/// <returns>A new <see cref="T:System.Security.PermissionSet" />.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06003217 RID: 12823 RVA: 0x000ABBB4 File Offset: 0x000A9DB4
public PermissionSet CreatePermissionSet()
{
return null;
}
// Token: 0x0400148E RID: 5262
private string file;
// Token: 0x0400148F RID: 5263
private string name;
// Token: 0x04001490 RID: 5264
private bool isUnicodeEncoded;
// Token: 0x04001491 RID: 5265
private string xml;
// Token: 0x04001492 RID: 5266
private string hex;
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies whether a permission should have all or no access to resources at creation.</summary>
// Token: 0x0200055B RID: 1371
[ComVisible(true)]
[Serializable]
public enum PermissionState
{
/// <summary>Full access to the resource protected by the permission.</summary>
// Token: 0x04001494 RID: 5268
Unrestricted = 1,
/// <summary>No access to the resource protected by the permission.</summary>
// Token: 0x04001495 RID: 5269
None = 0
}
}
@@ -0,0 +1,478 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading;
namespace System.Security.Permissions
{
/// <summary>Allows checks against the active principal (see <see cref="T:System.Security.Principal.IPrincipal" />) using the language constructs defined for both declarative and imperative security actions. This class cannot be inherited.</summary>
// Token: 0x0200055C RID: 1372
[ComVisible(true)]
[Serializable]
public sealed class PrincipalPermission : IBuiltInPermission, IUnrestrictedPermission, IPermission, ISecurityEncodable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PrincipalPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003218 RID: 12824 RVA: 0x000ABBC4 File Offset: 0x000A9DC4
public PrincipalPermission(PermissionState state)
{
this.principals = new ArrayList();
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
PrincipalPermission.PrincipalInfo principalInfo = new PrincipalPermission.PrincipalInfo(null, null, true);
this.principals.Add(principalInfo);
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PrincipalPermission" /> class for the specified <paramref name="name" /> and <paramref name="role" />.</summary>
/// <param name="name">The name of the <see cref="T:System.Security.Principal.IPrincipal" /> object's user. </param>
/// <param name="role">The role of the <see cref="T:System.Security.Principal.IPrincipal" /> object's user (for example, Administrator). </param>
// Token: 0x06003219 RID: 12825 RVA: 0x000ABC08 File Offset: 0x000A9E08
public PrincipalPermission(string name, string role)
: this(name, role, true)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PrincipalPermission" /> class for the specified <paramref name="name" />, <paramref name="role" />, and authentication status.</summary>
/// <param name="name">The name of the <see cref="T:System.Security.Principal.IPrincipal" /> object's user. </param>
/// <param name="role">The role of the <see cref="T:System.Security.Principal.IPrincipal" /> object's user (for example, Administrator). </param>
/// <param name="isAuthenticated">true to signify that the user is authenticated; otherwise, false. </param>
// Token: 0x0600321A RID: 12826 RVA: 0x000ABC14 File Offset: 0x000A9E14
public PrincipalPermission(string name, string role, bool isAuthenticated)
{
this.principals = new ArrayList();
PrincipalPermission.PrincipalInfo principalInfo = new PrincipalPermission.PrincipalInfo(name, role, isAuthenticated);
this.principals.Add(principalInfo);
}
// Token: 0x0600321B RID: 12827 RVA: 0x000ABC48 File Offset: 0x000A9E48
internal PrincipalPermission(ArrayList principals)
{
this.principals = (ArrayList)principals.Clone();
}
// Token: 0x0600321C RID: 12828 RVA: 0x000ABC64 File Offset: 0x000A9E64
int IBuiltInPermission.GetTokenIndex()
{
return 8;
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x0600321D RID: 12829 RVA: 0x000ABC68 File Offset: 0x000A9E68
public IPermission Copy()
{
return new PrincipalPermission(this.principals);
}
/// <summary>Determines at run time whether the current principal matches the principal specified by the current permission.</summary>
/// <exception cref="T:System.Security.SecurityException">The current principal does not pass the security check for the principal specified by the current permission.-or- The current <see cref="T:System.Security.Principal.IPrincipal" /> is null. </exception>
// Token: 0x0600321E RID: 12830 RVA: 0x000ABC78 File Offset: 0x000A9E78
public void Demand()
{
IPrincipal currentPrincipal = Thread.CurrentPrincipal;
if (currentPrincipal == null)
{
throw new SecurityException("no Principal");
}
if (this.principals.Count > 0)
{
bool flag = false;
foreach (object obj in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
if ((principalInfo.Name == null || principalInfo.Name == currentPrincipal.Identity.Name) && (principalInfo.Role == null || currentPrincipal.IsInRole(principalInfo.Role)) && ((principalInfo.IsAuthenticated && currentPrincipal.Identity.IsAuthenticated) || !principalInfo.IsAuthenticated))
{
flag = true;
break;
}
}
if (!flag)
{
throw new SecurityException("Demand for principal refused.");
}
}
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="elem">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="elem" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="elem" /> parameter is not a valid permission element.-or- The <paramref name="elem" /> parameter's version number is not valid. </exception>
// Token: 0x0600321F RID: 12831 RVA: 0x000ABD90 File Offset: 0x000A9F90
public void FromXml(SecurityElement elem)
{
this.CheckSecurityElement(elem, "elem", 1, 1);
this.principals.Clear();
if (elem.Children != null)
{
foreach (object obj in elem.Children)
{
SecurityElement securityElement = (SecurityElement)obj;
if (securityElement.Tag != "Identity")
{
throw new ArgumentException("not IPermission/Identity");
}
string text = securityElement.Attribute("ID");
string text2 = securityElement.Attribute("Role");
string text3 = securityElement.Attribute("Authenticated");
bool flag = false;
if (text3 != null)
{
try
{
flag = bool.Parse(text3);
}
catch
{
}
}
PrincipalPermission.PrincipalInfo principalInfo = new PrincipalPermission.PrincipalInfo(text, text2, flag);
this.principals.Add(principalInfo);
}
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission will be null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not an instance of the same class as the current permission. </exception>
// Token: 0x06003220 RID: 12832 RVA: 0x000ABEB4 File Offset: 0x000AA0B4
public IPermission Intersect(IPermission target)
{
PrincipalPermission principalPermission = this.Cast(target);
if (principalPermission == null)
{
return null;
}
if (this.IsUnrestricted())
{
return principalPermission.Copy();
}
if (principalPermission.IsUnrestricted())
{
return this.Copy();
}
PrincipalPermission principalPermission2 = new PrincipalPermission(PermissionState.None);
foreach (object obj in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
foreach (object obj2 in principalPermission.principals)
{
PrincipalPermission.PrincipalInfo principalInfo2 = (PrincipalPermission.PrincipalInfo)obj2;
if (principalInfo.IsAuthenticated == principalInfo2.IsAuthenticated)
{
string text = null;
if (principalInfo.Name == principalInfo2.Name || principalInfo2.Name == null)
{
text = principalInfo.Name;
}
else if (principalInfo.Name == null)
{
text = principalInfo2.Name;
}
string text2 = null;
if (principalInfo.Role == principalInfo2.Role || principalInfo2.Role == null)
{
text2 = principalInfo.Role;
}
else if (principalInfo.Role == null)
{
text2 = principalInfo2.Role;
}
if (text != null || text2 != null)
{
PrincipalPermission.PrincipalInfo principalInfo3 = new PrincipalPermission.PrincipalInfo(text, text2, principalInfo.IsAuthenticated);
principalPermission2.principals.Add(principalInfo3);
}
}
}
}
return (principalPermission2.principals.Count <= 0) ? null : principalPermission2;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is an object that is not of the same type as the current permission. </exception>
// Token: 0x06003221 RID: 12833 RVA: 0x000AC0A0 File Offset: 0x000AA2A0
public bool IsSubsetOf(IPermission target)
{
PrincipalPermission principalPermission = this.Cast(target);
if (principalPermission == null)
{
return this.IsEmpty();
}
if (this.IsUnrestricted())
{
return principalPermission.IsUnrestricted();
}
if (principalPermission.IsUnrestricted())
{
return true;
}
foreach (object obj in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
bool flag = false;
foreach (object obj2 in principalPermission.principals)
{
PrincipalPermission.PrincipalInfo principalInfo2 = (PrincipalPermission.PrincipalInfo)obj2;
if ((principalInfo.Name == principalInfo2.Name || principalInfo2.Name == null) && (principalInfo.Role == principalInfo2.Role || principalInfo2.Role == null) && principalInfo.IsAuthenticated == principalInfo2.IsAuthenticated)
{
flag = true;
}
}
if (!flag)
{
return false;
}
}
return true;
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003222 RID: 12834 RVA: 0x000AC20C File Offset: 0x000AA40C
public bool IsUnrestricted()
{
foreach (object obj in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
if (principalInfo.Name == null && principalInfo.Role == null && principalInfo.IsAuthenticated)
{
return true;
}
}
return false;
}
/// <summary>Creates and returns a string representing the current permission.</summary>
/// <returns>A representation of the current permission.</returns>
// Token: 0x06003223 RID: 12835 RVA: 0x000AC2A0 File Offset: 0x000AA4A0
public override string ToString()
{
return this.ToXml().ToString();
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003224 RID: 12836 RVA: 0x000AC2B0 File Offset: 0x000AA4B0
public SecurityElement ToXml()
{
SecurityElement securityElement = new SecurityElement("Permission");
Type type = base.GetType();
securityElement.AddAttribute("class", type.FullName + ", " + type.Assembly.ToString().Replace('"', '\''));
securityElement.AddAttribute("version", 1.ToString());
foreach (object obj in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
SecurityElement securityElement2 = new SecurityElement("Identity");
if (principalInfo.Name != null)
{
securityElement2.AddAttribute("ID", principalInfo.Name);
}
if (principalInfo.Role != null)
{
securityElement2.AddAttribute("Role", principalInfo.Role);
}
if (principalInfo.IsAuthenticated)
{
securityElement2.AddAttribute("Authenticated", "true");
}
securityElement.AddChild(securityElement2);
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="other">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="other" /> parameter is an object that is not of the same type as the current permission. </exception>
// Token: 0x06003225 RID: 12837 RVA: 0x000AC3DC File Offset: 0x000AA5DC
public IPermission Union(IPermission other)
{
PrincipalPermission principalPermission = this.Cast(other);
if (principalPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || principalPermission.IsUnrestricted())
{
return new PrincipalPermission(PermissionState.Unrestricted);
}
PrincipalPermission principalPermission2 = new PrincipalPermission(this.principals);
foreach (object obj in principalPermission.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj;
principalPermission2.principals.Add(principalInfo);
}
return principalPermission2;
}
/// <summary>Determines whether the specified <see cref="T:System.Security.Permissions.PrincipalPermission" /> object is equal to the current <see cref="T:System.Security.Permissions.PrincipalPermission" />.</summary>
/// <returns>true if the specified <see cref="T:System.Security.Permissions.PrincipalPermission" /> is equal to the current <see cref="T:System.Security.Permissions.PrincipalPermission" /> object; otherwise, false.</returns>
/// <param name="obj">The <see cref="T:System.Security.Permissions.PrincipalPermission" /> object to compare with the current <see cref="T:System.Security.Permissions.PrincipalPermission" />. </param>
// Token: 0x06003226 RID: 12838 RVA: 0x000AC494 File Offset: 0x000AA694
[ComVisible(false)]
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
PrincipalPermission principalPermission = obj as PrincipalPermission;
if (principalPermission == null)
{
return false;
}
if (this.principals.Count != principalPermission.principals.Count)
{
return false;
}
foreach (object obj2 in this.principals)
{
PrincipalPermission.PrincipalInfo principalInfo = (PrincipalPermission.PrincipalInfo)obj2;
bool flag = false;
foreach (object obj3 in principalPermission.principals)
{
PrincipalPermission.PrincipalInfo principalInfo2 = (PrincipalPermission.PrincipalInfo)obj3;
if ((principalInfo.Name == principalInfo2.Name || principalInfo2.Name == null) && (principalInfo.Role == principalInfo2.Role || principalInfo2.Role == null) && principalInfo.IsAuthenticated == principalInfo2.IsAuthenticated)
{
flag = true;
break;
}
}
if (!flag)
{
return false;
}
}
return true;
}
/// <summary>Gets a hash code for the <see cref="T:System.Security.Permissions.PrincipalPermission" /> object that is suitable for use in hashing algorithms and data structures such as a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Security.Permissions.PrincipalPermission" /> object.</returns>
// Token: 0x06003227 RID: 12839 RVA: 0x000AC608 File Offset: 0x000AA808
[ComVisible(false)]
public override int GetHashCode()
{
return base.GetHashCode();
}
// Token: 0x06003228 RID: 12840 RVA: 0x000AC610 File Offset: 0x000AA810
private PrincipalPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
PrincipalPermission principalPermission = target as PrincipalPermission;
if (principalPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(PrincipalPermission));
}
return principalPermission;
}
// Token: 0x06003229 RID: 12841 RVA: 0x000AC644 File Offset: 0x000AA844
private bool IsEmpty()
{
return this.principals.Count == 0;
}
// Token: 0x0600322A RID: 12842 RVA: 0x000AC654 File Offset: 0x000AA854
internal int CheckSecurityElement(SecurityElement se, string parameterName, int minimumVersion, int maximumVersion)
{
if (se == null)
{
throw new ArgumentNullException(parameterName);
}
if (se.Tag != "Permission")
{
string text = string.Format(Locale.GetText("Invalid tag {0}"), se.Tag);
throw new ArgumentException(text, parameterName);
}
int num = minimumVersion;
string text2 = se.Attribute("version");
if (text2 != null)
{
try
{
num = int.Parse(text2);
}
catch (Exception ex)
{
string text3 = Locale.GetText("Couldn't parse version from '{0}'.");
text3 = string.Format(text3, text2);
throw new ArgumentException(text3, parameterName, ex);
}
}
if (num < minimumVersion || num > maximumVersion)
{
string text4 = Locale.GetText("Unknown version '{0}', expected versions between ['{1}','{2}'].");
text4 = string.Format(text4, num, minimumVersion, maximumVersion);
throw new ArgumentException(text4, parameterName);
}
return num;
}
// Token: 0x04001496 RID: 5270
private const int version = 1;
// Token: 0x04001497 RID: 5271
private ArrayList principals;
// Token: 0x0200055D RID: 1373
internal class PrincipalInfo
{
// Token: 0x0600322B RID: 12843 RVA: 0x000AC744 File Offset: 0x000AA944
public PrincipalInfo(string name, string role, bool isAuthenticated)
{
this._name = name;
this._role = role;
this._isAuthenticated = isAuthenticated;
}
// Token: 0x170009D7 RID: 2519
// (get) Token: 0x0600322C RID: 12844 RVA: 0x000AC764 File Offset: 0x000AA964
public string Name
{
get
{
return this._name;
}
}
// Token: 0x170009D8 RID: 2520
// (get) Token: 0x0600322D RID: 12845 RVA: 0x000AC76C File Offset: 0x000AA96C
public string Role
{
get
{
return this._role;
}
}
// Token: 0x170009D9 RID: 2521
// (get) Token: 0x0600322E RID: 12846 RVA: 0x000AC774 File Offset: 0x000AA974
public bool IsAuthenticated
{
get
{
return this._isAuthenticated;
}
}
// Token: 0x04001498 RID: 5272
private string _name;
// Token: 0x04001499 RID: 5273
private string _role;
// Token: 0x0400149A RID: 5274
private bool _isAuthenticated;
}
}
}
@@ -0,0 +1,99 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.PrincipalPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x0200055E RID: 1374
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class PrincipalPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PrincipalPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600322F RID: 12847 RVA: 0x000AC77C File Offset: 0x000AA97C
public PrincipalPermissionAttribute(SecurityAction action)
: base(action)
{
this.authenticated = true;
}
/// <summary>Gets or sets a value indicating whether the current principal has been authenticated by the underlying role-based security provider.</summary>
/// <returns>true if the current principal has been authenticated; otherwise, false.</returns>
// Token: 0x170009DA RID: 2522
// (get) Token: 0x06003230 RID: 12848 RVA: 0x000AC78C File Offset: 0x000AA98C
// (set) Token: 0x06003231 RID: 12849 RVA: 0x000AC794 File Offset: 0x000AA994
public bool Authenticated
{
get
{
return this.authenticated;
}
set
{
this.authenticated = value;
}
}
/// <summary>Gets or sets the name of the identity associated with the current principal.</summary>
/// <returns>A name to match against that provided by the underlying role-based security provider.</returns>
// Token: 0x170009DB RID: 2523
// (get) Token: 0x06003232 RID: 12850 RVA: 0x000AC7A0 File Offset: 0x000AA9A0
// (set) Token: 0x06003233 RID: 12851 RVA: 0x000AC7A8 File Offset: 0x000AA9A8
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>Gets or sets membership in a specified security role.</summary>
/// <returns>The name of a role from the underlying role-based security provider.</returns>
// Token: 0x170009DC RID: 2524
// (get) Token: 0x06003234 RID: 12852 RVA: 0x000AC7B4 File Offset: 0x000AA9B4
// (set) Token: 0x06003235 RID: 12853 RVA: 0x000AC7BC File Offset: 0x000AA9BC
public string Role
{
get
{
return this.role;
}
set
{
this.role = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.PrincipalPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.PrincipalPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003236 RID: 12854 RVA: 0x000AC7C8 File Offset: 0x000AA9C8
public override IPermission CreatePermission()
{
PrincipalPermission principalPermission;
if (base.Unrestricted)
{
principalPermission = new PrincipalPermission(PermissionState.Unrestricted);
}
else
{
principalPermission = new PrincipalPermission(this.name, this.role, this.authenticated);
}
return principalPermission;
}
// Token: 0x0400149B RID: 5275
private bool authenticated;
// Token: 0x0400149C RID: 5276
private string name;
// Token: 0x0400149D RID: 5277
private string role;
}
}
@@ -0,0 +1,192 @@
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Cryptography;
namespace System.Security.Permissions
{
/// <summary>Represents the identity of a software publisher. This class cannot be inherited.</summary>
// Token: 0x0200055F RID: 1375
[ComVisible(true)]
[Serializable]
public sealed class PublisherIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PublisherIdentityPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003237 RID: 12855 RVA: 0x000AC808 File Offset: 0x000AAA08
public PublisherIdentityPermission(PermissionState state)
{
CodeAccessPermission.CheckPermissionState(state, false);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PublisherIdentityPermission" /> class with the specified Authenticode X.509v3 certificate.</summary>
/// <param name="certificate">An X.509 certificate representing the software publisher's identity. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="certificate" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="certificate" /> parameter is not a valid certificate. </exception>
// Token: 0x06003238 RID: 12856 RVA: 0x000AC818 File Offset: 0x000AAA18
public PublisherIdentityPermission(X509Certificate certificate)
{
this.Certificate = certificate;
}
// Token: 0x06003239 RID: 12857 RVA: 0x000AC828 File Offset: 0x000AAA28
int IBuiltInPermission.GetTokenIndex()
{
return 10;
}
/// <summary>Gets or sets an Authenticode X.509v3 certificate that represents the identity of the software publisher.</summary>
/// <returns>An X.509 certificate representing the identity of the software publisher.</returns>
/// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Security.Permissions.PublisherIdentityPermission.Certificate" /> is null. </exception>
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Security.Permissions.PublisherIdentityPermission.Certificate" /> is not a valid certificate. </exception>
/// <exception cref="T:System.NotSupportedException">The property cannot be set because the identity is ambiguous.</exception>
// Token: 0x170009DD RID: 2525
// (get) Token: 0x0600323A RID: 12858 RVA: 0x000AC82C File Offset: 0x000AAA2C
// (set) Token: 0x0600323B RID: 12859 RVA: 0x000AC834 File Offset: 0x000AAA34
public X509Certificate Certificate
{
get
{
return this.x509;
}
set
{
if (value == null)
{
throw new ArgumentNullException("X509Certificate");
}
this.x509 = value;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x0600323C RID: 12860 RVA: 0x000AC850 File Offset: 0x000AAA50
public override IPermission Copy()
{
PublisherIdentityPermission publisherIdentityPermission = new PublisherIdentityPermission(PermissionState.None);
if (this.x509 != null)
{
publisherIdentityPermission.Certificate = this.x509;
}
return publisherIdentityPermission;
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x0600323D RID: 12861 RVA: 0x000AC87C File Offset: 0x000AAA7C
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
string text = esd.Attributes["X509v3Certificate"] as string;
if (text != null)
{
byte[] array = CryptoConvert.FromHex(text);
this.x509 = new X509Certificate(array);
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600323E RID: 12862 RVA: 0x000AC8C8 File Offset: 0x000AAAC8
public override IPermission Intersect(IPermission target)
{
PublisherIdentityPermission publisherIdentityPermission = this.Cast(target);
if (publisherIdentityPermission == null)
{
return null;
}
if (this.x509 != null && publisherIdentityPermission.x509 != null && this.x509.GetRawCertDataString() == publisherIdentityPermission.x509.GetRawCertDataString())
{
return new PublisherIdentityPermission(publisherIdentityPermission.x509);
}
return null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600323F RID: 12863 RVA: 0x000AC928 File Offset: 0x000AAB28
public override bool IsSubsetOf(IPermission target)
{
PublisherIdentityPermission publisherIdentityPermission = this.Cast(target);
return publisherIdentityPermission != null && (this.x509 == null || (publisherIdentityPermission.x509 != null && this.x509.GetRawCertDataString() == publisherIdentityPermission.x509.GetRawCertDataString()));
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003240 RID: 12864 RVA: 0x000AC97C File Offset: 0x000AAB7C
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.x509 != null)
{
securityElement.AddAttribute("X509v3Certificate", this.x509.GetRawCertDataString());
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The two permissions are not equal.</exception>
// Token: 0x06003241 RID: 12865 RVA: 0x000AC9B4 File Offset: 0x000AABB4
public override IPermission Union(IPermission target)
{
PublisherIdentityPermission publisherIdentityPermission = this.Cast(target);
if (publisherIdentityPermission == null)
{
return this.Copy();
}
if (this.x509 != null && publisherIdentityPermission.x509 != null)
{
if (this.x509.GetRawCertDataString() == publisherIdentityPermission.x509.GetRawCertDataString())
{
return new PublisherIdentityPermission(this.x509);
}
}
else
{
if (this.x509 == null && publisherIdentityPermission.x509 != null)
{
return new PublisherIdentityPermission(publisherIdentityPermission.x509);
}
if (this.x509 != null && publisherIdentityPermission.x509 == null)
{
return new PublisherIdentityPermission(this.x509);
}
}
return null;
}
// Token: 0x06003242 RID: 12866 RVA: 0x000ACA64 File Offset: 0x000AAC64
private PublisherIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
PublisherIdentityPermission publisherIdentityPermission = target as PublisherIdentityPermission;
if (publisherIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(PublisherIdentityPermission));
}
return publisherIdentityPermission;
}
// Token: 0x0400149E RID: 5278
private const int version = 1;
// Token: 0x0400149F RID: 5279
private X509Certificate x509;
}
}
@@ -0,0 +1,115 @@
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using Mono.Security.Cryptography;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.PublisherIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000560 RID: 1376
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class PublisherIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.PublisherIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x06003243 RID: 12867 RVA: 0x000ACA98 File Offset: 0x000AAC98
public PublisherIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets a certification file containing an Authenticode X.509v3 certificate.</summary>
/// <returns>The file path of an X.509 certificate file (usually has the extension.cer).</returns>
// Token: 0x170009DE RID: 2526
// (get) Token: 0x06003244 RID: 12868 RVA: 0x000ACAA4 File Offset: 0x000AACA4
// (set) Token: 0x06003245 RID: 12869 RVA: 0x000ACAAC File Offset: 0x000AACAC
public string CertFile
{
get
{
return this.certFile;
}
set
{
this.certFile = value;
}
}
/// <summary>Gets or sets a signed file from which to extract an Authenticode X.509v3 certificate.</summary>
/// <returns>The file path of a file signed with the Authenticode signature.</returns>
// Token: 0x170009DF RID: 2527
// (get) Token: 0x06003246 RID: 12870 RVA: 0x000ACAB8 File Offset: 0x000AACB8
// (set) Token: 0x06003247 RID: 12871 RVA: 0x000ACAC0 File Offset: 0x000AACC0
public string SignedFile
{
get
{
return this.signedFile;
}
set
{
this.signedFile = value;
}
}
/// <summary>Gets or sets an Authenticode X.509v3 certificate identifying the publisher of the calling code.</summary>
/// <returns>A hexadecimal representation of the X.509 certificate.</returns>
// Token: 0x170009E0 RID: 2528
// (get) Token: 0x06003248 RID: 12872 RVA: 0x000ACACC File Offset: 0x000AACCC
// (set) Token: 0x06003249 RID: 12873 RVA: 0x000ACAD4 File Offset: 0x000AACD4
public string X509Certificate
{
get
{
return this.x509data;
}
set
{
this.x509data = value;
}
}
/// <summary>Creates and returns a new instance of <see cref="T:System.Security.Permissions.PublisherIdentityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.PublisherIdentityPermission" /> that corresponds to this attribute.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" />
/// </PermissionSet>
// Token: 0x0600324A RID: 12874 RVA: 0x000ACAE0 File Offset: 0x000AACE0
public override IPermission CreatePermission()
{
if (base.Unrestricted)
{
return new PublisherIdentityPermission(PermissionState.Unrestricted);
}
if (this.x509data != null)
{
byte[] array = CryptoConvert.FromHex(this.x509data);
X509Certificate x509Certificate = new X509Certificate(array);
return new PublisherIdentityPermission(x509Certificate);
}
if (this.certFile != null)
{
X509Certificate x509Certificate = global::System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromCertFile(this.certFile);
return new PublisherIdentityPermission(x509Certificate);
}
if (this.signedFile != null)
{
X509Certificate x509Certificate = global::System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile(this.signedFile);
return new PublisherIdentityPermission(x509Certificate);
}
return new PublisherIdentityPermission(PermissionState.None);
}
// Token: 0x040014A0 RID: 5280
private string certFile;
// Token: 0x040014A1 RID: 5281
private string signedFile;
// Token: 0x040014A2 RID: 5282
private string x509data;
}
}
@@ -0,0 +1,256 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Controls access to non-public types and members through the <see cref="N:System.Reflection" /> APIs. Controls some features of the <see cref="N:System.Reflection.Emit" /> APIs.</summary>
// Token: 0x02000561 RID: 1377
[ComVisible(true)]
[Serializable]
public sealed class ReflectionPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ReflectionPermission" /> class with either fully restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x0600324B RID: 12875 RVA: 0x000ACB68 File Offset: 0x000AAD68
public ReflectionPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this.flags = ReflectionPermissionFlag.AllFlags;
}
else
{
this.flags = ReflectionPermissionFlag.NoFlags;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ReflectionPermission" /> class with the specified access.</summary>
/// <param name="flag">One of the <see cref="T:System.Security.Permissions.ReflectionPermissionFlag" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.ReflectionPermissionFlag" />. </exception>
// Token: 0x0600324C RID: 12876 RVA: 0x000ACB9C File Offset: 0x000AAD9C
public ReflectionPermission(ReflectionPermissionFlag flag)
{
this.Flags = flag;
}
// Token: 0x0600324D RID: 12877 RVA: 0x000ACBAC File Offset: 0x000AADAC
int IBuiltInPermission.GetTokenIndex()
{
return 4;
}
/// <summary>Gets or sets the type of reflection allowed for the current permission.</summary>
/// <returns>The set flags for the current permission.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set this property to an invalid value. See <see cref="T:System.Security.Permissions.ReflectionPermissionFlag" /> for the valid values. </exception>
// Token: 0x170009E1 RID: 2529
// (get) Token: 0x0600324E RID: 12878 RVA: 0x000ACBB0 File Offset: 0x000AADB0
// (set) Token: 0x0600324F RID: 12879 RVA: 0x000ACBB8 File Offset: 0x000AADB8
public ReflectionPermissionFlag Flags
{
get
{
return this.flags;
}
set
{
if ((value & (ReflectionPermissionFlag.TypeInformation | ReflectionPermissionFlag.MemberAccess | ReflectionPermissionFlag.ReflectionEmit | ReflectionPermissionFlag.RestrictedMemberAccess)) != value)
{
string text = string.Format(Locale.GetText("Invalid flags {0}"), value);
throw new ArgumentException(text, "ReflectionPermissionFlag");
}
this.flags = value;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003250 RID: 12880 RVA: 0x000ACBF8 File Offset: 0x000AADF8
public override IPermission Copy()
{
return new ReflectionPermission(this.flags);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x06003251 RID: 12881 RVA: 0x000ACC08 File Offset: 0x000AAE08
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this.flags = ReflectionPermissionFlag.AllFlags;
}
else
{
this.flags = ReflectionPermissionFlag.NoFlags;
string text = esd.Attributes["Flags"] as string;
if (text.IndexOf("MemberAccess") >= 0)
{
this.flags |= ReflectionPermissionFlag.MemberAccess;
}
if (text.IndexOf("ReflectionEmit") >= 0)
{
this.flags |= ReflectionPermissionFlag.ReflectionEmit;
}
if (text.IndexOf("TypeInformation") >= 0)
{
this.flags |= ReflectionPermissionFlag.TypeInformation;
}
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003252 RID: 12882 RVA: 0x000ACCB4 File Offset: 0x000AAEB4
public override IPermission Intersect(IPermission target)
{
ReflectionPermission reflectionPermission = this.Cast(target);
if (reflectionPermission == null)
{
return null;
}
if (this.IsUnrestricted())
{
if (reflectionPermission.Flags == ReflectionPermissionFlag.NoFlags)
{
return null;
}
return reflectionPermission.Copy();
}
else
{
if (!reflectionPermission.IsUnrestricted())
{
ReflectionPermission reflectionPermission2 = (ReflectionPermission)reflectionPermission.Copy();
reflectionPermission2.Flags &= this.flags;
return (reflectionPermission2.Flags != ReflectionPermissionFlag.NoFlags) ? reflectionPermission2 : null;
}
if (this.flags == ReflectionPermissionFlag.NoFlags)
{
return null;
}
return this.Copy();
}
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003253 RID: 12883 RVA: 0x000ACD40 File Offset: 0x000AAF40
public override bool IsSubsetOf(IPermission target)
{
ReflectionPermission reflectionPermission = this.Cast(target);
if (reflectionPermission == null)
{
return this.flags == ReflectionPermissionFlag.NoFlags;
}
if (this.IsUnrestricted())
{
return reflectionPermission.IsUnrestricted();
}
return reflectionPermission.IsUnrestricted() || (this.flags & reflectionPermission.Flags) == this.flags;
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003254 RID: 12884 RVA: 0x000ACD9C File Offset: 0x000AAF9C
public bool IsUnrestricted()
{
return this.flags == ReflectionPermissionFlag.AllFlags;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003255 RID: 12885 RVA: 0x000ACDA8 File Offset: 0x000AAFA8
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.IsUnrestricted())
{
securityElement.AddAttribute("Unrestricted", "true");
}
else if (this.flags == ReflectionPermissionFlag.NoFlags)
{
securityElement.AddAttribute("Flags", "NoFlags");
}
else if ((this.flags & ReflectionPermissionFlag.AllFlags) == ReflectionPermissionFlag.AllFlags)
{
securityElement.AddAttribute("Flags", "AllFlags");
}
else
{
string text = string.Empty;
if ((this.flags & ReflectionPermissionFlag.MemberAccess) == ReflectionPermissionFlag.MemberAccess)
{
text = "MemberAccess";
}
if ((this.flags & ReflectionPermissionFlag.ReflectionEmit) == ReflectionPermissionFlag.ReflectionEmit)
{
if (text.Length > 0)
{
text += ", ";
}
text += "ReflectionEmit";
}
if ((this.flags & ReflectionPermissionFlag.TypeInformation) == ReflectionPermissionFlag.TypeInformation)
{
if (text.Length > 0)
{
text += ", ";
}
text += "TypeInformation";
}
securityElement.AddAttribute("Flags", text);
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="other">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="other" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003256 RID: 12886 RVA: 0x000ACEAC File Offset: 0x000AB0AC
public override IPermission Union(IPermission other)
{
ReflectionPermission reflectionPermission = this.Cast(other);
if (other == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || reflectionPermission.IsUnrestricted())
{
return new ReflectionPermission(PermissionState.Unrestricted);
}
ReflectionPermission reflectionPermission2 = (ReflectionPermission)reflectionPermission.Copy();
reflectionPermission2.Flags |= this.flags;
return reflectionPermission2;
}
// Token: 0x06003257 RID: 12887 RVA: 0x000ACF0C File Offset: 0x000AB10C
private ReflectionPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
ReflectionPermission reflectionPermission = target as ReflectionPermission;
if (reflectionPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(ReflectionPermission));
}
return reflectionPermission;
}
// Token: 0x040014A3 RID: 5283
private const int version = 1;
// Token: 0x040014A4 RID: 5284
private ReflectionPermissionFlag flags;
}
}
@@ -0,0 +1,162 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.ReflectionPermission" /> to be applied to code using declarative security. </summary>
// Token: 0x02000562 RID: 1378
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class ReflectionPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ReflectionPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x06003258 RID: 12888 RVA: 0x000ACF40 File Offset: 0x000AB140
public ReflectionPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the current allowed uses of reflection.</summary>
/// <returns>One or more of the <see cref="T:System.Security.Permissions.ReflectionPermissionFlag" /> values combined using a bitwise OR.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set this property to an invalid value. See <see cref="T:System.Security.Permissions.ReflectionPermissionFlag" /> for the valid values. </exception>
// Token: 0x170009E2 RID: 2530
// (get) Token: 0x06003259 RID: 12889 RVA: 0x000ACF4C File Offset: 0x000AB14C
// (set) Token: 0x0600325A RID: 12890 RVA: 0x000ACF54 File Offset: 0x000AB154
public ReflectionPermissionFlag Flags
{
get
{
return this.flags;
}
set
{
this.flags = value;
this.memberAccess = (this.flags & ReflectionPermissionFlag.MemberAccess) == ReflectionPermissionFlag.MemberAccess;
this.reflectionEmit = (this.flags & ReflectionPermissionFlag.ReflectionEmit) == ReflectionPermissionFlag.ReflectionEmit;
this.typeInfo = (this.flags & ReflectionPermissionFlag.TypeInformation) == ReflectionPermissionFlag.TypeInformation;
}
}
/// <summary>Gets or sets a value that indicates whether invocation of operations on non-public members is allowed.</summary>
/// <returns>true if invocation of operations on non-public members is allowed; otherwise, false.</returns>
// Token: 0x170009E3 RID: 2531
// (get) Token: 0x0600325B RID: 12891 RVA: 0x000ACF9C File Offset: 0x000AB19C
// (set) Token: 0x0600325C RID: 12892 RVA: 0x000ACFA4 File Offset: 0x000AB1A4
public bool MemberAccess
{
get
{
return this.memberAccess;
}
set
{
if (value)
{
this.flags |= ReflectionPermissionFlag.MemberAccess;
}
else
{
this.flags -= 2;
}
this.memberAccess = value;
}
}
/// <summary>Gets or sets a value that indicates whether use of certain features in <see cref="N:System.Reflection.Emit" />, such as emitting debug symbols, is allowed.</summary>
/// <returns>true if use of the affected features is allowed; otherwise, false.</returns>
// Token: 0x170009E4 RID: 2532
// (get) Token: 0x0600325D RID: 12893 RVA: 0x000ACFE0 File Offset: 0x000AB1E0
// (set) Token: 0x0600325E RID: 12894 RVA: 0x000ACFE8 File Offset: 0x000AB1E8
public bool ReflectionEmit
{
get
{
return this.reflectionEmit;
}
set
{
if (value)
{
this.flags |= ReflectionPermissionFlag.ReflectionEmit;
}
else
{
this.flags -= 4;
}
this.reflectionEmit = value;
}
}
/// <summary>Gets or sets a value that indicates whether restricted invocation of non-public members is allowed. Restricted invocation means that the grant set of the assembly that contains the non-public member that is being invoked must be equal to, or a subset of, the grant set of the invoking assembly. </summary>
/// <returns>true if restricted invocation of non-public members is allowed; otherwise, false.</returns>
// Token: 0x170009E5 RID: 2533
// (get) Token: 0x0600325F RID: 12895 RVA: 0x000AD024 File Offset: 0x000AB224
// (set) Token: 0x06003260 RID: 12896 RVA: 0x000AD034 File Offset: 0x000AB234
public bool RestrictedMemberAccess
{
get
{
return (this.flags & ReflectionPermissionFlag.RestrictedMemberAccess) == ReflectionPermissionFlag.RestrictedMemberAccess;
}
set
{
if (value)
{
this.flags |= ReflectionPermissionFlag.RestrictedMemberAccess;
}
else
{
this.flags -= 8;
}
}
}
/// <summary>Gets or sets a value that indicates whether reflection on members that are not visible is allowed.</summary>
/// <returns>true if reflection on members that are not visible is allowed; otherwise, false.</returns>
// Token: 0x170009E6 RID: 2534
// (get) Token: 0x06003261 RID: 12897 RVA: 0x000AD060 File Offset: 0x000AB260
// (set) Token: 0x06003262 RID: 12898 RVA: 0x000AD068 File Offset: 0x000AB268
[Obsolete("not enforced in 2.0+")]
public bool TypeInformation
{
get
{
return this.typeInfo;
}
set
{
if (value)
{
this.flags |= ReflectionPermissionFlag.TypeInformation;
}
else
{
this.flags--;
}
this.typeInfo = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.ReflectionPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.ReflectionPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003263 RID: 12899 RVA: 0x000AD0A4 File Offset: 0x000AB2A4
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x040014A5 RID: 5285
private ReflectionPermissionFlag flags;
// Token: 0x040014A6 RID: 5286
private bool memberAccess;
// Token: 0x040014A7 RID: 5287
private bool reflectionEmit;
// Token: 0x040014A8 RID: 5288
private bool typeInfo;
}
}
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the permitted use of the <see cref="N:System.Reflection" /> and <see cref="N:System.Reflection.Emit" /> namespaces.</summary>
// Token: 0x02000563 RID: 1379
[Flags]
[ComVisible(true)]
[Serializable]
public enum ReflectionPermissionFlag
{
/// <summary>Enumeration of types and members is allowed. Invocation operations are allowed on visible types and members.</summary>
// Token: 0x040014AA RID: 5290
NoFlags = 0,
/// <summary>This flag is obsolete. No flags are necessary to enumerate types and members and to examine their metadata. Use <see cref="F:System.Security.Permissions.ReflectionPermissionFlag.NoFlags" /> instead.</summary>
// Token: 0x040014AB RID: 5291
[Obsolete("not used anymore")]
TypeInformation = 1,
/// <summary>Invocation operations on all members are allowed, regardless of grant set. If this flag is not set, invocation operations are allowed only on visible members.</summary>
// Token: 0x040014AC RID: 5292
MemberAccess = 2,
/// <summary>Emitting debug symbols is allowed. Beginning with the .NET Framework version 2.0 Service Pack 1, this flag is no longer required to emit code.</summary>
// Token: 0x040014AD RID: 5293
ReflectionEmit = 4,
/// <summary>TypeInformation, MemberAccess, and ReflectionEmit are set. <see cref="F:System.Security.Permissions.ReflectionPermissionFlag.AllFlags" /> does not include <see cref="F:System.Security.Permissions.ReflectionPermissionFlag.RestrictedMemberAccess" />.</summary>
// Token: 0x040014AE RID: 5294
AllFlags = 7,
/// <summary>Restricted member access is provided for partially trusted code. Partially trusted code can access nonpublic types and members, but only if the grant set of the partially trusted code includes all permissions in the grant set of the assembly that contains the nonpublic types and members being accessed. This flag is new in the .NET Framework 2.0 SP1.</summary>
// Token: 0x040014AF RID: 5295
[ComVisible(false)]
RestrictedMemberAccess = 8
}
}
@@ -0,0 +1,535 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Text;
namespace System.Security.Permissions
{
/// <summary>Controls the ability to access registry variables. This class cannot be inherited.</summary>
// Token: 0x02000564 RID: 1380
[ComVisible(true)]
[Serializable]
public sealed class RegistryPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.RegistryPermission" /> class with either fully restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003264 RID: 12900 RVA: 0x000AD0A8 File Offset: 0x000AB2A8
public RegistryPermission(PermissionState state)
{
this._state = CodeAccessPermission.CheckPermissionState(state, true);
this.createList = new ArrayList();
this.readList = new ArrayList();
this.writeList = new ArrayList();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.RegistryPermission" /> class with the specified access to the specified registry variables.</summary>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values. </param>
/// <param name="pathList">A list of registry variables (semicolon-separated) to which access is granted. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x06003265 RID: 12901 RVA: 0x000AD0EC File Offset: 0x000AB2EC
public RegistryPermission(RegistryPermissionAccess access, string pathList)
{
this._state = PermissionState.None;
this.createList = new ArrayList();
this.readList = new ArrayList();
this.writeList = new ArrayList();
this.AddPathList(access, pathList);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.RegistryPermission" /> class with the specified access to the specified registry variables and the specified access rights to registry control information.</summary>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values.</param>
/// <param name="control">A bitwise combination of the <see cref="T:System.Security.AccessControl.AccessControlActions" /> values.</param>
/// <param name="pathList">A list of registry variables (semicolon-separated) to which access is granted.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x06003266 RID: 12902 RVA: 0x000AD130 File Offset: 0x000AB330
public RegistryPermission(RegistryPermissionAccess access, AccessControlActions control, string pathList)
{
if (!Enum.IsDefined(typeof(AccessControlActions), control))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), control);
throw new ArgumentException(text, "AccessControlActions");
}
this._state = PermissionState.None;
this.AddPathList(access, control, pathList);
}
// Token: 0x06003267 RID: 12903 RVA: 0x000AD190 File Offset: 0x000AB390
int IBuiltInPermission.GetTokenIndex()
{
return 5;
}
/// <summary>Adds access for the specified registry variables to the existing state of the permission.</summary>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values. </param>
/// <param name="pathList">A list of registry variables (semicolon-separated). </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x06003268 RID: 12904 RVA: 0x000AD194 File Offset: 0x000AB394
public void AddPathList(RegistryPermissionAccess access, string pathList)
{
if (pathList == null)
{
throw new ArgumentNullException("pathList");
}
switch (access)
{
case RegistryPermissionAccess.NoAccess:
return;
case RegistryPermissionAccess.Read:
this.AddWithUnionKey(this.readList, pathList);
return;
case RegistryPermissionAccess.Write:
this.AddWithUnionKey(this.writeList, pathList);
return;
case RegistryPermissionAccess.Create:
this.AddWithUnionKey(this.createList, pathList);
return;
case RegistryPermissionAccess.AllAccess:
this.AddWithUnionKey(this.createList, pathList);
this.AddWithUnionKey(this.readList, pathList);
this.AddWithUnionKey(this.writeList, pathList);
return;
}
this.ThrowInvalidFlag(access, false);
}
/// <summary>Adds access for the specified registry variables to the existing state of the permission, specifying registry permission access and access control actions.</summary>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values. </param>
/// <param name="control">One of the <see cref="T:System.Security.AccessControl.AccessControlActions" /> values. </param>
/// <param name="pathList">A list of registry variables (separated by semicolons).</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x06003269 RID: 12905 RVA: 0x000AD254 File Offset: 0x000AB454
[MonoTODO("(2.0) Access Control isn't implemented")]
public void AddPathList(RegistryPermissionAccess access, AccessControlActions control, string pathList)
{
throw new NotImplementedException();
}
/// <summary>Gets paths for all registry variables with the specified <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.</summary>
/// <returns>A list of the registry variables (semicolon-separated) with the specified <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.</returns>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values that represents a single type of registry variable access. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="access" /> is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- <paramref name="access" /> is <see cref="F:System.Security.Permissions.RegistryPermissionAccess.AllAccess" />, which represents more than one type of registry variable access, or <see cref="F:System.Security.Permissions.RegistryPermissionAccess.NoAccess" />, which does not represent any type of registry variable access. </exception>
// Token: 0x0600326A RID: 12906 RVA: 0x000AD25C File Offset: 0x000AB45C
public string GetPathList(RegistryPermissionAccess access)
{
switch (access)
{
case RegistryPermissionAccess.NoAccess:
case RegistryPermissionAccess.AllAccess:
this.ThrowInvalidFlag(access, true);
goto IL_6E;
case RegistryPermissionAccess.Read:
return this.GetPathList(this.readList);
case RegistryPermissionAccess.Write:
return this.GetPathList(this.writeList);
case RegistryPermissionAccess.Create:
return this.GetPathList(this.createList);
}
this.ThrowInvalidFlag(access, false);
IL_6E:
return null;
}
/// <summary>Sets new access for the specified registry variable names to the existing state of the permission.</summary>
/// <param name="access">One of the <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values. </param>
/// <param name="pathList">A list of registry variables (semicolon-separated). </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="access" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.RegistryPermissionAccess" />.-or- The <paramref name="pathList" /> parameter is not a valid string. </exception>
// Token: 0x0600326B RID: 12907 RVA: 0x000AD2D8 File Offset: 0x000AB4D8
public void SetPathList(RegistryPermissionAccess access, string pathList)
{
if (pathList == null)
{
throw new ArgumentNullException("pathList");
}
switch (access)
{
case RegistryPermissionAccess.NoAccess:
return;
case RegistryPermissionAccess.Read:
{
this.readList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text in array)
{
this.readList.Add(text);
}
return;
}
case RegistryPermissionAccess.Write:
{
this.writeList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text2 in array)
{
this.writeList.Add(text2);
}
return;
}
case RegistryPermissionAccess.Create:
{
this.createList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text3 in array)
{
this.createList.Add(text3);
}
return;
}
case RegistryPermissionAccess.AllAccess:
{
this.createList.Clear();
this.readList.Clear();
this.writeList.Clear();
string[] array = pathList.Split(new char[] { ';' });
foreach (string text4 in array)
{
this.createList.Add(text4);
this.readList.Add(text4);
this.writeList.Add(text4);
}
return;
}
}
this.ThrowInvalidFlag(access, false);
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x0600326C RID: 12908 RVA: 0x000AD4AC File Offset: 0x000AB6AC
public override IPermission Copy()
{
RegistryPermission registryPermission = new RegistryPermission(this._state);
string text = this.GetPathList(RegistryPermissionAccess.Create);
if (text != null)
{
registryPermission.SetPathList(RegistryPermissionAccess.Create, text);
}
text = this.GetPathList(RegistryPermissionAccess.Read);
if (text != null)
{
registryPermission.SetPathList(RegistryPermissionAccess.Read, text);
}
text = this.GetPathList(RegistryPermissionAccess.Write);
if (text != null)
{
registryPermission.SetPathList(RegistryPermissionAccess.Write, text);
}
return registryPermission;
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x0600326D RID: 12909 RVA: 0x000AD508 File Offset: 0x000AB708
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this._state = PermissionState.Unrestricted;
}
string text = esd.Attribute("Create");
if (text != null && text.Length > 0)
{
this.SetPathList(RegistryPermissionAccess.Create, text);
}
string text2 = esd.Attribute("Read");
if (text2 != null && text2.Length > 0)
{
this.SetPathList(RegistryPermissionAccess.Read, text2);
}
string text3 = esd.Attribute("Write");
if (text3 != null && text3.Length > 0)
{
this.SetPathList(RegistryPermissionAccess.Write, text3);
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600326E RID: 12910 RVA: 0x000AD5B8 File Offset: 0x000AB7B8
public override IPermission Intersect(IPermission target)
{
RegistryPermission registryPermission = this.Cast(target);
if (registryPermission == null)
{
return null;
}
if (this.IsUnrestricted())
{
return registryPermission.Copy();
}
if (registryPermission.IsUnrestricted())
{
return this.Copy();
}
RegistryPermission registryPermission2 = new RegistryPermission(PermissionState.None);
this.IntersectKeys(this.createList, registryPermission.createList, registryPermission2.createList);
this.IntersectKeys(this.readList, registryPermission.readList, registryPermission2.readList);
this.IntersectKeys(this.writeList, registryPermission.writeList, registryPermission2.writeList);
return (!registryPermission2.IsEmpty()) ? registryPermission2 : null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x0600326F RID: 12911 RVA: 0x000AD65C File Offset: 0x000AB85C
public override bool IsSubsetOf(IPermission target)
{
RegistryPermission registryPermission = this.Cast(target);
if (registryPermission == null)
{
return false;
}
if (registryPermission.IsEmpty())
{
return this.IsEmpty();
}
if (this.IsUnrestricted())
{
return registryPermission.IsUnrestricted();
}
return registryPermission.IsUnrestricted() || (this.KeyIsSubsetOf(this.createList, registryPermission.createList) && this.KeyIsSubsetOf(this.readList, registryPermission.readList) && this.KeyIsSubsetOf(this.writeList, registryPermission.writeList));
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003270 RID: 12912 RVA: 0x000AD6F8 File Offset: 0x000AB8F8
public bool IsUnrestricted()
{
return this._state == PermissionState.Unrestricted;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003271 RID: 12913 RVA: 0x000AD704 File Offset: 0x000AB904
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this._state == PermissionState.Unrestricted)
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
string text = this.GetPathList(RegistryPermissionAccess.Create);
if (text != null)
{
securityElement.AddAttribute("Create", text);
}
text = this.GetPathList(RegistryPermissionAccess.Read);
if (text != null)
{
securityElement.AddAttribute("Read", text);
}
text = this.GetPathList(RegistryPermissionAccess.Write);
if (text != null)
{
securityElement.AddAttribute("Write", text);
}
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="other">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="other" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003272 RID: 12914 RVA: 0x000AD78C File Offset: 0x000AB98C
public override IPermission Union(IPermission other)
{
RegistryPermission registryPermission = this.Cast(other);
if (registryPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || registryPermission.IsUnrestricted())
{
return new RegistryPermission(PermissionState.Unrestricted);
}
if (this.IsEmpty() && registryPermission.IsEmpty())
{
return null;
}
RegistryPermission registryPermission2 = (RegistryPermission)this.Copy();
string text = registryPermission.GetPathList(RegistryPermissionAccess.Create);
if (text != null)
{
registryPermission2.AddPathList(RegistryPermissionAccess.Create, text);
}
text = registryPermission.GetPathList(RegistryPermissionAccess.Read);
if (text != null)
{
registryPermission2.AddPathList(RegistryPermissionAccess.Read, text);
}
text = registryPermission.GetPathList(RegistryPermissionAccess.Write);
if (text != null)
{
registryPermission2.AddPathList(RegistryPermissionAccess.Write, text);
}
return registryPermission2;
}
// Token: 0x06003273 RID: 12915 RVA: 0x000AD834 File Offset: 0x000ABA34
private bool IsEmpty()
{
return this._state == PermissionState.None && this.createList.Count == 0 && this.readList.Count == 0 && this.writeList.Count == 0;
}
// Token: 0x06003274 RID: 12916 RVA: 0x000AD880 File Offset: 0x000ABA80
private RegistryPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
RegistryPermission registryPermission = target as RegistryPermission;
if (registryPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(RegistryPermission));
}
return registryPermission;
}
// Token: 0x06003275 RID: 12917 RVA: 0x000AD8B4 File Offset: 0x000ABAB4
internal void ThrowInvalidFlag(RegistryPermissionAccess flag, bool context)
{
string text;
if (context)
{
text = Locale.GetText("Unknown flag '{0}'.");
}
else
{
text = Locale.GetText("Invalid flag '{0}' in this context.");
}
throw new ArgumentException(string.Format(text, flag), "flag");
}
// Token: 0x06003276 RID: 12918 RVA: 0x000AD8FC File Offset: 0x000ABAFC
private string GetPathList(ArrayList list)
{
if (this.IsUnrestricted())
{
return string.Empty;
}
if (list.Count == 0)
{
return string.Empty;
}
StringBuilder stringBuilder = new StringBuilder();
foreach (object obj in list)
{
string text = (string)obj;
stringBuilder.Append(text);
stringBuilder.Append(";");
}
string text2 = stringBuilder.ToString();
int length = text2.Length;
if (length > 0)
{
return text2.Substring(0, length - 1);
}
return string.Empty;
}
// Token: 0x06003277 RID: 12919 RVA: 0x000AD9C8 File Offset: 0x000ABBC8
internal bool KeyIsSubsetOf(IList local, IList target)
{
bool flag = false;
foreach (object obj in local)
{
string text = (string)obj;
foreach (object obj2 in target)
{
string text2 = (string)obj2;
if (text.StartsWith(text2))
{
flag = true;
break;
}
}
if (!flag)
{
return false;
}
}
return true;
}
// Token: 0x06003278 RID: 12920 RVA: 0x000ADAB0 File Offset: 0x000ABCB0
internal void AddWithUnionKey(IList list, string pathList)
{
string[] array = pathList.Split(new char[] { ';' });
foreach (string text in array)
{
int count = list.Count;
if (count == 0)
{
list.Add(text);
}
else
{
for (int j = 0; j < count; j++)
{
string text2 = (string)list[j];
if (text2.StartsWith(text))
{
list[j] = text;
}
else if (!text.StartsWith(text2))
{
list.Add(text);
}
}
}
}
}
// Token: 0x06003279 RID: 12921 RVA: 0x000ADB60 File Offset: 0x000ABD60
internal void IntersectKeys(IList local, IList target, IList result)
{
foreach (object obj in local)
{
string text = (string)obj;
foreach (object obj2 in target)
{
string text2 = (string)obj2;
if (text2.Length > text.Length)
{
if (text2.StartsWith(text))
{
result.Add(text2);
}
}
else if (text.StartsWith(text2))
{
result.Add(text);
}
}
}
}
// Token: 0x040014B0 RID: 5296
private const int version = 1;
// Token: 0x040014B1 RID: 5297
private PermissionState _state;
// Token: 0x040014B2 RID: 5298
private ArrayList createList;
// Token: 0x040014B3 RID: 5299
private ArrayList readList;
// Token: 0x040014B4 RID: 5300
private ArrayList writeList;
}
}
@@ -0,0 +1,30 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the permitted access to registry keys and values.</summary>
// Token: 0x02000565 RID: 1381
[Flags]
[ComVisible(true)]
[Serializable]
public enum RegistryPermissionAccess
{
/// <summary>No access to registry variables. <see cref="F:System.Security.Permissions.RegistryPermissionAccess.NoAccess" /> represents no valid <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the parameter for <see cref="M:System.Security.Permissions.RegistryPermission.GetPathList(System.Security.Permissions.RegistryPermissionAccess)" />, which expects a single value.</summary>
// Token: 0x040014B6 RID: 5302
NoAccess = 0,
/// <summary>Read access to registry variables.</summary>
// Token: 0x040014B7 RID: 5303
Read = 1,
/// <summary>Write access to registry variables.</summary>
// Token: 0x040014B8 RID: 5304
Write = 2,
/// <summary>Create access to registry variables.</summary>
// Token: 0x040014B9 RID: 5305
Create = 4,
/// <summary>
/// <see cref="F:System.Security.Permissions.RegistryPermissionAccess.Create" />, <see cref="F:System.Security.Permissions.RegistryPermissionAccess.Read" />, and <see cref="F:System.Security.Permissions.RegistryPermissionAccess.Write" /> access to registry variables. <see cref="F:System.Security.Permissions.RegistryPermissionAccess.AllAccess" /> represents multiple <see cref="T:System.Security.Permissions.RegistryPermissionAccess" /> values and causes an <see cref="T:System.ArgumentException" /> when used as the <paramref name="access" /> parameter for the <see cref="M:System.Security.Permissions.RegistryPermission.GetPathList(System.Security.Permissions.RegistryPermissionAccess)" /> method, which expects a single value.</summary>
// Token: 0x040014BA RID: 5306
AllAccess = 7
}
}
@@ -0,0 +1,192 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.RegistryPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000566 RID: 1382
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class RegistryPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.RegistryPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="action" /> parameter is not a valid <see cref="T:System.Security.Permissions.SecurityAction" />. </exception>
// Token: 0x0600327A RID: 12922 RVA: 0x000ADC5C File Offset: 0x000ABE5C
public RegistryPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets full access for the specified registry keys.</summary>
/// <returns>A semicolon-separated list of registry key paths, for full access. </returns>
/// <exception cref="T:System.NotSupportedException">The get accessor is called; it is only provided for C# compiler compatibility.</exception>
// Token: 0x170009E7 RID: 2535
// (get) Token: 0x0600327B RID: 12923 RVA: 0x000ADC68 File Offset: 0x000ABE68
// (set) Token: 0x0600327C RID: 12924 RVA: 0x000ADC74 File Offset: 0x000ABE74
[Obsolete("use newer properties")]
public string All
{
get
{
throw new NotSupportedException("All");
}
set
{
this.create = value;
this.read = value;
this.write = value;
}
}
/// <summary>Gets or sets create-level access for the specified registry keys. </summary>
/// <returns>A semicolon-separated list of registry key paths, for create-level access. </returns>
// Token: 0x170009E8 RID: 2536
// (get) Token: 0x0600327D RID: 12925 RVA: 0x000ADC8C File Offset: 0x000ABE8C
// (set) Token: 0x0600327E RID: 12926 RVA: 0x000ADC94 File Offset: 0x000ABE94
public string Create
{
get
{
return this.create;
}
set
{
this.create = value;
}
}
/// <summary>Gets or sets read access for the specified registry keys.</summary>
/// <returns>A semicolon-separated list of registry key paths, for read access. </returns>
// Token: 0x170009E9 RID: 2537
// (get) Token: 0x0600327F RID: 12927 RVA: 0x000ADCA0 File Offset: 0x000ABEA0
// (set) Token: 0x06003280 RID: 12928 RVA: 0x000ADCA8 File Offset: 0x000ABEA8
public string Read
{
get
{
return this.read;
}
set
{
this.read = value;
}
}
/// <summary>Gets or sets write access for the specified registry keys.</summary>
/// <returns>A semicolon-separated list of registry key paths, for write access. </returns>
// Token: 0x170009EA RID: 2538
// (get) Token: 0x06003281 RID: 12929 RVA: 0x000ADCB4 File Offset: 0x000ABEB4
// (set) Token: 0x06003282 RID: 12930 RVA: 0x000ADCBC File Offset: 0x000ABEBC
public string Write
{
get
{
return this.write;
}
set
{
this.write = value;
}
}
/// <summary>Gets or sets change access control for the specified registry keys.</summary>
/// <returns>A semicolon-separated list of registry key paths, for change access control. .</returns>
// Token: 0x170009EB RID: 2539
// (get) Token: 0x06003283 RID: 12931 RVA: 0x000ADCC8 File Offset: 0x000ABEC8
// (set) Token: 0x06003284 RID: 12932 RVA: 0x000ADCD0 File Offset: 0x000ABED0
public string ChangeAccessControl
{
get
{
return this.changeAccessControl;
}
set
{
this.changeAccessControl = value;
}
}
/// <summary>Gets or sets view access control for the specified registry keys.</summary>
/// <returns>A semicolon-separated list of registry key paths, for view access control.</returns>
// Token: 0x170009EC RID: 2540
// (get) Token: 0x06003285 RID: 12933 RVA: 0x000ADCDC File Offset: 0x000ABEDC
// (set) Token: 0x06003286 RID: 12934 RVA: 0x000ADCE4 File Offset: 0x000ABEE4
public string ViewAccessControl
{
get
{
return this.viewAccessControl;
}
set
{
this.viewAccessControl = value;
}
}
/// <summary>Gets or sets a specified set of registry keys that can be viewed and modified.</summary>
/// <returns>A semicolon-separated list of registry key paths, for create, read, and write access. </returns>
/// <exception cref="T:System.NotSupportedException">The get accessor is called; it is only provided for C# compiler compatibility. </exception>
// Token: 0x170009ED RID: 2541
// (get) Token: 0x06003287 RID: 12935 RVA: 0x000ADCF0 File Offset: 0x000ABEF0
// (set) Token: 0x06003288 RID: 12936 RVA: 0x000ADCF8 File Offset: 0x000ABEF8
public string ViewAndModify
{
get
{
throw new NotSupportedException();
}
set
{
this.create = value;
this.read = value;
this.write = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.RegistryPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.RegistryPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003289 RID: 12937 RVA: 0x000ADD10 File Offset: 0x000ABF10
public override IPermission CreatePermission()
{
RegistryPermission registryPermission;
if (base.Unrestricted)
{
registryPermission = new RegistryPermission(PermissionState.Unrestricted);
}
else
{
registryPermission = new RegistryPermission(PermissionState.None);
if (this.create != null)
{
registryPermission.AddPathList(RegistryPermissionAccess.Create, this.create);
}
if (this.read != null)
{
registryPermission.AddPathList(RegistryPermissionAccess.Read, this.read);
}
if (this.write != null)
{
registryPermission.AddPathList(RegistryPermissionAccess.Write, this.write);
}
}
return registryPermission;
}
// Token: 0x040014BB RID: 5307
private string create;
// Token: 0x040014BC RID: 5308
private string read;
// Token: 0x040014BD RID: 5309
private string write;
// Token: 0x040014BE RID: 5310
private string changeAccessControl;
// Token: 0x040014BF RID: 5311
private string viewAccessControl;
}
}
@@ -0,0 +1,41 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the security actions that can be performed using declarative security.</summary>
// Token: 0x02000567 RID: 1383
[ComVisible(true)]
[Obsolete("CAS support is not available with Silverlight applications.")]
[Serializable]
public enum SecurityAction
{
/// <summary>All callers higher in the call stack are required to have been granted the permission specified by the current permission object (see Security Demands).</summary>
// Token: 0x040014C1 RID: 5313
Demand = 2,
/// <summary>The calling code can access the resource identified by the current permission object, even if callers higher in the stack have not been granted permission to access the resource (see Using the Assert Method).</summary>
// Token: 0x040014C2 RID: 5314
Assert,
/// <summary>The ability to access the resource specified by the current permission object is denied to callers, even if they have been granted permission to access it (see Using the Deny Method).</summary>
// Token: 0x040014C3 RID: 5315
Deny,
/// <summary>Only the resources specified by this permission object can be accessed, even if the code has been granted permission to access other resources (see Using the PermitOnly Method).</summary>
// Token: 0x040014C4 RID: 5316
PermitOnly,
/// <summary>The immediate caller is required to have been granted the specified permission.</summary>
// Token: 0x040014C5 RID: 5317
LinkDemand,
/// <summary>The derived class inheriting the class or overriding a method is required to have been granted the specified permission. For more information, see Inheritance Demands.</summary>
// Token: 0x040014C6 RID: 5318
InheritanceDemand,
/// <summary>The request for the minimum permissions required for code to run. This action can only be used within the scope of the assembly.</summary>
// Token: 0x040014C7 RID: 5319
RequestMinimum,
/// <summary>The request for additional permissions that are optional (not required to run). This request implicitly refuses all other permissions not specifically requested. This action can only be used within the scope of the assembly. </summary>
// Token: 0x040014C8 RID: 5320
RequestOptional,
/// <summary>The request that permissions that might be misused will not be granted to the calling code. This action can only be used within the scope of the assembly.</summary>
// Token: 0x040014C9 RID: 5321
RequestRefuse
}
}
@@ -0,0 +1,67 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the base attribute class for declarative security from which <see cref="T:System.Security.Permissions.CodeAccessSecurityAttribute" /> is derived.</summary>
// Token: 0x02000046 RID: 70
[ComVisible(true)]
[Obsolete("CAS support is not available with Silverlight applications.")]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public abstract class SecurityAttribute : Attribute
{
/// <summary>Initializes a new instance of <see cref="T:System.Security.Permissions.SecurityAttribute" /> with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x06000662 RID: 1634 RVA: 0x00014B10 File Offset: 0x00012D10
protected SecurityAttribute(SecurityAction action)
{
this.Action = action;
}
/// <summary>When overridden in a derived class, creates a permission object that can then be serialized into binary form and persistently stored along with the <see cref="T:System.Security.Permissions.SecurityAction" /> in an assembly's metadata.</summary>
/// <returns>A serializable permission object.</returns>
// Token: 0x06000663 RID: 1635
public abstract IPermission CreatePermission();
/// <summary>Gets or sets a value indicating whether full (unrestricted) permission to the resource protected by the attribute is declared.</summary>
/// <returns>true if full permission to the protected resource is declared; otherwise, false.</returns>
// Token: 0x170000B2 RID: 178
// (get) Token: 0x06000664 RID: 1636 RVA: 0x00014B20 File Offset: 0x00012D20
// (set) Token: 0x06000665 RID: 1637 RVA: 0x00014B28 File Offset: 0x00012D28
public bool Unrestricted
{
get
{
return this.m_Unrestricted;
}
set
{
this.m_Unrestricted = value;
}
}
/// <summary>Gets or sets a security action.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values.</returns>
// Token: 0x170000B3 RID: 179
// (get) Token: 0x06000666 RID: 1638 RVA: 0x00014B34 File Offset: 0x00012D34
// (set) Token: 0x06000667 RID: 1639 RVA: 0x00014B3C File Offset: 0x00012D3C
public SecurityAction Action
{
get
{
return this.m_Action;
}
set
{
this.m_Action = value;
}
}
// Token: 0x0400009B RID: 155
private SecurityAction m_Action;
// Token: 0x0400009C RID: 156
private bool m_Unrestricted;
}
}
@@ -0,0 +1,222 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Describes a set of security permissions applied to code. This class cannot be inherited.</summary>
// Token: 0x02000568 RID: 1384
[ComVisible(true)]
[Serializable]
public sealed class SecurityPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SecurityPermission" /> class with either restricted or unrestricted permission as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x0600328A RID: 12938 RVA: 0x000ADD88 File Offset: 0x000ABF88
public SecurityPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this.flags = SecurityPermissionFlag.AllFlags;
}
else
{
this.flags = SecurityPermissionFlag.NoFlags;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SecurityPermission" /> class with the specified initial set state of the flags.</summary>
/// <param name="flag">The initial state of the permission, represented by a bitwise OR combination of any permission bits defined by <see cref="T:System.Security.Permissions.SecurityPermissionFlag" />. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.SecurityPermissionFlag" />. </exception>
// Token: 0x0600328B RID: 12939 RVA: 0x000ADDC0 File Offset: 0x000ABFC0
public SecurityPermission(SecurityPermissionFlag flag)
{
this.Flags = flag;
}
// Token: 0x0600328C RID: 12940 RVA: 0x000ADDD0 File Offset: 0x000ABFD0
int IBuiltInPermission.GetTokenIndex()
{
return 6;
}
/// <summary>Gets or sets the security permission flags.</summary>
/// <returns>The state of the current permission, represented by a bitwise OR combination of any permission bits defined by <see cref="T:System.Security.Permissions.SecurityPermissionFlag" />.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set this property to an invalid value. See <see cref="T:System.Security.Permissions.SecurityPermissionFlag" /> for the valid values. </exception>
// Token: 0x170009EE RID: 2542
// (get) Token: 0x0600328D RID: 12941 RVA: 0x000ADDD4 File Offset: 0x000ABFD4
// (set) Token: 0x0600328E RID: 12942 RVA: 0x000ADDDC File Offset: 0x000ABFDC
public SecurityPermissionFlag Flags
{
get
{
return this.flags;
}
set
{
if ((value & SecurityPermissionFlag.AllFlags) != value)
{
string text = string.Format(Locale.GetText("Invalid flags {0}"), value);
throw new ArgumentException(text, "SecurityPermissionFlag");
}
this.flags = value;
}
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x0600328F RID: 12943 RVA: 0x000ADE20 File Offset: 0x000AC020
public bool IsUnrestricted()
{
return this.flags == SecurityPermissionFlag.AllFlags;
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003290 RID: 12944 RVA: 0x000ADE30 File Offset: 0x000AC030
public override IPermission Copy()
{
return new SecurityPermission(this.flags);
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission object that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003291 RID: 12945 RVA: 0x000ADE40 File Offset: 0x000AC040
public override IPermission Intersect(IPermission target)
{
SecurityPermission securityPermission = this.Cast(target);
if (securityPermission == null)
{
return null;
}
if (this.IsEmpty() || securityPermission.IsEmpty())
{
return null;
}
if (this.IsUnrestricted() && securityPermission.IsUnrestricted())
{
return new SecurityPermission(PermissionState.Unrestricted);
}
if (this.IsUnrestricted())
{
return securityPermission.Copy();
}
if (securityPermission.IsUnrestricted())
{
return this.Copy();
}
SecurityPermissionFlag securityPermissionFlag = this.flags & securityPermission.flags;
if (securityPermissionFlag == SecurityPermissionFlag.NoFlags)
{
return null;
}
return new SecurityPermission(securityPermissionFlag);
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003292 RID: 12946 RVA: 0x000ADED4 File Offset: 0x000AC0D4
public override IPermission Union(IPermission target)
{
SecurityPermission securityPermission = this.Cast(target);
if (securityPermission == null)
{
return this.Copy();
}
if (this.IsUnrestricted() || securityPermission.IsUnrestricted())
{
return new SecurityPermission(PermissionState.Unrestricted);
}
return new SecurityPermission(this.flags | securityPermission.flags);
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003293 RID: 12947 RVA: 0x000ADF28 File Offset: 0x000AC128
public override bool IsSubsetOf(IPermission target)
{
SecurityPermission securityPermission = this.Cast(target);
if (securityPermission == null)
{
return this.IsEmpty();
}
return securityPermission.IsUnrestricted() || (!this.IsUnrestricted() && (this.flags & ~securityPermission.flags) == SecurityPermissionFlag.NoFlags);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not supported. </exception>
// Token: 0x06003294 RID: 12948 RVA: 0x000ADF78 File Offset: 0x000AC178
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this.flags = SecurityPermissionFlag.AllFlags;
}
else
{
string text = esd.Attribute("Flags");
if (text == null)
{
this.flags = SecurityPermissionFlag.NoFlags;
}
else
{
this.flags = (SecurityPermissionFlag)((int)Enum.Parse(typeof(SecurityPermissionFlag), text));
}
}
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003295 RID: 12949 RVA: 0x000ADFE8 File Offset: 0x000AC1E8
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.IsUnrestricted())
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
securityElement.AddAttribute("Flags", this.flags.ToString());
}
return securityElement;
}
// Token: 0x06003296 RID: 12950 RVA: 0x000AE03C File Offset: 0x000AC23C
private bool IsEmpty()
{
return this.flags == SecurityPermissionFlag.NoFlags;
}
// Token: 0x06003297 RID: 12951 RVA: 0x000AE048 File Offset: 0x000AC248
private SecurityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
SecurityPermission securityPermission = target as SecurityPermission;
if (securityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(SecurityPermission));
}
return securityPermission;
}
// Token: 0x040014CA RID: 5322
private const int version = 1;
// Token: 0x040014CB RID: 5323
private SecurityPermissionFlag flags;
}
}
@@ -0,0 +1,389 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.SecurityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000569 RID: 1385
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Obsolete("CAS support is not available with Silverlight applications.")]
[ComVisible(true)]
[Serializable]
public sealed class SecurityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SecurityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x06003298 RID: 12952 RVA: 0x000AE07C File Offset: 0x000AC27C
public SecurityPermissionAttribute(SecurityAction action)
: base(action)
{
this.m_Flags = SecurityPermissionFlag.NoFlags;
}
/// <summary>Gets or sets a value indicating whether permission to assert that all this code's callers have the requisite permission for the operation is declared.</summary>
/// <returns>true if permission to assert is declared; otherwise, false.</returns>
// Token: 0x170009EF RID: 2543
// (get) Token: 0x06003299 RID: 12953 RVA: 0x000AE08C File Offset: 0x000AC28C
// (set) Token: 0x0600329A RID: 12954 RVA: 0x000AE09C File Offset: 0x000AC29C
public bool Assertion
{
get
{
return (this.m_Flags & SecurityPermissionFlag.Assertion) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.Assertion;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.Assertion;
}
}
}
/// <summary>Gets or sets a value that indicates whether code has permission to perform binding redirection in the application configuration file.</summary>
/// <returns>true if code can perform binding redirects; otherwise, false.</returns>
// Token: 0x170009F0 RID: 2544
// (get) Token: 0x0600329B RID: 12955 RVA: 0x000AE0D4 File Offset: 0x000AC2D4
// (set) Token: 0x0600329C RID: 12956 RVA: 0x000AE0E8 File Offset: 0x000AC2E8
public bool BindingRedirects
{
get
{
return (this.m_Flags & SecurityPermissionFlag.BindingRedirects) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.BindingRedirects;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.BindingRedirects;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to manipulate <see cref="T:System.AppDomain" /> is declared.</summary>
/// <returns>true if permission to manipulate <see cref="T:System.AppDomain" /> is declared; otherwise, false.</returns>
// Token: 0x170009F1 RID: 2545
// (get) Token: 0x0600329D RID: 12957 RVA: 0x000AE11C File Offset: 0x000AC31C
// (set) Token: 0x0600329E RID: 12958 RVA: 0x000AE130 File Offset: 0x000AC330
public bool ControlAppDomain
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlAppDomain) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlAppDomain;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlAppDomain;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to alter or manipulate domain security policy is declared.</summary>
/// <returns>true if permission to alter or manipulate security policy in an application domain is declared; otherwise, false.</returns>
// Token: 0x170009F2 RID: 2546
// (get) Token: 0x0600329F RID: 12959 RVA: 0x000AE164 File Offset: 0x000AC364
// (set) Token: 0x060032A0 RID: 12960 RVA: 0x000AE178 File Offset: 0x000AC378
public bool ControlDomainPolicy
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlDomainPolicy) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlDomainPolicy;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlDomainPolicy;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to alter or manipulate evidence is declared.</summary>
/// <returns>true if the ability to alter or manipulate evidence is declared; otherwise, false.</returns>
// Token: 0x170009F3 RID: 2547
// (get) Token: 0x060032A1 RID: 12961 RVA: 0x000AE1AC File Offset: 0x000AC3AC
// (set) Token: 0x060032A2 RID: 12962 RVA: 0x000AE1C0 File Offset: 0x000AC3C0
public bool ControlEvidence
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlEvidence) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlEvidence;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlEvidence;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to view and manipulate security policy is declared.</summary>
/// <returns>true if permission to manipulate security policy is declared; otherwise, false.</returns>
// Token: 0x170009F4 RID: 2548
// (get) Token: 0x060032A3 RID: 12963 RVA: 0x000AE1EC File Offset: 0x000AC3EC
// (set) Token: 0x060032A4 RID: 12964 RVA: 0x000AE200 File Offset: 0x000AC400
public bool ControlPolicy
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlPolicy) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlPolicy;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlPolicy;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to manipulate the current principal is declared.</summary>
/// <returns>true if permission to manipulate the current principal is declared; otherwise, false.</returns>
// Token: 0x170009F5 RID: 2549
// (get) Token: 0x060032A5 RID: 12965 RVA: 0x000AE22C File Offset: 0x000AC42C
// (set) Token: 0x060032A6 RID: 12966 RVA: 0x000AE240 File Offset: 0x000AC440
public bool ControlPrincipal
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlPrincipal) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlPrincipal;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlPrincipal;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to manipulate threads is declared.</summary>
/// <returns>true if permission to manipulate threads is declared; otherwise, false.</returns>
// Token: 0x170009F6 RID: 2550
// (get) Token: 0x060032A7 RID: 12967 RVA: 0x000AE274 File Offset: 0x000AC474
// (set) Token: 0x060032A8 RID: 12968 RVA: 0x000AE288 File Offset: 0x000AC488
public bool ControlThread
{
get
{
return (this.m_Flags & SecurityPermissionFlag.ControlThread) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.ControlThread;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.ControlThread;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to execute code is declared.</summary>
/// <returns>true if permission to execute code is declared; otherwise, false.</returns>
// Token: 0x170009F7 RID: 2551
// (get) Token: 0x060032A9 RID: 12969 RVA: 0x000AE2B4 File Offset: 0x000AC4B4
// (set) Token: 0x060032AA RID: 12970 RVA: 0x000AE2C4 File Offset: 0x000AC4C4
public bool Execution
{
get
{
return (this.m_Flags & SecurityPermissionFlag.Execution) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.Execution;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.Execution;
}
}
}
/// <summary>Gets or sets a value indicating whether code can plug into the common language runtime infrastructure, such as adding Remoting Context Sinks, Envoy Sinks and Dynamic Sinks.</summary>
/// <returns>true if code can plug into the common language runtime infrastructure; otherwise, false.</returns>
// Token: 0x170009F8 RID: 2552
// (get) Token: 0x060032AB RID: 12971 RVA: 0x000AE2FC File Offset: 0x000AC4FC
// (set) Token: 0x060032AC RID: 12972 RVA: 0x000AE310 File Offset: 0x000AC510
[ComVisible(true)]
public bool Infrastructure
{
get
{
return (this.m_Flags & SecurityPermissionFlag.Infrastructure) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.Infrastructure;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.Infrastructure;
}
}
}
/// <summary>Gets or sets a value indicating whether code can configure remoting types and channels.</summary>
/// <returns>true if code can configure remoting types and channels; otherwise, false.</returns>
// Token: 0x170009F9 RID: 2553
// (get) Token: 0x060032AD RID: 12973 RVA: 0x000AE344 File Offset: 0x000AC544
// (set) Token: 0x060032AE RID: 12974 RVA: 0x000AE358 File Offset: 0x000AC558
public bool RemotingConfiguration
{
get
{
return (this.m_Flags & SecurityPermissionFlag.RemotingConfiguration) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.RemotingConfiguration;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.RemotingConfiguration;
}
}
}
/// <summary>Gets or sets a value indicating whether code can use a serialization formatter to serialize or deserialize an object.</summary>
/// <returns>true if code can use a serialization formatter to serialize or deserialize an object; otherwise, false.</returns>
// Token: 0x170009FA RID: 2554
// (get) Token: 0x060032AF RID: 12975 RVA: 0x000AE38C File Offset: 0x000AC58C
// (set) Token: 0x060032B0 RID: 12976 RVA: 0x000AE3A0 File Offset: 0x000AC5A0
public bool SerializationFormatter
{
get
{
return (this.m_Flags & SecurityPermissionFlag.SerializationFormatter) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.SerializationFormatter;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.SerializationFormatter;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to bypass code verification is declared.</summary>
/// <returns>true if permission to bypass code verification is declared; otherwise, false.</returns>
// Token: 0x170009FB RID: 2555
// (get) Token: 0x060032B1 RID: 12977 RVA: 0x000AE3D4 File Offset: 0x000AC5D4
// (set) Token: 0x060032B2 RID: 12978 RVA: 0x000AE3E4 File Offset: 0x000AC5E4
public bool SkipVerification
{
get
{
return (this.m_Flags & SecurityPermissionFlag.SkipVerification) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.SkipVerification;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.SkipVerification;
}
}
}
/// <summary>Gets or sets a value indicating whether permission to call unmanaged code is declared.</summary>
/// <returns>true if permission to call unmanaged code is declared; otherwise, false.</returns>
// Token: 0x170009FC RID: 2556
// (get) Token: 0x060032B3 RID: 12979 RVA: 0x000AE41C File Offset: 0x000AC61C
// (set) Token: 0x060032B4 RID: 12980 RVA: 0x000AE42C File Offset: 0x000AC62C
public bool UnmanagedCode
{
get
{
return (this.m_Flags & SecurityPermissionFlag.UnmanagedCode) != SecurityPermissionFlag.NoFlags;
}
set
{
if (value)
{
this.m_Flags |= SecurityPermissionFlag.UnmanagedCode;
}
else
{
this.m_Flags &= ~SecurityPermissionFlag.UnmanagedCode;
}
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.SecurityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.SecurityPermission" /> that corresponds to this attribute.</returns>
// Token: 0x060032B5 RID: 12981 RVA: 0x000AE464 File Offset: 0x000AC664
public override IPermission CreatePermission()
{
return null;
}
/// <summary>Gets or sets all permission flags comprising the <see cref="T:System.Security.Permissions.SecurityPermission" /> permissions.</summary>
/// <returns>One or more of the <see cref="T:System.Security.Permissions.SecurityPermissionFlag" /> values combined using a bitwise OR.</returns>
/// <exception cref="T:System.ArgumentException">An attempt is made to set this property to an invalid value. See <see cref="T:System.Security.Permissions.SecurityPermissionFlag" /> for the valid values. </exception>
// Token: 0x170009FD RID: 2557
// (get) Token: 0x060032B6 RID: 12982 RVA: 0x000AE468 File Offset: 0x000AC668
// (set) Token: 0x060032B7 RID: 12983 RVA: 0x000AE470 File Offset: 0x000AC670
public SecurityPermissionFlag Flags
{
get
{
return this.m_Flags;
}
set
{
this.m_Flags = value;
}
}
// Token: 0x040014CC RID: 5324
private SecurityPermissionFlag m_Flags;
}
}
@@ -0,0 +1,63 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies access flags for the security permission object.</summary>
// Token: 0x0200056A RID: 1386
[Flags]
[Obsolete("CAS support is not available with Silverlight applications.")]
[ComVisible(true)]
[Serializable]
public enum SecurityPermissionFlag
{
/// <summary>No security access.</summary>
// Token: 0x040014CE RID: 5326
NoFlags = 0,
/// <summary>Ability to assert that all this code's callers have the requisite permission for the operation.</summary>
// Token: 0x040014CF RID: 5327
Assertion = 1,
/// <summary>Ability to call unmanaged code.</summary>
// Token: 0x040014D0 RID: 5328
UnmanagedCode = 2,
/// <summary>Ability to skip verification of code in this assembly. Code that is unverifiable can be run if this permission is granted.</summary>
// Token: 0x040014D1 RID: 5329
SkipVerification = 4,
/// <summary>Permission for the code to run. Without this permission, managed code will not be executed.</summary>
// Token: 0x040014D2 RID: 5330
Execution = 8,
/// <summary>Ability to use certain advanced operations on threads.</summary>
// Token: 0x040014D3 RID: 5331
ControlThread = 16,
/// <summary>Ability to provide evidence, including the ability to alter the evidence provided by the common language runtime.</summary>
// Token: 0x040014D4 RID: 5332
ControlEvidence = 32,
/// <summary>Ability to view and modify policy.</summary>
// Token: 0x040014D5 RID: 5333
ControlPolicy = 64,
/// <summary>Ability to provide serialization services. Used by serialization formatters.</summary>
// Token: 0x040014D6 RID: 5334
SerializationFormatter = 128,
/// <summary>Ability to specify domain policy.</summary>
// Token: 0x040014D7 RID: 5335
ControlDomainPolicy = 256,
/// <summary>Ability to manipulate the principal object.</summary>
// Token: 0x040014D8 RID: 5336
ControlPrincipal = 512,
/// <summary>Ability to create and manipulate an <see cref="T:System.AppDomain" />.</summary>
// Token: 0x040014D9 RID: 5337
ControlAppDomain = 1024,
/// <summary>Permission to configure Remoting types and channels.</summary>
// Token: 0x040014DA RID: 5338
RemotingConfiguration = 2048,
/// <summary>Permission to plug code into the common language runtime infrastructure, such as adding Remoting Context Sinks, Envoy Sinks and Dynamic Sinks.</summary>
// Token: 0x040014DB RID: 5339
Infrastructure = 4096,
/// <summary>Permission to perform explicit binding redirection in the application configuration file. This includes redirection of .NET Framework assemblies that have been unified as well as other assemblies found outside the .NET Framework.</summary>
// Token: 0x040014DC RID: 5340
BindingRedirects = 8192,
/// <summary>The unrestricted state of the permission.</summary>
// Token: 0x040014DD RID: 5341
AllFlags = 16383
}
}
@@ -0,0 +1,272 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Defines the identity permission for the Web site from which the code originates. This class cannot be inherited.</summary>
// Token: 0x0200056B RID: 1387
[ComVisible(true)]
[Serializable]
public sealed class SiteIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SiteIdentityPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x060032B8 RID: 12984 RVA: 0x000AE47C File Offset: 0x000AC67C
public SiteIdentityPermission(PermissionState state)
{
CodeAccessPermission.CheckPermissionState(state, false);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SiteIdentityPermission" /> class to represent the specified site identity.</summary>
/// <param name="site">The site name or wildcard expression. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="site" /> parameter is not a valid string, or does not match a valid wildcard site name. </exception>
// Token: 0x060032B9 RID: 12985 RVA: 0x000AE48C File Offset: 0x000AC68C
public SiteIdentityPermission(string site)
{
this.Site = site;
}
// Token: 0x060032BB RID: 12987 RVA: 0x000AE4B8 File Offset: 0x000AC6B8
int IBuiltInPermission.GetTokenIndex()
{
return 11;
}
/// <summary>Gets or sets the current site.</summary>
/// <returns>The current site.</returns>
/// <exception cref="T:System.NotSupportedException">The site identity cannot be retrieved because it has an ambiguous identity.</exception>
// Token: 0x170009FE RID: 2558
// (get) Token: 0x060032BC RID: 12988 RVA: 0x000AE4BC File Offset: 0x000AC6BC
// (set) Token: 0x060032BD RID: 12989 RVA: 0x000AE4DC File Offset: 0x000AC6DC
public string Site
{
get
{
if (this.IsEmpty())
{
throw new NullReferenceException("No site.");
}
return this._site;
}
set
{
if (!this.IsValid(value))
{
throw new ArgumentException("Invalid site.");
}
this._site = value;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x060032BE RID: 12990 RVA: 0x000AE4FC File Offset: 0x000AC6FC
public override IPermission Copy()
{
if (this.IsEmpty())
{
return new SiteIdentityPermission(PermissionState.None);
}
return new SiteIdentityPermission(this._site);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x060032BF RID: 12991 RVA: 0x000AE51C File Offset: 0x000AC71C
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
string text = esd.Attribute("Site");
if (text != null)
{
this.Site = text;
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060032C0 RID: 12992 RVA: 0x000AE550 File Offset: 0x000AC750
public override IPermission Intersect(IPermission target)
{
SiteIdentityPermission siteIdentityPermission = this.Cast(target);
if (siteIdentityPermission == null || this.IsEmpty())
{
return null;
}
if (this.Match(siteIdentityPermission._site))
{
string text = ((this._site.Length <= siteIdentityPermission._site.Length) ? siteIdentityPermission._site : this._site);
return new SiteIdentityPermission(text);
}
return null;
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060032C1 RID: 12993 RVA: 0x000AE5C0 File Offset: 0x000AC7C0
public override bool IsSubsetOf(IPermission target)
{
SiteIdentityPermission siteIdentityPermission = this.Cast(target);
if (siteIdentityPermission == null)
{
return this.IsEmpty();
}
if (this._site == null && siteIdentityPermission._site == null)
{
return true;
}
if (this._site == null || siteIdentityPermission._site == null)
{
return false;
}
int num = siteIdentityPermission._site.IndexOf('*');
if (num == -1)
{
return this._site == siteIdentityPermission._site;
}
return this._site.EndsWith(siteIdentityPermission._site.Substring(num + 1));
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x060032C2 RID: 12994 RVA: 0x000AE654 File Offset: 0x000AC854
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this._site != null)
{
securityElement.AddAttribute("Site", this._site);
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The permissions are not equal and one is not a subset of the other.</exception>
// Token: 0x060032C3 RID: 12995 RVA: 0x000AE688 File Offset: 0x000AC888
public override IPermission Union(IPermission target)
{
SiteIdentityPermission siteIdentityPermission = this.Cast(target);
if (siteIdentityPermission == null || siteIdentityPermission.IsEmpty())
{
return this.Copy();
}
if (this.IsEmpty())
{
return siteIdentityPermission.Copy();
}
if (this.Match(siteIdentityPermission._site))
{
string text = ((this._site.Length >= siteIdentityPermission._site.Length) ? siteIdentityPermission._site : this._site);
return new SiteIdentityPermission(text);
}
throw new ArgumentException(Locale.GetText("Cannot union two different sites."), "target");
}
// Token: 0x060032C4 RID: 12996 RVA: 0x000AE720 File Offset: 0x000AC920
private bool IsEmpty()
{
return this._site == null;
}
// Token: 0x060032C5 RID: 12997 RVA: 0x000AE72C File Offset: 0x000AC92C
private SiteIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
SiteIdentityPermission siteIdentityPermission = target as SiteIdentityPermission;
if (siteIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(SiteIdentityPermission));
}
return siteIdentityPermission;
}
// Token: 0x060032C6 RID: 12998 RVA: 0x000AE760 File Offset: 0x000AC960
private bool IsValid(string s)
{
if (s == null || s.Length == 0)
{
return false;
}
for (int i = 0; i < s.Length; i++)
{
ushort num = (ushort)s[i];
if (num < 33 || num > 126)
{
return false;
}
if (num == 42 && s.Length > 1 && (s[i + 1] != '.' || i > 0))
{
return false;
}
if (!SiteIdentityPermission.valid[(int)(num - 33)])
{
return false;
}
}
return s.Length != 1 || s[0] != '.';
}
// Token: 0x060032C7 RID: 12999 RVA: 0x000AE80C File Offset: 0x000ACA0C
private bool Match(string target)
{
if (this._site == null || target == null)
{
return false;
}
int num = this._site.IndexOf('*');
int num2 = target.IndexOf('*');
if (num == -1 && num2 == -1)
{
return this._site == target;
}
if (num == -1)
{
return this._site.EndsWith(target.Substring(num2 + 1));
}
if (num2 == -1)
{
return target.EndsWith(this._site.Substring(num + 1));
}
string text = this._site.Substring(num + 1);
target = target.Substring(num2 + 1);
if (text.Length > target.Length)
{
return text.EndsWith(target);
}
return target.EndsWith(text);
}
// Token: 0x040014DE RID: 5342
private const int version = 1;
// Token: 0x040014DF RID: 5343
private string _site;
// Token: 0x040014E0 RID: 5344
private static bool[] valid = new bool[]
{
true, false, true, true, true, true, true, true, true, true,
false, false, true, true, false, true, true, true, true, true,
true, true, true, true, false, false, false, false, false, false,
false, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, false, false,
false, true, true, false, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true,
true, false, true, true
};
}
}
@@ -0,0 +1,62 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.SiteIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x0200056C RID: 1388
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.SiteIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x060032C8 RID: 13000 RVA: 0x000AE8D0 File Offset: 0x000ACAD0
public SiteIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the site name of the calling code.</summary>
/// <returns>The site name to compare against the site name specified by the security provider.</returns>
// Token: 0x170009FF RID: 2559
// (get) Token: 0x060032C9 RID: 13001 RVA: 0x000AE8DC File Offset: 0x000ACADC
// (set) Token: 0x060032CA RID: 13002 RVA: 0x000AE8E4 File Offset: 0x000ACAE4
public string Site
{
get
{
return this.site;
}
set
{
this.site = value;
}
}
/// <summary>Creates and returns a new instance of <see cref="T:System.Security.Permissions.SiteIdentityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.SiteIdentityPermission" /> that corresponds to this attribute.</returns>
// Token: 0x060032CB RID: 13003 RVA: 0x000AE8F0 File Offset: 0x000ACAF0
public override IPermission CreatePermission()
{
SiteIdentityPermission siteIdentityPermission;
if (base.Unrestricted)
{
siteIdentityPermission = new SiteIdentityPermission(PermissionState.Unrestricted);
}
else if (this.site == null)
{
siteIdentityPermission = new SiteIdentityPermission(PermissionState.None);
}
else
{
siteIdentityPermission = new SiteIdentityPermission(this.site);
}
return siteIdentityPermission;
}
// Token: 0x040014E1 RID: 5345
private string site;
}
}
@@ -0,0 +1,505 @@
using System;
using System.Collections;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Defines the identity permission for strong names. This class cannot be inherited.</summary>
// Token: 0x0200056D RID: 1389
[ComVisible(true)]
[Serializable]
public sealed class StrongNameIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x060032CC RID: 13004 RVA: 0x000AE93C File Offset: 0x000ACB3C
public StrongNameIdentityPermission(PermissionState state)
{
this._state = CodeAccessPermission.CheckPermissionState(state, true);
this._list = new ArrayList();
this._list.Add(StrongNameIdentityPermission.SNIP.CreateDefault());
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" /> class for the specified strong name identity.</summary>
/// <param name="blob">The public key defining the strong name identity namespace. </param>
/// <param name="name">The simple name part of the strong name identity. This corresponds to the name of the assembly. </param>
/// <param name="version">The version number of the identity. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="blob" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="name" /> parameter is an empty string ("").</exception>
// Token: 0x060032CD RID: 13005 RVA: 0x000AE980 File Offset: 0x000ACB80
public StrongNameIdentityPermission(StrongNamePublicKeyBlob blob, string name, Version version)
{
if (blob == null)
{
throw new ArgumentNullException("blob");
}
if (name != null && name.Length == 0)
{
throw new ArgumentException("name");
}
this._state = PermissionState.None;
this._list = new ArrayList();
this._list.Add(new StrongNameIdentityPermission.SNIP(blob, name, version));
}
// Token: 0x060032CE RID: 13006 RVA: 0x000AE9EC File Offset: 0x000ACBEC
internal StrongNameIdentityPermission(StrongNameIdentityPermission snip)
{
this._state = snip._state;
this._list = new ArrayList(snip._list.Count);
foreach (object obj in snip._list)
{
StrongNameIdentityPermission.SNIP snip2 = (StrongNameIdentityPermission.SNIP)obj;
this._list.Add(new StrongNameIdentityPermission.SNIP(snip2.PublicKey, snip2.Name, snip2.AssemblyVersion));
}
}
// Token: 0x060032D0 RID: 13008 RVA: 0x000AEAB8 File Offset: 0x000ACCB8
int IBuiltInPermission.GetTokenIndex()
{
return 12;
}
/// <summary>Gets or sets the simple name portion of the strong name identity.</summary>
/// <returns>The simple name of the identity.</returns>
/// <exception cref="T:System.ArgumentException">The value is an empty string ("").</exception>
/// <exception cref="T:System.NotSupportedException">The property value cannot be retrieved because it contains an ambiguous identity. </exception>
// Token: 0x17000A00 RID: 2560
// (get) Token: 0x060032D1 RID: 13009 RVA: 0x000AEABC File Offset: 0x000ACCBC
// (set) Token: 0x060032D2 RID: 13010 RVA: 0x000AEAFC File Offset: 0x000ACCFC
public string Name
{
get
{
if (this._list.Count > 1)
{
throw new NotSupportedException();
}
return ((StrongNameIdentityPermission.SNIP)this._list[0]).Name;
}
set
{
if (value != null && value.Length == 0)
{
throw new ArgumentException("name");
}
if (this._list.Count > 1)
{
this.ResetToDefault();
}
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)this._list[0];
snip.Name = value;
this._list[0] = snip;
}
}
/// <summary>Gets or sets the public key blob that defines the strong name identity namespace.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.StrongNamePublicKeyBlob" /> that contains the public key of the identity, or null if there is no key.</returns>
/// <exception cref="T:System.ArgumentNullException">The property value is set to null. </exception>
/// <exception cref="T:System.NotSupportedException">The property value cannot be retrieved because it contains an ambiguous identity. </exception>
// Token: 0x17000A01 RID: 2561
// (get) Token: 0x060032D3 RID: 13011 RVA: 0x000AEB68 File Offset: 0x000ACD68
// (set) Token: 0x060032D4 RID: 13012 RVA: 0x000AEBA8 File Offset: 0x000ACDA8
public StrongNamePublicKeyBlob PublicKey
{
get
{
if (this._list.Count > 1)
{
throw new NotSupportedException();
}
return ((StrongNameIdentityPermission.SNIP)this._list[0]).PublicKey;
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (this._list.Count > 1)
{
this.ResetToDefault();
}
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)this._list[0];
snip.PublicKey = value;
this._list[0] = snip;
}
}
/// <summary>Gets or sets the version number of the identity.</summary>
/// <returns>The version of the identity.</returns>
/// <exception cref="T:System.NotSupportedException">The property value cannot be retrieved because it contains an ambiguous identity. </exception>
// Token: 0x17000A02 RID: 2562
// (get) Token: 0x060032D5 RID: 13013 RVA: 0x000AEC0C File Offset: 0x000ACE0C
// (set) Token: 0x060032D6 RID: 13014 RVA: 0x000AEC4C File Offset: 0x000ACE4C
public Version Version
{
get
{
if (this._list.Count > 1)
{
throw new NotSupportedException();
}
return ((StrongNameIdentityPermission.SNIP)this._list[0]).AssemblyVersion;
}
set
{
if (this._list.Count > 1)
{
this.ResetToDefault();
}
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)this._list[0];
snip.AssemblyVersion = value;
this._list[0] = snip;
}
}
// Token: 0x060032D7 RID: 13015 RVA: 0x000AEC9C File Offset: 0x000ACE9C
internal void ResetToDefault()
{
this._list.Clear();
this._list.Add(StrongNameIdentityPermission.SNIP.CreateDefault());
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x060032D8 RID: 13016 RVA: 0x000AECC0 File Offset: 0x000ACEC0
public override IPermission Copy()
{
if (this.IsEmpty())
{
return new StrongNameIdentityPermission(PermissionState.None);
}
return new StrongNameIdentityPermission(this);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="e">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid permission element.-or- The <paramref name="e" /> parameter's version number is not valid. </exception>
// Token: 0x060032D9 RID: 13017 RVA: 0x000AECDC File Offset: 0x000ACEDC
public override void FromXml(SecurityElement e)
{
CodeAccessPermission.CheckSecurityElement(e, "e", 1, 1);
this._list.Clear();
if (e.Children != null && e.Children.Count > 0)
{
foreach (object obj in e.Children)
{
SecurityElement securityElement = (SecurityElement)obj;
this._list.Add(this.FromSecurityElement(securityElement));
}
}
else
{
this._list.Add(this.FromSecurityElement(e));
}
}
// Token: 0x060032DA RID: 13018 RVA: 0x000AEDB0 File Offset: 0x000ACFB0
private StrongNameIdentityPermission.SNIP FromSecurityElement(SecurityElement se)
{
string text = se.Attribute("Name");
StrongNamePublicKeyBlob strongNamePublicKeyBlob = StrongNamePublicKeyBlob.FromString(se.Attribute("PublicKeyBlob"));
string text2 = se.Attribute("AssemblyVersion");
Version version = ((text2 != null) ? new Version(text2) : null);
return new StrongNameIdentityPermission.SNIP(strongNamePublicKeyBlob, text, version);
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission, or null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060032DB RID: 13019 RVA: 0x000AEE04 File Offset: 0x000AD004
public override IPermission Intersect(IPermission target)
{
if (target == null)
{
return null;
}
StrongNameIdentityPermission strongNameIdentityPermission = target as StrongNameIdentityPermission;
if (strongNameIdentityPermission == null)
{
throw new ArgumentException(Locale.GetText("Wrong permission type."));
}
if (this.IsEmpty() || strongNameIdentityPermission.IsEmpty())
{
return null;
}
if (!this.Match(strongNameIdentityPermission.Name))
{
return null;
}
string text = ((this.Name.Length >= strongNameIdentityPermission.Name.Length) ? strongNameIdentityPermission.Name : this.Name);
if (!this.Version.Equals(strongNameIdentityPermission.Version))
{
return null;
}
if (!this.PublicKey.Equals(strongNameIdentityPermission.PublicKey))
{
return null;
}
return new StrongNameIdentityPermission(this.PublicKey, text, this.Version);
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x060032DC RID: 13020 RVA: 0x000AEED0 File Offset: 0x000AD0D0
public override bool IsSubsetOf(IPermission target)
{
StrongNameIdentityPermission strongNameIdentityPermission = this.Cast(target);
if (strongNameIdentityPermission == null)
{
return this.IsEmpty();
}
if (this.IsEmpty())
{
return true;
}
if (this.IsUnrestricted())
{
return strongNameIdentityPermission.IsUnrestricted();
}
if (strongNameIdentityPermission.IsUnrestricted())
{
return true;
}
foreach (object obj in this._list)
{
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)obj;
foreach (object obj2 in strongNameIdentityPermission._list)
{
StrongNameIdentityPermission.SNIP snip2 = (StrongNameIdentityPermission.SNIP)obj2;
if (!snip.IsSubsetOf(snip2))
{
return false;
}
}
}
return true;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x060032DD RID: 13021 RVA: 0x000AEFF4 File Offset: 0x000AD1F4
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this._list.Count > 1)
{
foreach (object obj in this._list)
{
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)obj;
SecurityElement securityElement2 = new SecurityElement("StrongName");
this.ToSecurityElement(securityElement2, snip);
securityElement.AddChild(securityElement2);
}
}
else if (this._list.Count == 1)
{
StrongNameIdentityPermission.SNIP snip2 = (StrongNameIdentityPermission.SNIP)this._list[0];
if (!this.IsEmpty(snip2))
{
this.ToSecurityElement(securityElement, snip2);
}
}
return securityElement;
}
// Token: 0x060032DE RID: 13022 RVA: 0x000AF0D4 File Offset: 0x000AD2D4
private void ToSecurityElement(SecurityElement se, StrongNameIdentityPermission.SNIP snip)
{
if (snip.PublicKey != null)
{
se.AddAttribute("PublicKeyBlob", snip.PublicKey.ToString());
}
if (snip.Name != null)
{
se.AddAttribute("Name", snip.Name);
}
if (snip.AssemblyVersion != null)
{
se.AddAttribute("AssemblyVersion", snip.AssemblyVersion.ToString());
}
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The two permissions are not equal and one is a subset of the other.</exception>
// Token: 0x060032DF RID: 13023 RVA: 0x000AF14C File Offset: 0x000AD34C
public override IPermission Union(IPermission target)
{
StrongNameIdentityPermission strongNameIdentityPermission = this.Cast(target);
if (strongNameIdentityPermission == null || strongNameIdentityPermission.IsEmpty())
{
return this.Copy();
}
if (this.IsEmpty())
{
return strongNameIdentityPermission.Copy();
}
StrongNameIdentityPermission strongNameIdentityPermission2 = (StrongNameIdentityPermission)this.Copy();
foreach (object obj in strongNameIdentityPermission._list)
{
StrongNameIdentityPermission.SNIP snip = (StrongNameIdentityPermission.SNIP)obj;
if (!this.IsEmpty(snip) && !this.Contains(snip))
{
strongNameIdentityPermission2._list.Add(snip);
}
}
return strongNameIdentityPermission2;
}
// Token: 0x060032E0 RID: 13024 RVA: 0x000AF220 File Offset: 0x000AD420
private bool IsUnrestricted()
{
return this._state == PermissionState.Unrestricted;
}
// Token: 0x060032E1 RID: 13025 RVA: 0x000AF22C File Offset: 0x000AD42C
private bool Contains(StrongNameIdentityPermission.SNIP snip)
{
foreach (object obj in this._list)
{
StrongNameIdentityPermission.SNIP snip2 = (StrongNameIdentityPermission.SNIP)obj;
bool flag = (snip2.PublicKey == null && snip.PublicKey == null) || (snip2.PublicKey != null && snip2.PublicKey.Equals(snip.PublicKey));
bool flag2 = snip2.IsNameSubsetOf(snip.Name);
bool flag3 = (snip2.AssemblyVersion == null && snip.AssemblyVersion == null) || (snip2.AssemblyVersion != null && snip2.AssemblyVersion.Equals(snip.AssemblyVersion));
if (flag && flag2 && flag3)
{
return true;
}
}
return false;
}
// Token: 0x060032E2 RID: 13026 RVA: 0x000AF354 File Offset: 0x000AD554
private bool IsEmpty(StrongNameIdentityPermission.SNIP snip)
{
return this.PublicKey == null && (this.Name == null || this.Name.Length <= 0) && (this.Version == null || StrongNameIdentityPermission.defaultVersion.Equals(this.Version));
}
// Token: 0x060032E3 RID: 13027 RVA: 0x000AF3B0 File Offset: 0x000AD5B0
private bool IsEmpty()
{
return !this.IsUnrestricted() && this._list.Count <= 1 && this.PublicKey == null && (this.Name == null || this.Name.Length <= 0) && (this.Version == null || StrongNameIdentityPermission.defaultVersion.Equals(this.Version));
}
// Token: 0x060032E4 RID: 13028 RVA: 0x000AF42C File Offset: 0x000AD62C
private StrongNameIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
StrongNameIdentityPermission strongNameIdentityPermission = target as StrongNameIdentityPermission;
if (strongNameIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(StrongNameIdentityPermission));
}
return strongNameIdentityPermission;
}
// Token: 0x060032E5 RID: 13029 RVA: 0x000AF460 File Offset: 0x000AD660
private bool Match(string target)
{
if (this.Name == null || target == null)
{
return false;
}
int num = this.Name.LastIndexOf('*');
int num2 = target.LastIndexOf('*');
int num3;
if (num == -1 && num2 == -1)
{
num3 = Math.Max(this.Name.Length, target.Length);
}
else if (num == -1)
{
num3 = num2;
}
else if (num2 == -1)
{
num3 = num;
}
else
{
num3 = Math.Min(num, num2);
}
return string.Compare(this.Name, 0, target, 0, num3, true, CultureInfo.InvariantCulture) == 0;
}
// Token: 0x040014E2 RID: 5346
private const int version = 1;
// Token: 0x040014E3 RID: 5347
private static Version defaultVersion = new Version(0, 0);
// Token: 0x040014E4 RID: 5348
private PermissionState _state;
// Token: 0x040014E5 RID: 5349
private ArrayList _list;
// Token: 0x0200056E RID: 1390
private struct SNIP
{
// Token: 0x060032E6 RID: 13030 RVA: 0x000AF504 File Offset: 0x000AD704
internal SNIP(StrongNamePublicKeyBlob pk, string name, Version version)
{
this.PublicKey = pk;
this.Name = name;
this.AssemblyVersion = version;
}
// Token: 0x060032E7 RID: 13031 RVA: 0x000AF51C File Offset: 0x000AD71C
internal static StrongNameIdentityPermission.SNIP CreateDefault()
{
return new StrongNameIdentityPermission.SNIP(null, string.Empty, (Version)StrongNameIdentityPermission.defaultVersion.Clone());
}
// Token: 0x060032E8 RID: 13032 RVA: 0x000AF538 File Offset: 0x000AD738
internal bool IsNameSubsetOf(string target)
{
if (this.Name == null)
{
return target == null;
}
if (target == null)
{
return true;
}
int num = this.Name.LastIndexOf('*');
if (num == 0)
{
return true;
}
if (num == -1)
{
num = this.Name.Length;
}
return string.Compare(this.Name, 0, target, 0, num, true, CultureInfo.InvariantCulture) == 0;
}
// Token: 0x060032E9 RID: 13033 RVA: 0x000AF5A0 File Offset: 0x000AD7A0
internal bool IsSubsetOf(StrongNameIdentityPermission.SNIP target)
{
return (this.PublicKey != null && this.PublicKey.Equals(target.PublicKey)) || (this.IsNameSubsetOf(target.Name) && (!(this.AssemblyVersion != null) || this.AssemblyVersion.Equals(target.AssemblyVersion)) && this.PublicKey == null && target.PublicKey == null);
}
// Token: 0x040014E6 RID: 5350
public StrongNamePublicKeyBlob PublicKey;
// Token: 0x040014E7 RID: 5351
public string Name;
// Token: 0x040014E8 RID: 5352
public Version AssemblyVersion;
}
}
}
@@ -0,0 +1,90 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x0200056F RID: 1391
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class StrongNameIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.StrongNameIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x060032EA RID: 13034 RVA: 0x000AF628 File Offset: 0x000AD828
public StrongNameIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the name of the strong name identity.</summary>
/// <returns>A name to compare against the name specified by the security provider.</returns>
// Token: 0x17000A03 RID: 2563
// (get) Token: 0x060032EB RID: 13035 RVA: 0x000AF634 File Offset: 0x000AD834
// (set) Token: 0x060032EC RID: 13036 RVA: 0x000AF63C File Offset: 0x000AD83C
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>Gets or sets the public key value of the strong name identity expressed as a hexadecimal string.</summary>
/// <returns>The public key value of the strong name identity expressed as a hexadecimal string.</returns>
// Token: 0x17000A04 RID: 2564
// (get) Token: 0x060032ED RID: 13037 RVA: 0x000AF648 File Offset: 0x000AD848
// (set) Token: 0x060032EE RID: 13038 RVA: 0x000AF650 File Offset: 0x000AD850
public string PublicKey
{
get
{
return this.key;
}
set
{
this.key = value;
}
}
/// <summary>Gets or sets the version of the strong name identity.</summary>
/// <returns>The version number of the strong name identity.</returns>
// Token: 0x17000A05 RID: 2565
// (get) Token: 0x060032EF RID: 13039 RVA: 0x000AF65C File Offset: 0x000AD85C
// (set) Token: 0x060032F0 RID: 13040 RVA: 0x000AF664 File Offset: 0x000AD864
public string Version
{
get
{
return this.version;
}
set
{
this.version = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.StrongNameIdentityPermission" /> that corresponds to this attribute.</returns>
/// <exception cref="T:System.ArgumentException">The method failed because the key is null.</exception>
// Token: 0x060032F1 RID: 13041 RVA: 0x000AF670 File Offset: 0x000AD870
public override IPermission CreatePermission()
{
return null;
}
// Token: 0x040014E9 RID: 5353
private string name;
// Token: 0x040014EA RID: 5354
private string key;
// Token: 0x040014EB RID: 5355
private string version;
}
}
@@ -0,0 +1,115 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace System.Security.Permissions
{
/// <summary>Represents the public key information (called a blob) for a strong name. This class cannot be inherited.</summary>
// Token: 0x02000570 RID: 1392
[ComVisible(true)]
[Serializable]
public sealed class StrongNamePublicKeyBlob
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.StrongNamePublicKeyBlob" /> class with raw bytes of the public key blob.</summary>
/// <param name="publicKey">The array of bytes representing the raw public key data. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="publicKey" /> parameter is null. </exception>
// Token: 0x060032F2 RID: 13042 RVA: 0x000AF674 File Offset: 0x000AD874
public StrongNamePublicKeyBlob(byte[] publicKey)
{
if (publicKey == null)
{
throw new ArgumentNullException("publicKey");
}
this.pubkey = publicKey;
}
// Token: 0x060032F3 RID: 13043 RVA: 0x000AF694 File Offset: 0x000AD894
internal static StrongNamePublicKeyBlob FromString(string s)
{
if (s == null || s.Length == 0)
{
return null;
}
int num = s.Length / 2;
byte[] array = new byte[num];
int i = 0;
int num2 = 0;
while (i < s.Length)
{
byte b = StrongNamePublicKeyBlob.CharToByte(s[i]);
byte b2 = StrongNamePublicKeyBlob.CharToByte(s[i + 1]);
array[num2] = Convert.ToByte((int)(b * 16 + b2));
i += 2;
num2++;
}
return new StrongNamePublicKeyBlob(array);
}
// Token: 0x060032F4 RID: 13044 RVA: 0x000AF718 File Offset: 0x000AD918
private static byte CharToByte(char c)
{
char c2 = char.ToLowerInvariant(c);
if (char.IsDigit(c2))
{
return (byte)(c2 - '0');
}
return (byte)(c2 - 'a' + '\n');
}
/// <summary>Gets or sets a value indicating whether the current public key blob is equal to the specified public key blob.</summary>
/// <returns>true if the public key blob of the current object is equal to the public key blob of the <paramref name="obj" /> parameter; otherwise, false.</returns>
/// <param name="obj">An object containing a public key blob. </param>
// Token: 0x060032F5 RID: 13045 RVA: 0x000AF748 File Offset: 0x000AD948
public override bool Equals(object obj)
{
StrongNamePublicKeyBlob strongNamePublicKeyBlob = obj as StrongNamePublicKeyBlob;
if (strongNamePublicKeyBlob == null)
{
return false;
}
bool flag = this.pubkey.Length == strongNamePublicKeyBlob.pubkey.Length;
if (flag)
{
for (int i = 0; i < this.pubkey.Length; i++)
{
if (this.pubkey[i] != strongNamePublicKeyBlob.pubkey[i])
{
return false;
}
}
}
return flag;
}
/// <summary>Returns a hash code based on the public key.</summary>
/// <returns>The hash code based on the public key.</returns>
// Token: 0x060032F6 RID: 13046 RVA: 0x000AF7B0 File Offset: 0x000AD9B0
public override int GetHashCode()
{
int num = 0;
int i = 0;
int num2 = Math.Min(this.pubkey.Length, 4);
while (i < num2)
{
num = (num << 8) + (int)this.pubkey[i++];
}
return num;
}
/// <summary>Creates and returns a string representation of the public key blob.</summary>
/// <returns>A hexadecimal version of the public key blob.</returns>
// Token: 0x060032F7 RID: 13047 RVA: 0x000AF7F0 File Offset: 0x000AD9F0
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < this.pubkey.Length; i++)
{
stringBuilder.Append(this.pubkey[i].ToString("X2"));
}
return stringBuilder.ToString();
}
// Token: 0x040014EC RID: 5356
internal byte[] pubkey;
}
}
@@ -0,0 +1,267 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Controls the permissions related to user interfaces and the clipboard. This class cannot be inherited.</summary>
// Token: 0x02000571 RID: 1393
[ComVisible(true)]
[Serializable]
public sealed class UIPermission : CodeAccessPermission, IBuiltInPermission, IUnrestrictedPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UIPermission" /> class with either fully restricted or unrestricted access, as specified.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x060032F8 RID: 13048 RVA: 0x000AF840 File Offset: 0x000ADA40
public UIPermission(PermissionState state)
{
if (CodeAccessPermission.CheckPermissionState(state, true) == PermissionState.Unrestricted)
{
this._clipboard = UIPermissionClipboard.AllClipboard;
this._window = UIPermissionWindow.AllWindows;
}
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UIPermission" /> class with the permissions for the clipboard, and no access to windows.</summary>
/// <param name="clipboardFlag">One of the <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="clipboardFlag" /> parameter is not a valid <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> value. </exception>
// Token: 0x060032F9 RID: 13049 RVA: 0x000AF864 File Offset: 0x000ADA64
public UIPermission(UIPermissionClipboard clipboardFlag)
{
this.Clipboard = clipboardFlag;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UIPermission" /> class with the permissions for windows, and no access to the clipboard.</summary>
/// <param name="windowFlag">One of the <see cref="T:System.Security.Permissions.UIPermissionWindow" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="windowFlag" /> parameter is not a valid <see cref="T:System.Security.Permissions.UIPermissionWindow" /> value. </exception>
// Token: 0x060032FA RID: 13050 RVA: 0x000AF874 File Offset: 0x000ADA74
public UIPermission(UIPermissionWindow windowFlag)
{
this.Window = windowFlag;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UIPermission" /> class with the specified permissions for windows and the clipboard.</summary>
/// <param name="windowFlag">One of the <see cref="T:System.Security.Permissions.UIPermissionWindow" /> values. </param>
/// <param name="clipboardFlag">One of the <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="windowFlag" /> parameter is not a valid <see cref="T:System.Security.Permissions.UIPermissionWindow" /> value.-or- The <paramref name="clipboardFlag" /> parameter is not a valid <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> value. </exception>
// Token: 0x060032FB RID: 13051 RVA: 0x000AF884 File Offset: 0x000ADA84
public UIPermission(UIPermissionWindow windowFlag, UIPermissionClipboard clipboardFlag)
{
this.Clipboard = clipboardFlag;
this.Window = windowFlag;
}
// Token: 0x060032FC RID: 13052 RVA: 0x000AF89C File Offset: 0x000ADA9C
int IBuiltInPermission.GetTokenIndex()
{
return 7;
}
/// <summary>Gets or sets the clipboard access represented by the permission.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> values.</returns>
// Token: 0x17000A06 RID: 2566
// (get) Token: 0x060032FD RID: 13053 RVA: 0x000AF8A0 File Offset: 0x000ADAA0
// (set) Token: 0x060032FE RID: 13054 RVA: 0x000AF8A8 File Offset: 0x000ADAA8
public UIPermissionClipboard Clipboard
{
get
{
return this._clipboard;
}
set
{
if (!Enum.IsDefined(typeof(UIPermissionClipboard), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "UIPermissionClipboard");
}
this._clipboard = value;
}
}
/// <summary>Gets or sets the window access represented by the permission.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.UIPermissionWindow" /> values.</returns>
// Token: 0x17000A07 RID: 2567
// (get) Token: 0x060032FF RID: 13055 RVA: 0x000AF8F8 File Offset: 0x000ADAF8
// (set) Token: 0x06003300 RID: 13056 RVA: 0x000AF900 File Offset: 0x000ADB00
public UIPermissionWindow Window
{
get
{
return this._window;
}
set
{
if (!Enum.IsDefined(typeof(UIPermissionWindow), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "UIPermissionWindow");
}
this._window = value;
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003301 RID: 13057 RVA: 0x000AF950 File Offset: 0x000ADB50
public override IPermission Copy()
{
return new UIPermission(this._window, this._clipboard);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding used to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x06003302 RID: 13058 RVA: 0x000AF964 File Offset: 0x000ADB64
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
if (CodeAccessPermission.IsUnrestricted(esd))
{
this._window = UIPermissionWindow.AllWindows;
this._clipboard = UIPermissionClipboard.AllClipboard;
}
else
{
string text = esd.Attribute("Window");
if (text == null)
{
this._window = UIPermissionWindow.NoWindows;
}
else
{
this._window = (UIPermissionWindow)((int)Enum.Parse(typeof(UIPermissionWindow), text));
}
string text2 = esd.Attribute("Clipboard");
if (text2 == null)
{
this._clipboard = UIPermissionClipboard.NoClipboard;
}
else
{
this._clipboard = (UIPermissionClipboard)((int)Enum.Parse(typeof(UIPermissionClipboard), text2));
}
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003303 RID: 13059 RVA: 0x000AFA10 File Offset: 0x000ADC10
public override IPermission Intersect(IPermission target)
{
UIPermission uipermission = this.Cast(target);
if (uipermission == null)
{
return null;
}
UIPermissionWindow uipermissionWindow = ((this._window >= uipermission._window) ? uipermission._window : this._window);
UIPermissionClipboard uipermissionClipboard = ((this._clipboard >= uipermission._clipboard) ? uipermission._clipboard : this._clipboard);
if (this.IsEmpty(uipermissionWindow, uipermissionClipboard))
{
return null;
}
return new UIPermission(uipermissionWindow, uipermissionClipboard);
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission to test for the subset relationship. This permission must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003304 RID: 13060 RVA: 0x000AFA8C File Offset: 0x000ADC8C
public override bool IsSubsetOf(IPermission target)
{
UIPermission uipermission = this.Cast(target);
if (uipermission == null)
{
return this.IsEmpty(this._window, this._clipboard);
}
return uipermission.IsUnrestricted() || (this._window <= uipermission._window && this._clipboard <= uipermission._clipboard);
}
/// <summary>Returns a value indicating whether the current permission is unrestricted.</summary>
/// <returns>true if the current permission is unrestricted; otherwise, false.</returns>
// Token: 0x06003305 RID: 13061 RVA: 0x000AFAEC File Offset: 0x000ADCEC
public bool IsUnrestricted()
{
return this._window == UIPermissionWindow.AllWindows && this._clipboard == UIPermissionClipboard.AllClipboard;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003306 RID: 13062 RVA: 0x000AFB08 File Offset: 0x000ADD08
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this._window == UIPermissionWindow.AllWindows && this._clipboard == UIPermissionClipboard.AllClipboard)
{
securityElement.AddAttribute("Unrestricted", "true");
}
else
{
if (this._window != UIPermissionWindow.NoWindows)
{
securityElement.AddAttribute("Window", this._window.ToString());
}
if (this._clipboard != UIPermissionClipboard.NoClipboard)
{
securityElement.AddAttribute("Clipboard", this._clipboard.ToString());
}
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003307 RID: 13063 RVA: 0x000AFB98 File Offset: 0x000ADD98
public override IPermission Union(IPermission target)
{
UIPermission uipermission = this.Cast(target);
if (uipermission == null)
{
return this.Copy();
}
UIPermissionWindow uipermissionWindow = ((this._window <= uipermission._window) ? uipermission._window : this._window);
UIPermissionClipboard uipermissionClipboard = ((this._clipboard <= uipermission._clipboard) ? uipermission._clipboard : this._clipboard);
if (this.IsEmpty(uipermissionWindow, uipermissionClipboard))
{
return null;
}
return new UIPermission(uipermissionWindow, uipermissionClipboard);
}
// Token: 0x06003308 RID: 13064 RVA: 0x000AFC18 File Offset: 0x000ADE18
private bool IsEmpty(UIPermissionWindow w, UIPermissionClipboard c)
{
return w == UIPermissionWindow.NoWindows && c == UIPermissionClipboard.NoClipboard;
}
// Token: 0x06003309 RID: 13065 RVA: 0x000AFC28 File Offset: 0x000ADE28
private UIPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
UIPermission uipermission = target as UIPermission;
if (uipermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(UIPermission));
}
return uipermission;
}
// Token: 0x040014ED RID: 5357
private const int version = 1;
// Token: 0x040014EE RID: 5358
private UIPermissionWindow _window;
// Token: 0x040014EF RID: 5359
private UIPermissionClipboard _clipboard;
}
}
@@ -0,0 +1,78 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.UIPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000572 RID: 1394
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class UIPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UIPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600330A RID: 13066 RVA: 0x000AFC5C File Offset: 0x000ADE5C
public UIPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the type of access to the clipboard that is permitted.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.UIPermissionClipboard" /> values.</returns>
// Token: 0x17000A08 RID: 2568
// (get) Token: 0x0600330B RID: 13067 RVA: 0x000AFC68 File Offset: 0x000ADE68
// (set) Token: 0x0600330C RID: 13068 RVA: 0x000AFC70 File Offset: 0x000ADE70
public UIPermissionClipboard Clipboard
{
get
{
return this.clipboard;
}
set
{
this.clipboard = value;
}
}
/// <summary>Gets or sets the type of access to the window resources that is permitted.</summary>
/// <returns>One of the <see cref="T:System.Security.Permissions.UIPermissionWindow" /> values.</returns>
// Token: 0x17000A09 RID: 2569
// (get) Token: 0x0600330D RID: 13069 RVA: 0x000AFC7C File Offset: 0x000ADE7C
// (set) Token: 0x0600330E RID: 13070 RVA: 0x000AFC84 File Offset: 0x000ADE84
public UIPermissionWindow Window
{
get
{
return this.window;
}
set
{
this.window = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.UIPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.UIPermission" /> that corresponds to this attribute.</returns>
// Token: 0x0600330F RID: 13071 RVA: 0x000AFC90 File Offset: 0x000ADE90
public override IPermission CreatePermission()
{
UIPermission uipermission;
if (base.Unrestricted)
{
uipermission = new UIPermission(PermissionState.Unrestricted);
}
else
{
uipermission = new UIPermission(this.window, this.clipboard);
}
return uipermission;
}
// Token: 0x040014F0 RID: 5360
private UIPermissionClipboard clipboard;
// Token: 0x040014F1 RID: 5361
private UIPermissionWindow window;
}
}
@@ -0,0 +1,22 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the type of clipboard access that is allowed to the calling code.</summary>
// Token: 0x02000573 RID: 1395
[ComVisible(true)]
[Serializable]
public enum UIPermissionClipboard
{
/// <summary>Clipboard cannot be used.</summary>
// Token: 0x040014F3 RID: 5363
NoClipboard,
/// <summary>The ability to put data on the clipboard (Copy, Cut) is unrestricted. Intrinsic controls that accept Paste, such as text box, can accept the clipboard data, but user controls that must programmatically read the clipboard cannot.</summary>
// Token: 0x040014F4 RID: 5364
OwnClipboard,
/// <summary>Clipboard can be used without restriction.</summary>
// Token: 0x040014F5 RID: 5365
AllClipboard
}
}
@@ -0,0 +1,25 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Specifies the type of windows that code is allowed to use.</summary>
// Token: 0x02000574 RID: 1396
[ComVisible(true)]
[Serializable]
public enum UIPermissionWindow
{
/// <summary>Users cannot use any windows or user interface events. No user interface can be used.</summary>
// Token: 0x040014F7 RID: 5367
NoWindows,
/// <summary>Users can only use <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeSubWindows" /> for drawing, and can only use user input events for user interface within that subwindow. Examples of <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeSubWindows" /> are a <see cref="T:System.Windows.Forms.MessageBox" />, common dialog controls, and a control displayed within a browser.</summary>
// Token: 0x040014F8 RID: 5368
SafeSubWindows,
/// <summary>Users can only use <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeTopLevelWindows" /> and <see cref="F:System.Security.Permissions.UIPermissionWindow.SafeSubWindows" /> for drawing, and can only use user input events for the user interface within those top-level windows and subwindows. </summary>
// Token: 0x040014F9 RID: 5369
SafeTopLevelWindows,
/// <summary>Users can use all windows and user input events without restriction.</summary>
// Token: 0x040014FA RID: 5370
AllWindows
}
}
@@ -0,0 +1,251 @@
using System;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Defines the identity permission for the URL from which the code originates. This class cannot be inherited.</summary>
// Token: 0x02000575 RID: 1397
[ComVisible(true)]
[Serializable]
public sealed class UrlIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UrlIdentityPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003310 RID: 13072 RVA: 0x000AFCCC File Offset: 0x000ADECC
public UrlIdentityPermission(PermissionState state)
{
CodeAccessPermission.CheckPermissionState(state, false);
this.url = string.Empty;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UrlIdentityPermission" /> class to represent the URL identity described by <paramref name="site" />.</summary>
/// <param name="site">A URL or wildcard expression. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="site" /> parameter is null. </exception>
/// <exception cref="T:System.FormatException">The length of the <paramref name="site" /> parameter is zero. </exception>
/// <exception cref="T:System.ArgumentException">The URL, directory, or site portion of the <paramref name="site" /> parameter is not valid. </exception>
// Token: 0x06003311 RID: 13073 RVA: 0x000AFCE8 File Offset: 0x000ADEE8
public UrlIdentityPermission(string site)
{
if (site == null)
{
throw new ArgumentNullException("site");
}
this.url = site;
}
// Token: 0x06003312 RID: 13074 RVA: 0x000AFD08 File Offset: 0x000ADF08
int IBuiltInPermission.GetTokenIndex()
{
return 13;
}
/// <summary>Gets or sets a URL representing the identity of Internet code.</summary>
/// <returns>A URL representing the identity of Internet code.</returns>
/// <exception cref="T:System.NotSupportedException">The URL cannot be retrieved because it has an ambiguous identity.</exception>
// Token: 0x17000A0A RID: 2570
// (get) Token: 0x06003313 RID: 13075 RVA: 0x000AFD0C File Offset: 0x000ADF0C
// (set) Token: 0x06003314 RID: 13076 RVA: 0x000AFD14 File Offset: 0x000ADF14
public string Url
{
get
{
return this.url;
}
set
{
this.url = ((value != null) ? value : string.Empty);
}
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003315 RID: 13077 RVA: 0x000AFD30 File Offset: 0x000ADF30
public override IPermission Copy()
{
if (this.url == null)
{
return new UrlIdentityPermission(PermissionState.None);
}
return new UrlIdentityPermission(this.url);
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x06003316 RID: 13078 RVA: 0x000AFD50 File Offset: 0x000ADF50
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
string text = esd.Attribute("Url");
if (text == null)
{
this.url = string.Empty;
}
else
{
this.Url = text;
}
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The Url property is not a valid URL.</exception>
// Token: 0x06003317 RID: 13079 RVA: 0x000AFD94 File Offset: 0x000ADF94
public override IPermission Intersect(IPermission target)
{
UrlIdentityPermission urlIdentityPermission = this.Cast(target);
if (urlIdentityPermission == null || this.IsEmpty())
{
return null;
}
if (!this.Match(urlIdentityPermission.url))
{
return null;
}
if (this.url.Length > urlIdentityPermission.url.Length)
{
return this.Copy();
}
return urlIdentityPermission.Copy();
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The Url property is not a valid URL.</exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x06003318 RID: 13080 RVA: 0x000AFDF8 File Offset: 0x000ADFF8
public override bool IsSubsetOf(IPermission target)
{
UrlIdentityPermission urlIdentityPermission = this.Cast(target);
if (urlIdentityPermission == null)
{
return this.IsEmpty();
}
if (this.IsEmpty())
{
return true;
}
if (urlIdentityPermission.url == null)
{
return false;
}
int num = urlIdentityPermission.url.LastIndexOf('*');
if (num == -1)
{
num = urlIdentityPermission.url.Length;
}
return string.Compare(this.url, 0, urlIdentityPermission.url, 0, num, true, CultureInfo.InvariantCulture) == 0;
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x06003319 RID: 13081 RVA: 0x000AFE74 File Offset: 0x000AE074
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (!this.IsEmpty())
{
securityElement.AddAttribute("Url", this.url);
}
return securityElement;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The <see cref="P:System.Security.Permissions.UrlIdentityPermission.Url" /> property is not a valid URL.-or-The two permissions are not equal and one is not a subset of the other.</exception>
// Token: 0x0600331A RID: 13082 RVA: 0x000AFEA8 File Offset: 0x000AE0A8
public override IPermission Union(IPermission target)
{
UrlIdentityPermission urlIdentityPermission = this.Cast(target);
if (urlIdentityPermission == null)
{
return this.Copy();
}
if (this.IsEmpty() && urlIdentityPermission.IsEmpty())
{
return null;
}
if (urlIdentityPermission.IsEmpty())
{
return this.Copy();
}
if (this.IsEmpty())
{
return urlIdentityPermission.Copy();
}
if (!this.Match(urlIdentityPermission.url))
{
throw new ArgumentException(Locale.GetText("Cannot union two different urls."), "target");
}
if (this.url.Length < urlIdentityPermission.url.Length)
{
return this.Copy();
}
return urlIdentityPermission.Copy();
}
// Token: 0x0600331B RID: 13083 RVA: 0x000AFF54 File Offset: 0x000AE154
private bool IsEmpty()
{
return this.url == null || this.url.Length == 0;
}
// Token: 0x0600331C RID: 13084 RVA: 0x000AFF74 File Offset: 0x000AE174
private UrlIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
UrlIdentityPermission urlIdentityPermission = target as UrlIdentityPermission;
if (urlIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(UrlIdentityPermission));
}
return urlIdentityPermission;
}
// Token: 0x0600331D RID: 13085 RVA: 0x000AFFA8 File Offset: 0x000AE1A8
private bool Match(string target)
{
if (this.url == null || target == null)
{
return false;
}
int num = this.url.LastIndexOf('*');
int num2 = target.LastIndexOf('*');
int num3;
if (num == -1 && num2 == -1)
{
num3 = Math.Max(this.url.Length, target.Length);
}
else if (num == -1)
{
num3 = num2;
}
else if (num2 == -1)
{
num3 = num;
}
else
{
num3 = Math.Min(num, num2);
}
return string.Compare(this.url, 0, target, 0, num3, true, CultureInfo.InvariantCulture) == 0;
}
// Token: 0x040014FB RID: 5371
private const int version = 1;
// Token: 0x040014FC RID: 5372
private string url;
}
}
@@ -0,0 +1,57 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.UrlIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited.</summary>
// Token: 0x02000576 RID: 1398
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[ComVisible(true)]
[Serializable]
public sealed class UrlIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.UrlIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600331E RID: 13086 RVA: 0x000B004C File Offset: 0x000AE24C
public UrlIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
}
/// <summary>Gets or sets the full URL of the calling code.</summary>
/// <returns>The URL to match with the URL specified by the host.</returns>
// Token: 0x17000A0B RID: 2571
// (get) Token: 0x0600331F RID: 13087 RVA: 0x000B0058 File Offset: 0x000AE258
// (set) Token: 0x06003320 RID: 13088 RVA: 0x000B0060 File Offset: 0x000AE260
public string Url
{
get
{
return this.url;
}
set
{
this.url = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.UrlIdentityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.UrlIdentityPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003321 RID: 13089 RVA: 0x000B006C File Offset: 0x000AE26C
public override IPermission CreatePermission()
{
if (base.Unrestricted)
{
return new UrlIdentityPermission(PermissionState.Unrestricted);
}
if (this.url == null)
{
return new UrlIdentityPermission(PermissionState.None);
}
return new UrlIdentityPermission(this.url);
}
// Token: 0x040014FD RID: 5373
private string url;
}
}
@@ -0,0 +1,187 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Defines the identity permission for the zone from which the code originates. This class cannot be inherited.</summary>
// Token: 0x02000577 RID: 1399
[ComVisible(true)]
[Serializable]
public sealed class ZoneIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ZoneIdentityPermission" /> class with the specified <see cref="T:System.Security.Permissions.PermissionState" />.</summary>
/// <param name="state">One of the <see cref="T:System.Security.Permissions.PermissionState" /> values.</param>
/// <exception cref="T:System.ArgumentException">The <paramref name="state" /> parameter is not a valid value of <see cref="T:System.Security.Permissions.PermissionState" />. </exception>
// Token: 0x06003322 RID: 13090 RVA: 0x000B00A0 File Offset: 0x000AE2A0
public ZoneIdentityPermission(PermissionState state)
{
CodeAccessPermission.CheckPermissionState(state, false);
this.zone = SecurityZone.NoZone;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ZoneIdentityPermission" /> class to represent the specified zone identity.</summary>
/// <param name="zone">The zone identifier. </param>
// Token: 0x06003323 RID: 13091 RVA: 0x000B00B8 File Offset: 0x000AE2B8
public ZoneIdentityPermission(SecurityZone zone)
{
this.SecurityZone = zone;
}
// Token: 0x06003324 RID: 13092 RVA: 0x000B00C8 File Offset: 0x000AE2C8
int IBuiltInPermission.GetTokenIndex()
{
return 14;
}
/// <summary>Creates and returns an identical copy of the current permission.</summary>
/// <returns>A copy of the current permission.</returns>
// Token: 0x06003325 RID: 13093 RVA: 0x000B00CC File Offset: 0x000AE2CC
public override IPermission Copy()
{
return new ZoneIdentityPermission(this.zone);
}
/// <summary>Determines whether the current permission is a subset of the specified permission.</summary>
/// <returns>true if the current permission is a subset of the specified permission; otherwise, false.</returns>
/// <param name="target">A permission that is to be tested for the subset relationship. This permission must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null, this permission does not represent the <see cref="F:System.Security.SecurityZone.NoZone" /> security zone, and the specified permission is not equal to the current permission. </exception>
// Token: 0x06003326 RID: 13094 RVA: 0x000B00DC File Offset: 0x000AE2DC
public override bool IsSubsetOf(IPermission target)
{
ZoneIdentityPermission zoneIdentityPermission = this.Cast(target);
if (zoneIdentityPermission == null)
{
return this.zone == SecurityZone.NoZone;
}
return this.zone == SecurityZone.NoZone || this.zone == zoneIdentityPermission.zone;
}
/// <summary>Creates a permission that is the union of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the union of the current permission and the specified permission.</returns>
/// <param name="target">A permission to combine with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. -or-The two permissions are not equal and the current permission does not represent the <see cref="F:System.Security.SecurityZone.NoZone" /> security zone.</exception>
// Token: 0x06003327 RID: 13095 RVA: 0x000B0120 File Offset: 0x000AE320
public override IPermission Union(IPermission target)
{
ZoneIdentityPermission zoneIdentityPermission = this.Cast(target);
if (zoneIdentityPermission == null)
{
IPermission permission2;
if (this.zone == SecurityZone.NoZone)
{
IPermission permission = null;
permission2 = permission;
}
else
{
permission2 = this.Copy();
}
return permission2;
}
if (this.zone == zoneIdentityPermission.zone || zoneIdentityPermission.zone == SecurityZone.NoZone)
{
return this.Copy();
}
if (this.zone == SecurityZone.NoZone)
{
return zoneIdentityPermission.Copy();
}
throw new ArgumentException(Locale.GetText("Union impossible"));
}
/// <summary>Creates and returns a permission that is the intersection of the current permission and the specified permission.</summary>
/// <returns>A new permission that represents the intersection of the current permission and the specified permission. This new permission is null if the intersection is empty.</returns>
/// <param name="target">A permission to intersect with the current permission. It must be of the same type as the current permission. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="target" /> parameter is not null and is not of the same type as the current permission. </exception>
// Token: 0x06003328 RID: 13096 RVA: 0x000B019C File Offset: 0x000AE39C
public override IPermission Intersect(IPermission target)
{
ZoneIdentityPermission zoneIdentityPermission = this.Cast(target);
if (zoneIdentityPermission == null || this.zone == SecurityZone.NoZone)
{
return null;
}
if (this.zone == zoneIdentityPermission.zone)
{
return this.Copy();
}
return null;
}
/// <summary>Reconstructs a permission with a specified state from an XML encoding.</summary>
/// <param name="esd">The XML encoding to use to reconstruct the permission. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="esd" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">The <paramref name="esd" /> parameter is not a valid permission element.-or- The <paramref name="esd" /> parameter's version number is not valid. </exception>
// Token: 0x06003329 RID: 13097 RVA: 0x000B01E0 File Offset: 0x000AE3E0
public override void FromXml(SecurityElement esd)
{
CodeAccessPermission.CheckSecurityElement(esd, "esd", 1, 1);
string text = esd.Attribute("Zone");
if (text == null)
{
this.zone = SecurityZone.NoZone;
}
else
{
this.zone = (SecurityZone)((int)Enum.Parse(typeof(SecurityZone), text));
}
}
/// <summary>Creates an XML encoding of the permission and its current state.</summary>
/// <returns>An XML encoding of the permission, including any state information.</returns>
// Token: 0x0600332A RID: 13098 RVA: 0x000B0234 File Offset: 0x000AE434
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.Element(1);
if (this.zone != SecurityZone.NoZone)
{
securityElement.AddAttribute("Zone", this.zone.ToString());
}
return securityElement;
}
/// <summary>Gets or sets the zone represented by the current <see cref="T:System.Security.Permissions.ZoneIdentityPermission" />.</summary>
/// <returns>One of the <see cref="T:System.Security.SecurityZone" /> values.</returns>
/// <exception cref="T:System.ArgumentException">The parameter value is not a valid value of <see cref="T:System.Security.SecurityZone" />. </exception>
// Token: 0x17000A0C RID: 2572
// (get) Token: 0x0600332B RID: 13099 RVA: 0x000B0274 File Offset: 0x000AE474
// (set) Token: 0x0600332C RID: 13100 RVA: 0x000B027C File Offset: 0x000AE47C
public SecurityZone SecurityZone
{
get
{
return this.zone;
}
set
{
if (!Enum.IsDefined(typeof(SecurityZone), value))
{
string text = string.Format(Locale.GetText("Invalid enum {0}"), value);
throw new ArgumentException(text, "SecurityZone");
}
this.zone = value;
}
}
// Token: 0x0600332D RID: 13101 RVA: 0x000B02CC File Offset: 0x000AE4CC
private ZoneIdentityPermission Cast(IPermission target)
{
if (target == null)
{
return null;
}
ZoneIdentityPermission zoneIdentityPermission = target as ZoneIdentityPermission;
if (zoneIdentityPermission == null)
{
CodeAccessPermission.ThrowInvalidPermission(target, typeof(ZoneIdentityPermission));
}
return zoneIdentityPermission;
}
// Token: 0x040014FE RID: 5374
private const int version = 1;
// Token: 0x040014FF RID: 5375
private SecurityZone zone;
}
}
@@ -0,0 +1,54 @@
using System;
using System.Runtime.InteropServices;
namespace System.Security.Permissions
{
/// <summary>Allows security actions for <see cref="T:System.Security.Permissions.ZoneIdentityPermission" /> to be applied to code using declarative security. This class cannot be inherited. </summary>
// Token: 0x02000578 RID: 1400
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
[Serializable]
public sealed class ZoneIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Permissions.ZoneIdentityPermissionAttribute" /> class with the specified <see cref="T:System.Security.Permissions.SecurityAction" />.</summary>
/// <param name="action">One of the <see cref="T:System.Security.Permissions.SecurityAction" /> values. </param>
// Token: 0x0600332E RID: 13102 RVA: 0x000B0300 File Offset: 0x000AE500
public ZoneIdentityPermissionAttribute(SecurityAction action)
: base(action)
{
this.zone = SecurityZone.NoZone;
}
/// <summary>Gets or sets membership in the content zone specified by the property value.</summary>
/// <returns>One of the <see cref="T:System.Security.SecurityZone" /> values.</returns>
// Token: 0x17000A0D RID: 2573
// (get) Token: 0x0600332F RID: 13103 RVA: 0x000B0310 File Offset: 0x000AE510
// (set) Token: 0x06003330 RID: 13104 RVA: 0x000B0318 File Offset: 0x000AE518
public SecurityZone Zone
{
get
{
return this.zone;
}
set
{
this.zone = value;
}
}
/// <summary>Creates and returns a new <see cref="T:System.Security.Permissions.ZoneIdentityPermission" />.</summary>
/// <returns>A <see cref="T:System.Security.Permissions.ZoneIdentityPermission" /> that corresponds to this attribute.</returns>
// Token: 0x06003331 RID: 13105 RVA: 0x000B0324 File Offset: 0x000AE524
public override IPermission CreatePermission()
{
if (base.Unrestricted)
{
return new ZoneIdentityPermission(PermissionState.Unrestricted);
}
return new ZoneIdentityPermission(this.zone);
}
// Token: 0x04001500 RID: 5376
private SecurityZone zone;
}
}