Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.Security')
-rwxr-xr-xmcs/class/corlib/System.Security/ChangeLog67
-rwxr-xr-xmcs/class/corlib/System.Security/CodeAccessPermission.cs86
-rw-r--r--mcs/class/corlib/System.Security/IEvidenceFactory.cs15
-rwxr-xr-xmcs/class/corlib/System.Security/IPermission.cs24
-rwxr-xr-xmcs/class/corlib/System.Security/ISecurityEncodable.cs18
-rw-r--r--mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs20
-rwxr-xr-xmcs/class/corlib/System.Security/IStackWalk.cs22
-rw-r--r--mcs/class/corlib/System.Security/NamedPermissionSet.cs66
-rw-r--r--mcs/class/corlib/System.Security/PermissionSet.cs202
-rw-r--r--mcs/class/corlib/System.Security/PolicyLevelType.cs18
-rwxr-xr-xmcs/class/corlib/System.Security/SecurityElement.cs340
-rw-r--r--mcs/class/corlib/System.Security/SecurityException.cs79
-rw-r--r--mcs/class/corlib/System.Security/SecurityManager.cs88
-rw-r--r--mcs/class/corlib/System.Security/SecurityZone.cs20
-rw-r--r--mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs15
-rw-r--r--mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs14
-rw-r--r--mcs/class/corlib/System.Security/VerificationException.cs26
-rw-r--r--mcs/class/corlib/System.Security/XmlSyntaxException.cs27
18 files changed, 1147 insertions, 0 deletions
diff --git a/mcs/class/corlib/System.Security/ChangeLog b/mcs/class/corlib/System.Security/ChangeLog
new file mode 100755
index 00000000000..87c3fade5f0
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ChangeLog
@@ -0,0 +1,67 @@
+2002-06-10 Duncan Mak <duncan@ximian.com>
+
+ * IEvidenceFactory.cs (Evidence): Added missing method.
+
+ * SuppressUnmanagedCodeSecurityAttribute.cs:
+ * UnverifiableCodeAttribute.cs: Added missing
+ AttributeUsage attribute.
+
+2002-06-05 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElement.cs: Fixed couple of hard to spot typos which were
+ causing valid names and keys to be rejected.
+
+2002-04-28 Lawrence Pit <loz@cable.a2000.nl>
+
+ * CodeAccessPermission.cs : implemented ToString method
+
+2002-04-27 Lawrence Pit <loz@cable.a2000.nl>
+
+ * SecurityElement.cs: fixed bugs, implemented several methods
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Inherit from SystemException, not Exception.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElement.cs: fixed typo
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * NamedPermissionSet.cs: New file (stub)
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Reformatted to fit the form of other
+ Exceptions. Added serialization bits.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * SecurityElement.cs : Insert MonoTODO attribute.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * CodeAccessPermission.cs: Fix syntax error hidden by exclusion in .build file
+
+2001-12-30 Nick Drochak <ndrochak@gol.com>
+
+ * PermissionSet.cs SecurityManager.cs: New Files
+ * CodeAccessPermission.cs: Add Skeleton code
+ * IPermission.cs: Make public and inherit from ISecurityEncodable
+ * ISecurityEncodable.cs: Make interface public
+ * ISecurityPolicyEncodable.cs: Ditto
+ * IStackWalk.cs: Ditto
+
+2001-12-29 Nick Drochak <ndrochak@gol.com>
+
+ * ISecurityPolicyEncodable.cs, PolicyLevelType.cs,
+ SecurityZone.cs, SecurityException.cs, UnverifiableCodeAttribute.cs,
+ SuppressUnmanagedCodeSecurityAttribute.cs,
+ VerificationException.cs, XmlSyntaxException.cs: New files
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * SecurityElement.cs, CodeAccessPermission.cs IPermission.cs
+ IStackWalk.cs SecurityElement.cs ISecurityEncodable.cs: New files.
+
diff --git a/mcs/class/corlib/System.Security/CodeAccessPermission.cs b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
new file mode 100755
index 00000000000..3994f785dcf
--- /dev/null
+++ b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
@@ -0,0 +1,86 @@
+//
+// System.Security.CodeAccessPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ [Serializable]
+ public abstract class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk
+ {
+ ///<summary>Constructs a new instance of the System.Security.CodeAccessPermission class.</summary>
+ protected CodeAccessPermission(){}
+
+ ///<summary> Asserts that calling code can access the resource identified by the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The calling code does not have System.Security.Permissions.SecurityPermissionFlag.Assertion. </exception>
+ public void Assert()
+ {
+ }
+
+ ///<summary> Returns a System.Security.CodeAccessPermission containing the same values as the current instance.</summary>
+ ///<returns> A new System.Security.CodeAccessPermission instance that is value equal to the current instance.</returns>
+ public abstract IPermission Copy();
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permission specified by the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException"> A caller does not have the permission specified by the current instance. A caller has called System.Security.CodeAccessPermission.Deny for the resource protected by the current instance. </exception>
+ public void Demand()
+ {
+ }
+
+ ///<summary> Denies access to the resources specified by the current instance through the code that calls this method.</summary>
+ public void Deny(){}
+
+ ///<summary> Reconstructs the state of a System.Security.CodeAccessPermission object using the specified XML encoding.</summary>
+ ///<param name="elem">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.CodeAccessPermission object.</param>
+ ///<exception cref="System.ArgumentException">elem does not contain the XML encoding for a instance of the same type as the current instance.The version number of elem is not valid.</exception>
+ public abstract void FromXml(SecurityElement elem);
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the intersection of the current instance and the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance to intersect with the current instance.</param>
+ ///<returns> A new System.Security.CodeAccessPermission instance that represents the intersection of the current instance andtarget. If the intersection is empty or target is null, returns null. If the current instance is unrestricted, returns a copy of target. Iftarget is unrestricted, returns a copy of the current instance.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not a System.Security.CodeAccessPermission object.</exception>
+ public abstract IPermission Intersect(IPermission target);
+
+ ///<summary>Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance that is to be tested for the subset relationship.</param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, and target is not, returnsfalse. If target is unrestricted, returns true.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not of type System.Security.CodeAccessPermission.</exception>
+ public abstract bool IsSubsetOf(IPermission target);
+
+ ///<summary> Returns the XML representation of the state of the current instance.</summary>
+ ///<returns> A System.String containing the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ SecurityElement elem = ToXml ();
+ return elem == null ? null : elem.ToString ();
+ }
+
+ ///<summary> Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public abstract SecurityElement ToXml();
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.IPermission object of the same type as the current instance to be combined with the current instance.</param>
+ ///<returns>If other is null, returns a copy of the current instance using the System.Security.IPermission.Copy method.</returns>
+ ///<exception cref="System.ArgumentException">other is not of type System.Security.CodeAccessPermission.</exception>
+ ///<exception cref="System.NotSupportedException">other is not null.</exception>
+ public virtual IPermission Union(IPermission other)
+ {
+ if (!(other is System.Security.CodeAccessPermission))
+ {
+ throw new System.ArgumentException(); // other is not of type System.Security.CodeAccessPermission.
+ }
+ if (null != other)
+ {
+ throw new System.NotSupportedException(); // other is not null.
+ }
+ return null;
+ }
+
+ public void PermitOnly(){}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IEvidenceFactory.cs b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
new file mode 100644
index 00000000000..ed9fc23e2e8
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
@@ -0,0 +1,15 @@
+// System.Security.IEvidenceFactory
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+using System.Security.Policy;
+
+namespace System.Security
+{
+ public interface IEvidenceFactory
+ {
+ Evidence Evidence { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IPermission.cs b/mcs/class/corlib/System.Security/IPermission.cs
new file mode 100755
index 00000000000..63aabfd4c4a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IPermission.cs
@@ -0,0 +1,24 @@
+//
+// System.Security.IPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IPermission : ISecurityEncodable {
+
+ IPermission Copy ();
+
+ void Demand ();
+
+ IPermission Intersect (IPermission target);
+
+ bool IsSubsetOf (IPermission target);
+
+ IPermission Union (IPermission target);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityEncodable.cs b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
new file mode 100755
index 00000000000..55b9ebe2f55
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.ISecurityEncodable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface ISecurityEncodable {
+
+ void FromXml (SecurityElement e);
+
+ SecurityElement ToXml ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
new file mode 100644
index 00000000000..66418ab91d0
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.ISecurityPolicyEncodable.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+
+namespace System.Security {
+
+ public interface ISecurityPolicyEncodable {
+
+ void FromXml (SecurityElement e, PolicyLevel level);
+
+ SecurityElement ToXml (PolicyLevel level);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IStackWalk.cs b/mcs/class/corlib/System.Security/IStackWalk.cs
new file mode 100755
index 00000000000..f5b717ac57a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IStackWalk.cs
@@ -0,0 +1,22 @@
+//
+// System.Security.IStackWalk.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IStackWalk {
+
+ void Assert ();
+
+ void Demand ();
+
+ void Deny ();
+
+ void PermitOnly ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/NamedPermissionSet.cs b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
new file mode 100644
index 00000000000..0f500e6de98
--- /dev/null
+++ b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
@@ -0,0 +1,66 @@
+//
+// System.Security.NamedPermissionSet
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class NamedPermissionSet : PermissionSet {
+ public NamedPermissionSet (string name, PermissionSet set) : base (set) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (string name, PermissionState state) : base (state) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (NamedPermissionSet set) : this (set.name, set) {
+ }
+
+ public NamedPermissionSet (string name) : this (name, PermissionState.None) {
+ }
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public override PermissionSet Copy () {
+ return null;
+ }
+
+ public NamedPermissionSet Copy (string name) {
+ return null;
+ }
+
+ public override void FromXml (SecurityElement e) {
+ }
+
+ public override SecurityElement ToXml () {
+ return null;
+ }
+
+ // private
+
+ private string name;
+ private string description;
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs
new file mode 100644
index 00000000000..96c9667b9be
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PermissionSet.cs
@@ -0,0 +1,202 @@
+//
+// System.Security.PermissionSet.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Security;
+using System.Runtime.Serialization;
+
+namespace System.Security
+{
+ ///<summary> Represents a collection that can contain different kinds of permissions and perform security operations.</summary>
+ [Serializable]
+ public class PermissionSet: ISecurityEncodable, ICollection, IEnumerable, IStackWalk, IDeserializationCallback
+ {
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the specified value.</summary>
+ ///<param name="state">A System.Security.Permissions.PermissionState value. This value is either System.Security.Permissions.PermissionState.None or System.Security.Permissions.PermissionState.Unrestricted, to specify fully restricted or fully unrestricted access. </param>
+ ///<exception cref="System.ArgumentException">state is not a valid System.Security.Permissions.PermissionState value.</exception>
+ public PermissionSet(PermissionState state)
+ {
+ if (!Enum.IsDefined(typeof(System.Security.Permissions.PermissionState), state))
+ {
+ throw new System.ArgumentException(); // state is not a valid System.Security.Permissions.PermissionState value.
+ }
+ }
+
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the values of the specified System.Security.PermissionSet instance. </summary>
+ ///<param name="permSet">The System.Security.PermissionSet instance with which to initialize the values of the new instance, or null to initialize an empty permission set.</param>
+ ///<exception cref="System.ArgumentException">permSet is not an instance of System.Security.PermissionSet.</exception>
+ public PermissionSet(PermissionSet permSet)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way permSet is not a PermissionSet.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // permSet is not an instance of System.Security.PermissionSet.
+ //}
+ }
+
+ ///<summary> Adds the specified System.Security.IPermission object to the current instance if that permission does not already exist in the current instance.</summary>
+ ///<param name="perm">The System.Security.IPermission object to add.</param>
+ ///<returns>The System.Security.IPermission is added if perm is notnull and a permission of the same type as perm does not already exist in the current instance. If perm is null, returns null. If a permission of the same type asperm already exists in the current instance, the union of the existing permission and perm is added to the current instance and is returned.</returns>
+ ///<exception cref="System.ArgumentException">perm is not a System.Security.IPermission object.</exception>
+ public virtual IPermission AddPermission(IPermission perm)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way perm is not an IPermission.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // perm is not a System.Security.IPermission object.
+ //}
+ return null;
+ }
+
+ ///<summary>Asserts that calling code can access the resources identified by the permissions contained in the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.</exception>
+ public virtual void Assert()
+ {
+ throw new System.Security.SecurityException(); // The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.
+ }
+
+ ///<summary>Returns a new System.Security.PermissionSet containing copies of the objects in the current instance.</summary>
+ ///<returns>A new System.Security.PermissionSet that is value equal to the current instance.</returns>
+ public virtual PermissionSet Copy()
+ {
+ return null;
+ }
+
+ ///<summary>Copies the permission objects in the current instance to the specified location in the specified System.Array.</summary>
+ ///<param name="array">The destination System.Array.</param>
+ ///<param name="index">A System.Int32 that specifies the zero-based starting position in the array at which to begin copying.</param>
+ ///<exception cref="System.ArgumentException">array has more than one dimension.</exception>
+ ///<exception cref="System.IndexOutOfRangeException">index is outside the range of allowable values for array.</exception>
+ ///<exception cref="System.ArgumentNullException">array is null.</exception>
+ public virtual void CopyTo(Array array, int index)
+ {
+ if (array.Rank > 1)
+ {
+ throw new System.ArgumentException("Array has more than one dimension"); // array has more than one dimension.
+ }
+ if (index < 0 || index >= array.Length)
+ {
+ throw new System.IndexOutOfRangeException(); // index is outside the range of allowable values for array.
+ }
+ if (null == array)
+ {
+ throw new System.ArgumentNullException(); // array is null.
+ }
+ }
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permissions specified by the objects contained in the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException">A caller does not have the permission specified by the current instance.</exception>
+ public virtual void Demand()
+ {
+ throw new System.Security.SecurityException(); // A caller does not have the permission specified by the current instance.
+ }
+
+ ///<summary>Denies access to the resources secured by the objects contained in the current instance through the code that calls this method.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to Deny has already restricted the permissions for the current stack frame.</exception>
+ public virtual void Deny()
+ {
+ throw new System.Security.SecurityException(); // A previous call to Deny has already restricted the permissions for the current stack frame.
+ }
+
+ ///<summary>Reconstructs the state of a System.Security.PermissionSet object using the specified XML encoding.</summary>
+ ///<param name="et">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.PermissionSet object.</param>
+ ///<exception cref="System.ArgumentNullException">et is null.</exception>
+ ///<exception cref="System.ArgumentException">et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.</exception>
+ public virtual void FromXml(SecurityElement et)
+ {
+ if (null == et)
+ {
+ throw new System.ArgumentNullException("et"); // et is null.
+ }
+ if (true)
+ {
+ throw new System.ArgumentException("et does not contain an XML encoding for a System.Security.PermissionSet instance."); // et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.
+ }
+ }
+
+ ///<summary> Returns an enumerator used to iterate over the permissions in the current instance.</summary>
+ ///<returns>A System.Collections.IEnumerator object for the permissions of the set.</returns>
+ public virtual IEnumerator GetEnumerator()
+ {
+ return null;
+ }
+
+ ///<summary> Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.PermissionSet instance that is to be tested for the subset relationship. </param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, andtarget is not, returns false. If target is unrestricted, returns true.</returns>
+ public virtual bool IsSubsetOf(PermissionSet target)
+ {
+ return false;
+ }
+
+ ///<summary> Specifies that only the resources described by the current instance can be accessed by calling code, even if the code has been granted permission to access other resources.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to PermitOnly has already set the permissions for the current stack frame.</exception>
+ public virtual void PermitOnly()
+ {
+ if (true)
+ {
+ throw new System.Security.SecurityException(); // A previous call to PermitOnly has already set the permissions for the current stack frame.
+ }
+ }
+
+ ///<summary> Returns a System.String representation of the state of the current instance.</summary>
+ ///<returns>A System.Stringcontaining the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ return null;
+ }
+
+ ///<summary>Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public virtual SecurityElement ToXml()
+ {
+ return null;
+ }
+
+ ///<summary> Returns a System.Security.PermissionSet object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.PermissionSet instance to be combined with the current instance.</param>
+ ///<returns> A new System.Security.PermissionSet instance that represents the union of the current instance and other. If the current instance or other is unrestricted, returns a System.Security.PermissionSet instance that is unrestricted.</returns>
+ public virtual PermissionSet Union(PermissionSet other)
+ {
+ return null;
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.Count.]</summary>
+ int ICollection.Count
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.IsSynchronized.]</summary>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.SyncRoot.]</summary>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ void IDeserializationCallback.OnDeserialization(object sender){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PolicyLevelType.cs b/mcs/class/corlib/System.Security/PolicyLevelType.cs
new file mode 100644
index 00000000000..a7414010104
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PolicyLevelType.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.PolicyLevelType.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum PolicyLevelType {
+ User = 0x0,
+ Machine,
+ Enterprise,
+ AppDomain,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityElement.cs b/mcs/class/corlib/System.Security/SecurityElement.cs
new file mode 100755
index 00000000000..4aeb033328b
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityElement.cs
@@ -0,0 +1,340 @@
+//
+// System.Security.SecurityElement.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+
+using System.Globalization;
+using System.Collections;
+using System.Text;
+
+namespace System.Security
+{
+ [Serializable]
+ public sealed class SecurityElement
+ {
+ string text;
+ string tag;
+ Hashtable attributes;
+ ArrayList children;
+
+ // these values are determined by a simple test program against the MS.Net implementation:
+ // for (int i = 0; i < 256; i++) {
+ // if (!SecurityElement.IsValidTag ("" + ((char) i))) {
+ // System.Console.WriteLine ("TAG: " + i);
+ // }
+ // }
+ // note: this is actually an incorrect implementation of MS, as for example the &
+ // character is not a valid character in tag names.
+ private static char [] invalid_tag_chars = new char [] { ' ', '<', '>' };
+ private static char [] invalid_text_chars = new char [] { '<', '>' };
+ private static char [] invalid_attr_name_chars = new char [] { ' ', '<', '>' };
+ private static char [] invalid_attr_value_chars = new char [] { '"', '<', '>' };
+ private static char [] invalid_chars = new char [] { '<', '>', '"', '\'', '&' };
+
+ public SecurityElement (string tag) : this (tag, null)
+ {
+ }
+
+ public SecurityElement (string tag, string text)
+ {
+ this.Tag = tag;
+ this.Text = (text == null) ? String.Empty : text;
+ }
+
+ public Hashtable Attributes {
+ get {
+ if (attributes == null)
+ return null;
+
+ Hashtable result = new Hashtable ();
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ())
+ result.Add (e.Key, e.Value);
+ return result;
+ }
+
+ set {
+ if (value == null || value.Count == 0) {
+ attributes = null;
+ return;
+ }
+
+ Hashtable result = new Hashtable ();
+ IDictionaryEnumerator e = value.GetEnumerator ();
+ while (e.MoveNext ()) {
+ string key = (string) e.Key;
+ string val = (string) e.Value;
+ if (!IsValidAttributeName (key))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
+
+ if (!IsValidAttributeValue (val))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + key);
+
+ result.Add (key, val);
+ }
+ attributes = result;
+ }
+ }
+
+ public ArrayList Children {
+ get {
+ return children;
+ }
+
+ set {
+ if (value != null) {
+ foreach (object o in value) {
+ if (o == null)
+ throw new ArgumentNullException ();
+ // shouldn't we also throw an exception
+ // when o isn't an instance of SecurityElement?
+ }
+ }
+ children = value;
+ }
+ }
+
+ public string Tag {
+ get {
+ return tag;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (!IsValidTag (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + value);
+ tag = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ if (!IsValidText (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + text);
+ text = value;
+ }
+ }
+
+ public void AddAttribute (string name, string value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ();
+
+ if (attributes == null)
+ attributes = new Hashtable ();
+
+ //
+ // The hashtable will throw ArgumentException if name is already there
+ //
+
+ if (!IsValidAttributeName (name))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + name);
+
+ if (!IsValidAttributeValue (value))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string") + ": " + value);
+
+ attributes.Add (name, value);
+ }
+
+ public void AddChild (SecurityElement child)
+ {
+ if (child == null)
+ throw new ArgumentNullException ();
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (child);
+ }
+
+ public string Attribute (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ if (attributes != null)
+ return (string) attributes [name];
+ else
+ return null;
+ }
+
+ public bool Equal (SecurityElement other)
+ {
+ if (other == null)
+ return false;
+
+ if (this == other)
+ return true;
+
+ if (this.text != other.text)
+ return false;
+
+ if (this.tag != other.tag)
+ return false;
+
+ if (this.attributes == null && other.attributes != null && other.attributes.Count != 0)
+ return false;
+
+ if (other.attributes == null && this.attributes != null && this.attributes.Count != 0)
+ return false;
+
+ if (this.attributes != null && other.attributes != null) {
+ if (this.attributes.Count != other.attributes.Count)
+ return false;
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ())
+ if (other.attributes [e.Key] != e.Value)
+ return false;
+ }
+
+ if (this.children == null && other.children != null && other.children.Count != 0)
+ return false;
+
+ if (other.children == null && this.children != null && this.children.Count != 0)
+ return false;
+
+ if (this.children != null && other.children != null) {
+ if (this.children.Count != other.children.Count)
+ return false;
+ for (int i = 0; i < this.children.Count; i++)
+ if (!((SecurityElement) this.children [i]).Equal ((SecurityElement) other.children [i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ public static string Escape (string str)
+ {
+ StringBuilder sb;
+
+ if (str.IndexOfAny (invalid_chars) == -1)
+ return str;
+
+ sb = new StringBuilder ();
+ int len = str.Length;
+
+ for (int i = 0; i < len; i++) {
+ char c = str [i];
+
+ switch (c) {
+ case '<': sb.Append ("&lt;"); break;
+ case '>': sb.Append ("&gt;"); break;
+ case '"': sb.Append ("&quot;"); break;
+ case '\'': sb.Append ("&apos;"); break;
+ case '&': sb.Append ("&amp;"); break;
+ default: sb.Append (c); break;
+ }
+ }
+
+ return sb.ToString ();
+ }
+
+ public static bool IsValidAttributeName (string name)
+ {
+ return name != null && name.IndexOfAny (invalid_attr_name_chars) == -1;
+ }
+
+ public static bool IsValidAttributeValue (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_attr_value_chars) == -1;
+ }
+
+ public static bool IsValidTag (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_tag_chars) == -1;
+ }
+
+ public static bool IsValidText (string value)
+ {
+ return value != null && value.IndexOfAny (invalid_text_chars) == -1;
+ }
+
+ public SecurityElement SearchForChildByTag (string tag)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ("tag");
+
+ if (this.children == null)
+ return null;
+
+ for (int i = 0; i < children.Count; i++) {
+ SecurityElement elem = (SecurityElement) children [i];
+ if (elem.tag == tag)
+ return elem;
+ }
+ return null;
+ }
+
+ public string SearchForTextOfTag (string tag)
+ {
+ if (tag == null)
+ throw new ArgumentNullException ("tag");
+
+ if (this.tag == tag)
+ return this.text;
+
+ if (this.children == null)
+ return null;
+
+ for (int i = 0; i < children.Count; i++) {
+ string result = ((SecurityElement) children [i]).SearchForTextOfTag (tag);
+ if (result != null)
+ return result;
+ }
+
+ return null;
+ }
+
+ public override string ToString ()
+ {
+ StringBuilder s = new StringBuilder ();
+ ToXml (ref s, 0);
+ return s.ToString ();
+ }
+
+ private void ToXml(ref StringBuilder s, int level)
+ {
+ s.Append (' ', level << 2);
+ s.Append ("<");
+ s.Append (tag);
+
+ if (attributes != null) {
+ IDictionaryEnumerator e = attributes.GetEnumerator ();
+ while (e.MoveNext ()) {
+ s.Append (" ")
+ .Append (e.Key)
+ .Append ("=\"")
+ .Append (e.Value)
+ .Append ("\"");
+ }
+ }
+
+ if ((text == null || text == String.Empty) &&
+ (children == null || children.Count == 0))
+ s.Append ("/>");
+ else {
+ s.Append (">").Append (text);
+ if (children != null) {
+ foreach (SecurityElement child in children) {
+ s.Append (Environment.NewLine);
+ child.ToXml (ref s, level + 1);
+ }
+ }
+ s.Append (Environment.NewLine)
+ .Append (' ', level << 2)
+ .Append ("</")
+ .Append (tag)
+ .Append (">");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityException.cs b/mcs/class/corlib/System.Security/SecurityException.cs
new file mode 100644
index 00000000000..aaa0086bbe2
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityException.cs
@@ -0,0 +1,79 @@
+//
+// System.Security.SecurityException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public class SecurityException : SystemException {
+
+ // Fields
+ string permissionState;
+ Type permissionType;
+
+ // Properties
+ public string PermissionState
+ {
+ get { return permissionState; }
+ }
+
+ public Type PermissionType
+ {
+ get { return permissionType; }
+ }
+
+ // Constructors
+ public SecurityException ()
+ : base (Locale.GetText ("A security error has been detected."))
+ {
+ }
+
+ public SecurityException (string message)
+ : base (message)
+ {
+ }
+
+ protected SecurityException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ permissionState = info.GetString ("permissionState");
+ }
+
+ public SecurityException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public SecurityException (string message, Type type)
+ : base (message)
+ {
+ permissionType = type;
+ }
+
+ public SecurityException (string message, Type type, string state)
+ : base (message)
+ {
+ permissionType = type;
+ permissionState = state;
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("PermissionState", permissionState);
+ }
+
+ public override string ToString ()
+ {
+ return permissionType.FullName + ": " + permissionState;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs
new file mode 100644
index 00000000000..d29a2845c63
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityManager.cs
@@ -0,0 +1,88 @@
+//
+// System.Security.SecurityManager.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+using System.Collections;
+
+namespace System.Security {
+
+ public sealed class SecurityManager {
+ private static bool checkExecutionRights;
+ private static bool securityEnabled;
+
+ private SecurityManager () {}
+
+ public static bool CheckExecutionRights {
+ get{
+ return checkExecutionRights;
+ }
+ set{
+ checkExecutionRights = value;
+ }
+ }
+
+ public static bool SecurityEnabled {
+ get{
+ return securityEnabled;
+ }
+ set{
+ securityEnabled = value;
+ }
+ }
+
+ public static bool IsGranted(IPermission perm){
+ return false;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromFile(
+ string path,
+ PolicyLevelType type)
+ {
+ return null;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromString(
+ string str,
+ PolicyLevelType type)
+ {
+ if (null == str){
+ throw new ArgumentNullException("str");
+ }
+ return null;
+ }
+
+ public static IEnumerator PolicyHierarchy(){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(Evidence evidence){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(
+ Evidence evidence,
+ PermissionSet reqdPset,
+ PermissionSet optPset,
+ PermissionSet denyPset,
+ out PermissionSet denied)
+ {
+ denied = null;
+ return null;
+ }
+
+ public static IEnumerator ResolvePolicyGroups(Evidence evidence){
+ return null;
+ }
+
+ public static void SavePolicy(){}
+
+ public static void SavePolicyLevel(PolicyLevel level){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityZone.cs b/mcs/class/corlib/System.Security/SecurityZone.cs
new file mode 100644
index 00000000000..68a7014d5d4
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityZone.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.SecurityZone.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum SecurityZone {
+ MyComputer = 0x0,
+ Intranet,
+ Trusted,
+ Internet,
+ Untrusted,
+ NoZone = -1,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
new file mode 100644
index 00000000000..58ac28dcec5
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
@@ -0,0 +1,15 @@
+//
+// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method |
+ AttributeTargets.Interface)]
+ public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
new file mode 100644
index 00000000000..6cfb5bda372
--- /dev/null
+++ b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
@@ -0,0 +1,14 @@
+//
+// System.Security.UnverifiableCodeAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ [AttributeUsage (AttributeTargets.Module)]
+ public sealed class UnverifiableCodeAttribute : Attribute {}
+}
diff --git a/mcs/class/corlib/System.Security/VerificationException.cs b/mcs/class/corlib/System.Security/VerificationException.cs
new file mode 100644
index 00000000000..277ea55cd37
--- /dev/null
+++ b/mcs/class/corlib/System.Security/VerificationException.cs
@@ -0,0 +1,26 @@
+//
+// System.Security.VerificationException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public class VerificationException : SystemException {
+
+ // Constructors
+ public VerificationException(){}
+ public VerificationException(string message)
+ : base (message){}
+ protected VerificationException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {}
+ public VerificationException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/XmlSyntaxException.cs b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
new file mode 100644
index 00000000000..91e2c5bc9fa
--- /dev/null
+++ b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
@@ -0,0 +1,27 @@
+//
+// System.Security.XmlSyntaxException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public sealed class XmlSyntaxException : SystemException {
+
+ // Constructors
+ public XmlSyntaxException(){}
+ public XmlSyntaxException(int lineNumber)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + "."){}
+ public XmlSyntaxException(int lineNumber, string message)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + " - " + message ){}
+ public XmlSyntaxException(string message)
+ : base (message){}
+ public XmlSyntaxException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}