using System; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Security.Permissions; using System.Security.Policy; using System.Text; namespace System.Security { /// The exception that is thrown when a security error is detected. // Token: 0x020005CF RID: 1487 [ComVisible(true)] [Serializable] public class SecurityException : SystemException { /// Initializes a new instance of the class with default properties. // Token: 0x06003645 RID: 13893 RVA: 0x000B9FE4 File Offset: 0x000B81E4 public SecurityException() : base(Locale.GetText("A security error has been detected.")) { base.HResult = -2146233078; } /// Initializes a new instance of the class with a specified error message. /// The error message that explains the reason for the exception. // Token: 0x06003646 RID: 13894 RVA: 0x000BA004 File Offset: 0x000B8204 public SecurityException(string message) : base(message) { base.HResult = -2146233078; } /// Initializes a new instance of the class with serialized data. /// The object that holds the serialized object data. /// The contextual information about the source or destination. /// /// is null. // Token: 0x06003647 RID: 13895 RVA: 0x000BA018 File Offset: 0x000B8218 protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context) { base.HResult = -2146233078; SerializationInfoEnumerator enumerator = info.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Name == "PermissionState") { this.permissionState = (string)enumerator.Value; break; } } } /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. /// The error message that explains the reason for the exception. /// The exception that is the cause of the current exception. If the parameter is not null, the current exception is raised in a catch block that handles the inner exception. // Token: 0x06003648 RID: 13896 RVA: 0x000BA07C File Offset: 0x000B827C public SecurityException(string message, Exception inner) : base(message, inner) { base.HResult = -2146233078; } /// Initializes a new instance of the class with a specified error message and the permission type that caused the exception to be thrown. /// The error message that explains the reason for the exception. /// The type of the permission that caused the exception to be thrown. // Token: 0x06003649 RID: 13897 RVA: 0x000BA094 File Offset: 0x000B8294 public SecurityException(string message, Type type) : base(message) { base.HResult = -2146233078; this.permissionType = type; } /// Initializes a new instance of the class with a specified error message, the permission type that caused the exception to be thrown, and the permission state. /// The error message that explains the reason for the exception. /// The type of the permission that caused the exception to be thrown. /// The state of the permission that caused the exception to be thrown. // Token: 0x0600364A RID: 13898 RVA: 0x000BA0B0 File Offset: 0x000B82B0 public SecurityException(string message, Type type, string state) : base(message) { base.HResult = -2146233078; this.permissionType = type; this.permissionState = state; } // Token: 0x0600364B RID: 13899 RVA: 0x000BA0E0 File Offset: 0x000B82E0 internal SecurityException(string message, PermissionSet granted, PermissionSet refused) : base(message) { base.HResult = -2146233078; this._granted = granted.ToString(); this._refused = refused.ToString(); } /// Initializes a new instance of the class for an exception caused by a Deny on the stack. /// The error message that explains the reason for the exception. /// The denied permission or permission set. /// The permit-only permission or permission set. /// A that identifies the method that encountered the exception. /// The demanded permission, permission set, or permission set collection. /// An that identifies the permission that failed. // Token: 0x0600364C RID: 13900 RVA: 0x000BA118 File Offset: 0x000B8318 public SecurityException(string message, object deny, object permitOnly, MethodInfo method, object demanded, IPermission permThatFailed) : base(message) { base.HResult = -2146233078; this._denyset = deny; this._permitset = permitOnly; this._method = method; this._demanded = demanded; this._firstperm = permThatFailed; } /// Initializes a new instance of the class for an exception caused by an insufficient grant set. /// The error message that explains the reason for the exception. /// An that specifies the name of the assembly that caused the exception. /// A that represents the permissions granted the assembly. /// A that represents the refused permission or permission set. /// A that represents the method that encountered the exception. /// One of the values. /// The demanded permission, permission set, or permission set collection. /// An that represents the permission that failed. /// The for the assembly that caused the exception. // Token: 0x0600364D RID: 13901 RVA: 0x000BA160 File Offset: 0x000B8360 public SecurityException(string message, AssemblyName assemblyName, PermissionSet grant, PermissionSet refused, MethodInfo method, SecurityAction action, object demanded, IPermission permThatFailed, Evidence evidence) : base(message) { base.HResult = -2146233078; this._assembly = assemblyName; this._granted = ((grant != null) ? grant.ToString() : string.Empty); this._refused = ((refused != null) ? refused.ToString() : string.Empty); this._method = method; this._action = action; this._demanded = demanded; this._firstperm = permThatFailed; if (this._firstperm != null) { this.permissionType = this._firstperm.GetType(); } this._evidence = evidence; } /// Gets or sets the security action that caused the exception. /// One of the values. // Token: 0x17000A9B RID: 2715 // (get) Token: 0x0600364E RID: 13902 RVA: 0x000BA204 File Offset: 0x000B8404 // (set) Token: 0x0600364F RID: 13903 RVA: 0x000BA20C File Offset: 0x000B840C [ComVisible(false)] public SecurityAction Action { get { return this._action; } set { this._action = value; } } /// Gets or sets the denied security permission, permission set, or permission set collection that caused a demand to fail. /// A permission, permission set, or permission set collection object. /// /// /// // Token: 0x17000A9C RID: 2716 // (get) Token: 0x06003650 RID: 13904 RVA: 0x000BA218 File Offset: 0x000B8418 // (set) Token: 0x06003651 RID: 13905 RVA: 0x000BA220 File Offset: 0x000B8420 [ComVisible(false)] public object DenySetInstance { get { return this._denyset; } set { this._denyset = value; } } /// Gets or sets information about the failed assembly. /// An that identifies the failed assembly. /// /// /// // Token: 0x17000A9D RID: 2717 // (get) Token: 0x06003652 RID: 13906 RVA: 0x000BA22C File Offset: 0x000B842C // (set) Token: 0x06003653 RID: 13907 RVA: 0x000BA234 File Offset: 0x000B8434 [ComVisible(false)] public AssemblyName FailedAssemblyInfo { get { return this._assembly; } set { this._assembly = value; } } /// Gets or sets the information about the method associated with the exception. /// A object describing the method. /// /// /// /// // Token: 0x17000A9E RID: 2718 // (get) Token: 0x06003654 RID: 13908 RVA: 0x000BA240 File Offset: 0x000B8440 // (set) Token: 0x06003655 RID: 13909 RVA: 0x000BA248 File Offset: 0x000B8448 [ComVisible(false)] public MethodInfo Method { get { return this._method; } set { this._method = value; } } /// Gets or sets the permission, permission set, or permission set collection that is part of the permit-only stack frame that caused a security check to fail. /// A permission, permission set, or permission set collection object. /// /// /// // Token: 0x17000A9F RID: 2719 // (get) Token: 0x06003656 RID: 13910 RVA: 0x000BA254 File Offset: 0x000B8454 // (set) Token: 0x06003657 RID: 13911 RVA: 0x000BA25C File Offset: 0x000B845C [ComVisible(false)] public object PermitOnlySetInstance { get { return this._permitset; } set { this._permitset = value; } } /// Gets or sets the URL of the assembly that caused the exception. /// A URL that identifies the location of the assembly. // Token: 0x17000AA0 RID: 2720 // (get) Token: 0x06003658 RID: 13912 RVA: 0x000BA268 File Offset: 0x000B8468 // (set) Token: 0x06003659 RID: 13913 RVA: 0x000BA270 File Offset: 0x000B8470 public string Url { get { return this._url; } set { this._url = value; } } /// Gets or sets the zone of the assembly that caused the exception. /// One of the values that identifies the zone of the assembly that caused the exception. // Token: 0x17000AA1 RID: 2721 // (get) Token: 0x0600365A RID: 13914 RVA: 0x000BA27C File Offset: 0x000B847C // (set) Token: 0x0600365B RID: 13915 RVA: 0x000BA284 File Offset: 0x000B8484 public SecurityZone Zone { get { return this._zone; } set { this._zone = value; } } /// Gets or sets the demanded security permission, permission set, or permission set collection that failed. /// A permission, permission set, or permission set collection object. /// /// /// // Token: 0x17000AA2 RID: 2722 // (get) Token: 0x0600365C RID: 13916 RVA: 0x000BA290 File Offset: 0x000B8490 // (set) Token: 0x0600365D RID: 13917 RVA: 0x000BA298 File Offset: 0x000B8498 [ComVisible(false)] public object Demanded { get { return this._demanded; } set { this._demanded = value; } } /// Gets or sets the first permission in a permission set or permission set collection that failed the demand. /// An object representing the first permission that failed. // Token: 0x17000AA3 RID: 2723 // (get) Token: 0x0600365E RID: 13918 RVA: 0x000BA2A4 File Offset: 0x000B84A4 // (set) Token: 0x0600365F RID: 13919 RVA: 0x000BA2AC File Offset: 0x000B84AC public IPermission FirstPermissionThatFailed { get { return this._firstperm; } set { this._firstperm = value; } } /// Gets or sets the state of the permission that threw the exception. /// The state of the permission at the time the exception was thrown. /// /// /// // Token: 0x17000AA4 RID: 2724 // (get) Token: 0x06003660 RID: 13920 RVA: 0x000BA2B8 File Offset: 0x000B84B8 // (set) Token: 0x06003661 RID: 13921 RVA: 0x000BA2C0 File Offset: 0x000B84C0 public string PermissionState { get { return this.permissionState; } set { this.permissionState = value; } } /// Gets or sets the type of the permission that failed. /// The type of the permission that failed. // Token: 0x17000AA5 RID: 2725 // (get) Token: 0x06003662 RID: 13922 RVA: 0x000BA2CC File Offset: 0x000B84CC // (set) Token: 0x06003663 RID: 13923 RVA: 0x000BA2D4 File Offset: 0x000B84D4 public Type PermissionType { get { return this.permissionType; } set { this.permissionType = value; } } /// Gets or sets the granted permission set of the assembly that caused the . /// The XML representation of the granted set of the assembly. /// /// /// // Token: 0x17000AA6 RID: 2726 // (get) Token: 0x06003664 RID: 13924 RVA: 0x000BA2E0 File Offset: 0x000B84E0 // (set) Token: 0x06003665 RID: 13925 RVA: 0x000BA2E8 File Offset: 0x000B84E8 public string GrantedSet { get { return this._granted; } set { this._granted = value; } } /// Gets or sets the refused permission set of the assembly that caused the . /// The XML representation of the refused permission set of the assembly. /// /// /// // Token: 0x17000AA7 RID: 2727 // (get) Token: 0x06003666 RID: 13926 RVA: 0x000BA2F4 File Offset: 0x000B84F4 // (set) Token: 0x06003667 RID: 13927 RVA: 0x000BA2FC File Offset: 0x000B84FC public string RefusedSet { get { return this._refused; } set { this._refused = value; } } /// Sets the with information about the . /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. /// The parameter is null. /// /// /// /// // Token: 0x06003668 RID: 13928 RVA: 0x000BA308 File Offset: 0x000B8508 public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); try { info.AddValue("PermissionState", this.PermissionState); } catch (SecurityException) { } } /// Returns a representation of the current . /// A string representation of the current . /// /// /// /// /// // Token: 0x06003669 RID: 13929 RVA: 0x000BA358 File Offset: 0x000B8558 public override string ToString() { StringBuilder stringBuilder = new StringBuilder(base.ToString()); try { if (this.permissionType != null) { stringBuilder.AppendFormat("{0}Type: {1}", Environment.NewLine, this.PermissionType); } if (this._method != null) { string text = this._method.ToString(); int num = text.IndexOf(" ") + 1; stringBuilder.AppendFormat("{0}Method: {1} {2}.{3}", new object[] { Environment.NewLine, this._method.ReturnType.Name, this._method.ReflectedType, text.Substring(num) }); } if (this.permissionState != null) { stringBuilder.AppendFormat("{0}State: {1}", Environment.NewLine, this.PermissionState); } if (this._granted != null && this._granted.Length > 0) { stringBuilder.AppendFormat("{0}Granted: {1}", Environment.NewLine, this.GrantedSet); } if (this._refused != null && this._refused.Length > 0) { stringBuilder.AppendFormat("{0}Refused: {1}", Environment.NewLine, this.RefusedSet); } if (this._demanded != null) { stringBuilder.AppendFormat("{0}Demanded: {1}", Environment.NewLine, this.Demanded); } if (this._firstperm != null) { stringBuilder.AppendFormat("{0}Failed Permission: {1}", Environment.NewLine, this.FirstPermissionThatFailed); } if (this._evidence != null) { stringBuilder.AppendFormat("{0}Evidences:", Environment.NewLine); foreach (object obj in this._evidence) { if (!(obj is Hash)) { stringBuilder.AppendFormat("{0}\t{1}", Environment.NewLine, obj); } } } } catch (SecurityException) { } return stringBuilder.ToString(); } // Token: 0x04001637 RID: 5687 private string permissionState; // Token: 0x04001638 RID: 5688 private Type permissionType; // Token: 0x04001639 RID: 5689 private string _granted; // Token: 0x0400163A RID: 5690 private string _refused; // Token: 0x0400163B RID: 5691 private object _demanded; // Token: 0x0400163C RID: 5692 private IPermission _firstperm; // Token: 0x0400163D RID: 5693 private MethodInfo _method; // Token: 0x0400163E RID: 5694 private Evidence _evidence; // Token: 0x0400163F RID: 5695 private SecurityAction _action; // Token: 0x04001640 RID: 5696 private object _denyset; // Token: 0x04001641 RID: 5697 private object _permitset; // Token: 0x04001642 RID: 5698 private AssemblyName _assembly; // Token: 0x04001643 RID: 5699 private string _url; // Token: 0x04001644 RID: 5700 private SecurityZone _zone; } }