dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Policy FileCo


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Security/Policy FileCodeGroup.cs,NONE,1.1 FirstMatchCodeGroup.cs,NONE,1.1 Hash.cs,NONE,1.1 HashMembershipCondition.cs,NONE,1.1 NetCodeGroup.cs,NONE,1.1 PermissionRequestEvidence.cs,NONE,1.1 PolicyException.cs,NONE,1.1 Publisher.cs,NONE,1.1 PublisherMembershipCondition.cs,NONE,1.1 Site.cs,NONE,1.1 SiteMembershipCondition.cs,NONE,1.1 StrongName.cs,NONE,1.1 StrongNameMembershipCondition.cs,NONE,1.1 UnionCodeGroup.cs,NONE,1.1 Url.cs,NONE,1.1 UrlMembershipCondition.cs,NONE,1.1 Zone.cs,NONE,1.1 ZoneMembershipCondition.cs,NONE,1.1 PolicyLevel.cs,1.1,1.2
Date: Tue, 22 Apr 2003 00:43:37 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Policy
In directory subversions:/tmp/cvs-serv6147/runtime/System/Security/Policy

Modified Files:
        PolicyLevel.cs 
Added Files:
        FileCodeGroup.cs FirstMatchCodeGroup.cs Hash.cs 
        HashMembershipCondition.cs NetCodeGroup.cs 
        PermissionRequestEvidence.cs PolicyException.cs Publisher.cs 
        PublisherMembershipCondition.cs Site.cs 
        SiteMembershipCondition.cs StrongName.cs 
        StrongNameMembershipCondition.cs UnionCodeGroup.cs Url.cs 
        UrlMembershipCondition.cs Zone.cs ZoneMembershipCondition.cs 
Log Message:


Missing classes in "System.Security.Policy".


--- NEW FILE ---
/*
 * FileCodeGroup.cs - Implementation of the
 *              "System.Security.Policy.FileCodeGroup" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Collections;
using System.Security.Permissions;

[Serializable]
public sealed class FileCodeGroup : CodeGroup
{
        // Internal state.
        private FileIOPermissionAccess access;

        // Constructor.
        public FileCodeGroup(IMembershipCondition membershipCondition,
                                             FileIOPermissionAccess access)
                        : base(membershipCondition, null)
                        {
                                this.access = access;
                        }

        // Properties.
        public override String AttributeString
                        {
                                get
                                {
                                        return null;
                                }
                        }
        public override String MergeLogic
                        {
                                get
                                {
                                        return "Union";
                                }
                        }
        public override String PermissionSetName
                        {
                                get
                                {
                                        return 
String.Format(_("Format_FileIOPermSetName"),
                                                                                
 access.ToString());
                                }
                        }

        // Make a copy of this code group.
        public override CodeGroup Copy()
                        {
                                FileCodeGroup group;
                                group = new FileCodeGroup(MembershipCondition, 
access);
                                group.Name = Name;
                                group.Description = Description;
                                IList children = Children;
                                if(children != null)
                                {
                                        foreach(CodeGroup child in children)
                                        {
                                                group.AddChild(child);
                                        }
                                }
                                return group;
                        }

        // Create the XML form of this code group.
        [TODO]
        public override void CreateXml(SecurityElement element, PolicyLevel 
level)
                        {
                                // TODO
                        }

        // Compare two code groups for equality.
        public override bool Equals(Object obj)
                        {
                                FileCodeGroup cg = (obj as FileCodeGroup);
                                if(cg != null)
                                {
                                        if(!base.Equals(cg))
                                        {
                                                return false;
                                        }
                                        return (cg.access == access);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return base.GetHashCode();
                        }

        // Resolve the policy for this code group.
        [TODO]
        public override PolicyStatement Resolve(Evidence evidence)
                        {
                                if(evidence == null)
                                {
                                        throw new 
ArgumentNullException("evidence");
                                }
                                // TODO
                                return PolicyStatement;
                        }

        // Resolve code groups that match specific evidence.
        [TODO]
        public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
                        {
                                // TODO
                                return null;
                        }

        // Parse the XML form of this code group.
        [TODO]
        public override void ParseXml(SecurityElement element, PolicyLevel 
level)
                        {
                                // TODO
                        }

}; // class FileCodeGroup

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * FirstMatchCodeGroup.cs - Implementation of the
 *              "System.Security.Policy.FirstMatchCodeGroup" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Collections;
using System.Security.Permissions;

[Serializable]
public sealed class FirstMatchCodeGroup : CodeGroup
{
        // Constructor.
        public FirstMatchCodeGroup(IMembershipCondition membershipCondition,
                                                   PolicyStatement policy)
                        : base(membershipCondition, policy)
                        {
                                // Nothing to do here.
                        }

        // Properties.
        public override String MergeLogic
                        {
                                get
                                {
                                        return "First Match";
                                }
                        }

        // Make a copy of this code group.
        public override CodeGroup Copy()
                        {
                                FirstMatchCodeGroup group;
                                group = new FirstMatchCodeGroup
                                        (MembershipCondition, PolicyStatement);
                                group.Name = Name;
                                group.Description = Description;
                                IList children = Children;
                                if(children != null)
                                {
                                        foreach(CodeGroup child in children)
                                        {
                                                group.AddChild(child);
                                        }
                                }
                                return group;
                        }

        // Resolve the policy for this code group.
        [TODO]
        public override PolicyStatement Resolve(Evidence evidence)
                        {
                                if(evidence == null)
                                {
                                        throw new 
ArgumentNullException("evidence");
                                }
                                // TODO
                                return PolicyStatement;
                        }

        // Resolve code groups that match specific evidence.
        [TODO]
        public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
                        {
                                // TODO
                                return null;
                        }

}; // class FirstMatchCodeGroup

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * Hash.cs - Implementation of the
 *              "System.Security.Policy.Hash" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Reflection;
using System.Runtime.Serialization;
using System.Security.Cryptography;

[Serializable]
public sealed class Hash : ISerializable
{
        // Internal state.
        private Assembly assembly;
        private byte[] md5;
        private byte[] sha1;
        private byte[] dataToHash;

        // Constructor.
        public Hash(Assembly assembly)
                        {
                                if(assembly == null)
                                {
                                        throw new 
ArgumentNullException("assembly");
                                }
                                this.assembly = assembly;
                        }
        [TODO]
        internal Hash(SerializationInfo info, StreamingContext context)
                        {
                                // TODO
                        }

        // Get the MD5 hash value for the assembly.
        public byte[] MD5
                        {
                                get
                                {
                                        if(md5 == null)
                                        {
                                                md5 = 
GenerateHash(MD5.Create());
                                        }
                                        return md5;
                                }
                        }

        // Get the SHA1 hash value for the assembly.
        public byte[] SHA1
                        {
                                get
                                {
                                        if(sha1 == null)
                                        {
                                                sha1 = 
GenerateHash(SHA1.Create());
                                        }
                                        return sha1;
                                }
                        }

        // Generate the hash value for this assembly using a given algorith.
        [TODO]
        public byte[] GenerateHash(HashAlgorithm hashAlg)
                        {
                                if(hashAlg == null)
                                {
                                        throw new 
ArgumentNullException("hashAlg");
                                }
                                if(dataToHash == null)
                                {
                                        // TODO: get the data to be hashed.
                                }
                                hashAlg.Initialize();
                                return hashAlg.ComputeHash(dataToHash);
                        }

        // Implement the ISerialization interface.
        [TODO]
        public void GetObjectData(SerializationInfo info, StreamingContext 
context)
                        {
                                // TODO
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

}; // class Hash

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * HashMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.HashMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;
using System.Security.Cryptography;

[Serializable]
public sealed class HashMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private HashAlgorithm hashAlg;
        private byte[] value;

        // Constructor.
        public HashMembershipCondition(HashAlgorithm hashAlg, byte[] value)
                        {
                                if(hashAlg == null)
                                {
                                        throw new 
ArgumentNullException("hashAlg");
                                }
                                if(value == null)
                                {
                                        throw new 
ArgumentNullException("value");
                                }
                                this.hashAlg = hashAlg;
                                this.value = value;
                        }

        // Get or set this object's properties.
        public HashAlgorithm HashAlgorithm
                        {
                                get
                                {
                                        return hashAlg;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        hashAlg = value;
                                }
                        }
        public byte[] HashValue
                        {
                                get
                                {
                                        return value;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        this.value = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new HashMembershipCondition(hashAlg, 
value);
                        }
        public override bool Equals(Object obj)
                        {
                                HashMembershipCondition other;
                                other = (obj as HashMembershipCondition);
                                if(other != null)
                                {
                                        if(other.hashAlg.GetType() != 
hashAlg.GetType())
                                        {
                                                return false;
                                        }
                                        if(other.value.Length != value.Length)
                                        {
                                                return false;
                                        }
                                        int posn;
                                        for(posn = 0; posn < value.Length; 
++posn)
                                        {
                                                if(other.value[posn] != 
value[posn])
                                                {
                                                        return false;
                                                }
                                        }
                                        return true;
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                int hash = 0;
                                int posn;
                                for(posn = 0; posn < value.Length; ++posn)
                                {
                                        hash = (hash << 5) + hash + value[posn];
                                }
                                return hash;
                        }

}; // class HashMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * NetCodeGroup.cs - Implementation of the
 *              "System.Security.Policy.NetCodeGroup" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Collections;
using System.Security.Permissions;

[Serializable]
public sealed class NetCodeGroup : CodeGroup
{
        // Constructor.
        public NetCodeGroup(IMembershipCondition membershipCondition)
                        : base(membershipCondition, null)
                        {
                                // Nothing to do here.
                        }

        // Properties.
        public override String AttributeString
                        {
                                get
                                {
                                        return null;
                                }
                        }
        public override String MergeLogic
                        {
                                get
                                {
                                        return "Union";
                                }
                        }
        public override String PermissionSetName
                        {
                                get
                                {
                                        return _("Format_NetCodeGroupName");
                                }
                        }

        // Make a copy of this code group.
        public override CodeGroup Copy()
                        {
                                NetCodeGroup group;
                                group = new NetCodeGroup(MembershipCondition);
                                group.Name = Name;
                                group.Description = Description;
                                IList children = Children;
                                if(children != null)
                                {
                                        foreach(CodeGroup child in children)
                                        {
                                                group.AddChild(child);
                                        }
                                }
                                return group;
                        }

        // Compare two code groups for equality.
        public override bool Equals(Object obj)
                        {
                                NetCodeGroup cg = (obj as NetCodeGroup);
                                if(cg != null)
                                {
                                        return base.Equals(cg);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return base.GetHashCode();
                        }

        // Resolve the policy for this code group.
        [TODO]
        public override PolicyStatement Resolve(Evidence evidence)
                        {
                                if(evidence == null)
                                {
                                        throw new 
ArgumentNullException("evidence");
                                }
                                // TODO
                                return PolicyStatement;
                        }

        // Resolve code groups that match specific evidence.
        [TODO]
        public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
                        {
                                // TODO
                                return null;
                        }

}; // class NetCodeGroup

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * PermissionRequestEvidence.cs - Implementation of the
 *                      "System.Security.Policy.PermissionRequestEvidence" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

[Serializable]
public sealed class PermissionRequestEvidence
{
        // Internal state.
        private PermissionSet request;
        private PermissionSet optional;
        private PermissionSet denied;

        // Constructor
        public PermissionRequestEvidence(PermissionSet request,
                                                                         
PermissionSet optional,
                                                                         
PermissionSet denied)
                        {
                                this.request = request;
                                this.optional = optional;
                                this.denied = denied;
                        }

        // Get this object's properties.
        public PermissionSet DeniedPermissions
                        {
                                get
                                {
                                        return denied;
                                }
                        }
        public PermissionSet OptionalPermissions
                        {
                                get
                                {
                                        return optional;
                                }
                        }
        public PermissionSet RequestedPermissions
                        {
                                get
                                {
                                        return request;
                                }
                        }

        // Create a copy of this object.
        public PermissionRequestEvidence Copy()
                        {
                                return new PermissionRequestEvidence
                                        (request, optional, denied);
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

}; // class PermissionRequestEvidence

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * PolicyException.cs - Implementation of the
 *              "System.Security.PolicyException" class.
 *
 * Copyright (C) 2001, 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System;
using System.Runtime.Serialization;

public class PolicyException : SystemException
{
        // Constructors.
        public PolicyException()
                        : base(_("Exception_Policy")) {}
        public PolicyException(String msg)
                        : base(msg) {}
        public PolicyException(String msg, Exception inner)
                        : base(msg, inner) {}
        protected PolicyException(SerializationInfo info,
                                                          StreamingContext 
context)
                        : base(info, context) {}

        // Get the default message to use for this exception type.
        internal override String MessageDefault
                        {
                                get
                                {
                                        return _("Exception_Policy");
                                }
                        }

        // Get the default HResult value for this type of exception.
        internal override uint HResultDefault
                        {
                                get
                                {
                                        return 0x80131416;
                                }
                        }

}; // class PolicyException

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * Publisher.cs - Implementation of the
 *              "System.Security.Policy.Publisher" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;
using System.Security.Cryptography.X509Certificates;

[Serializable]
public sealed class Publisher : IIdentityPermissionFactory
{
        // Internal state.
        private X509Certificate cert;

        // Constructor.
        public Publisher(X509Certificate cert)
                        {
                                if(cert == null)
                                {
                                        throw new ArgumentNullException("cert");
                                }
                                this.cert = cert;
                        }

        // Get this object's value.
        public X509Certificate Certificate
                        {
                                get
                                {
                                        return cert;
                                }
                        }

        // Make a copy of this object.
        public Object Copy()
                        {
                                return new Publisher(cert);
                        }

        // Implement the IIdentityPermissionFactory interface
        public IPermission CreateIdentityPermission(Evidence evidence)
                        {
                                return new PublisherIdentityPermission(cert);
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                Publisher other = (obj as Publisher);
                                if(other != null)
                                {
                                        return (other.cert.Equals(cert));
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return cert.GetHashCode();
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return cert.ToString();
                        }

}; // class Publisher

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * PublisherMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.PublisherMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;
using System.Security.Cryptography.X509Certificates;

[Serializable]
public sealed class PublisherMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private X509Certificate certificate;

        // Constructor.
        public PublisherMembershipCondition(X509Certificate certificate)
                        {
                                if(certificate == null)
                                {
                                        throw new 
ArgumentNullException("certificate");
                                }
                                this.certificate = certificate;
                        }

        // Get or set this object's properties.
        public X509Certificate Certificate
                        {
                                get
                                {
                                        return certificate;
                                }
                                set
                                {
                                        if(certificate == null)
                                        {
                                                throw new 
ArgumentNullException("certificate");
                                        }
                                        certificate = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new 
PublisherMembershipCondition(certificate);
                        }
        public override bool Equals(Object obj)
                        {
                                PublisherMembershipCondition other;
                                other = (obj as PublisherMembershipCondition);
                                if(other != null)
                                {
                                        return 
(other.certificate.Equals(certificate));
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return certificate.GetHashCode();
                        }

}; // class PublisherMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * Site.cs - Implementation of the
 *              "System.Security.Policy.Site" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class Site : IIdentityPermissionFactory
{
        // Internal state.
        private String name;

        // Constructor.
        public Site(String name)
                        {
                                if(name == null)
                                {
                                        throw new ArgumentNullException("name");
                                }
                                this.name = name;
                        }

        // Get this object's value.
        public String Name
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Make a copy of this object.
        public Object Copy()
                        {
                                return new Site(name);
                        }

        // Create a new site from a URL.
        public static Site CreateFromUrl(String url)
                        {
                                if(url == null)
                                {
                                        throw new ArgumentNullException("url");
                                }
                                // TODO
                                return null;
                        }

        // Implement the IIdentityPermissionFactory interface
        public IPermission CreateIdentityPermission(Evidence evidence)
                        {
                                return new SiteIdentityPermission(name);
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                Site other = (obj as Site);
                                if(other != null)
                                {
                                        return (other.name == name);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return name.GetHashCode();
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return name;
                        }

}; // class Site

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * SiteMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.SiteMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class SiteMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private String site;

        // Constructor.
        public SiteMembershipCondition(String site)
                        {
                                if(site == null)
                                {
                                        throw new ArgumentNullException("site");
                                }
                                this.site = site;
                        }

        // Get or set this object's properties.
        public String Site
                        {
                                get
                                {
                                        return site;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        site = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new SiteMembershipCondition(site);
                        }
        public override bool Equals(Object obj)
                        {
                                SiteMembershipCondition other;
                                other = (obj as SiteMembershipCondition);
                                if(other != null)
                                {
                                        return (other.site == site);
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return site.GetHashCode();
                        }

}; // class SiteMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * StrongName.cs - Implementation of the
 *              "System.Security.Policy.StrongName" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class StrongName : IIdentityPermissionFactory
{
        // Internal state.
        private StrongNamePublicKeyBlob blob;
        private String name;
        private Version version;

        // Constructor.
        public StrongName(StrongNamePublicKeyBlob blob,
                                          String name, Version version)
                        {
                                if(blob == null)
                                {
                                        throw new ArgumentNullException("blob");
                                }
                                if(name == null)
                                {
                                        throw new ArgumentNullException("name");
                                }
                                if(version == null)
                                {
                                        throw new 
ArgumentNullException("version");
                                }
                                this.blob = blob;
                                this.name = name;
                                this.version = version;
                        }

        // Get this object's properties.
        public String Name
                        {
                                get
                                {
                                        return name;
                                }
                        }
        public StrongNamePublicKeyBlob PublicKey
                        {
                                get
                                {
                                        return blob;
                                }
                        }
        public Version Version
                        {
                                get
                                {
                                        return version;
                                }
                        }

        // Make a copy of this object.
        public Object Copy()
                        {
                                return new StrongName(blob, name, version);
                        }

        // Implement the IIdentityPermissionFactory interface
        public IPermission CreateIdentityPermission(Evidence evidence)
                        {
                                return new StrongNameIdentityPermission(blob, 
name, version);
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                StrongName other = (obj as StrongName);
                                if(other != null)
                                {
                                        return (other.blob.Equals(blob) &&
                                                other.name == name &&
                                                        
other.version.Equals(version));
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return name.GetHashCode();
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

}; // class StrongName

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * StrongNameMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.StrongNameMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class StrongNameMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private StrongNamePublicKeyBlob blob;
        private String name;
        private Version version;

        // Constructor.
        public StrongNameMembershipCondition
                                (StrongNamePublicKeyBlob blob, String name, 
Version version)
                        {
                                if(blob == null)
                                {
                                        throw new ArgumentNullException("blob");
                                }
                                this.blob = blob;
                                this.name = name;
                                this.version = version;
                        }

        // Get or set this object's properties.
        public String Name
                        {
                                get
                                {
                                        return name;
                                }
                                set
                                {
                                        name = value;
                                }
                        }
        public StrongNamePublicKeyBlob PublicKey
                        {
                                get
                                {
                                        return blob;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        blob = value;
                                }
                        }
        public Version Version
                        {
                                get
                                {
                                        return version;
                                }
                                set
                                {
                                        version = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new StrongNameMembershipCondition(blob, 
name, version);
                        }
        public override bool Equals(Object obj)
                        {
                                StrongNameMembershipCondition other;
                                other = (obj as StrongNameMembershipCondition);
                                if(other != null)
                                {
                                        return (other.blob.Equals(blob) &&
                                                        other.name == name &&
                                                        other.version == 
version);
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return blob.GetHashCode();
                        }

}; // class StrongNameMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * UnionCodeGroup.cs - Implementation of the
 *              "System.Security.Policy.UnionCodeGroup" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Collections;
using System.Security.Permissions;

[Serializable]
public sealed class UnionCodeGroup : CodeGroup
{
        // Constructor.
        public UnionCodeGroup(IMembershipCondition membershipCondition,
                                              PolicyStatement policy)
                        : base(membershipCondition, policy)
                        {
                                // Nothing to do here.
                        }

        // Properties.
        public override String MergeLogic
                        {
                                get
                                {
                                        return "Union";
                                }
                        }

        // Make a copy of this code group.
        public override CodeGroup Copy()
                        {
                                UnionCodeGroup group;
                                group = new UnionCodeGroup
                                        (MembershipCondition, PolicyStatement);
                                group.Name = Name;
                                group.Description = Description;
                                IList children = Children;
                                if(children != null)
                                {
                                        foreach(CodeGroup child in children)
                                        {
                                                group.AddChild(child);
                                        }
                                }
                                return group;
                        }

        // Resolve the policy for this code group.
        [TODO]
        public override PolicyStatement Resolve(Evidence evidence)
                        {
                                if(evidence == null)
                                {
                                        throw new 
ArgumentNullException("evidence");
                                }
                                // TODO
                                return PolicyStatement;
                        }

        // Resolve code groups that match specific evidence.
        [TODO]
        public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
                        {
                                // TODO
                                return null;
                        }

}; // class UnionCodeGroup

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * Url.cs - Implementation of the
 *              "System.Security.Policy.Url" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class Url : IIdentityPermissionFactory
{
        // Internal state.
        private String name;

        // Constructor.
        public Url(String name)
                        {
                                if(name == null)
                                {
                                        throw new ArgumentNullException("name");
                                }
                                this.name = name;
                        }

        // Get this object's value.
        public String Value
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Make a copy of this object.
        public Object Copy()
                        {
                                return new Url(name);
                        }

        // Implement the IIdentityPermissionFactory interface
        public IPermission CreateIdentityPermission(Evidence evidence)
                        {
                                return new UrlIdentityPermission(name);
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                Url other = (obj as Url);
                                if(other != null)
                                {
                                        return (other.name == name);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return name.GetHashCode();
                        }

        // Convert this object into a string.
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return name;
                        }

}; // class Url

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * UrlMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.UrlMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class UrlMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private String url;

        // Constructor.
        public UrlMembershipCondition(String url)
                        {
                                if(url == null)
                                {
                                        throw new ArgumentNullException("url");
                                }
                                this.url = url;
                        }

        // Get or set this object's properties.
        public String Url
                        {
                                get
                                {
                                        return url;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        url = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new UrlMembershipCondition(url);
                        }
        public override bool Equals(Object obj)
                        {
                                UrlMembershipCondition other;
                                other = (obj as UrlMembershipCondition);
                                if(other != null)
                                {
                                        return (other.url == url);
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return url.GetHashCode();
                        }

}; // class UrlMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * Zone.cs - Implementation of the
 *              "System.Security.Policy.Zone" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class Zone : IIdentityPermissionFactory
{
        // Internal state.
        private SecurityZone zone;

        // Constructor.
        public Zone(SecurityZone zone)
                        {
                                if(((int)zone) < ((int)(SecurityZone.NoZone)) ||
                                   ((int)zone) > 
((int)(SecurityZone.Untrusted)))
                                {
                                        throw new 
ArgumentException(_("Arg_SecurityZone"));
                                }
                                this.zone = zone;
                        }

        // Get the security zone value.
        public SecurityZone SecurityZone
                        {
                                get
                                {
                                        return zone;
                                }
                        }

        // Make a copy of this object.
        public Object Copy()
                        {
                                return new Zone(zone);
                        }

        // Create a new zone from a URL.  We assume that everything is
        // in the "Internet" zone in this implementation.
        public static Zone CreateFromUrl(String url)
                        {
                                if(url == null)
                                {
                                        throw new ArgumentNullException("url");
                                }
                                return new Zone(SecurityZone.Internet);
                        }

        // Implement the IIdentityPermissionFactory interface
        public IPermission CreateIdentityPermission(Evidence evidence)
                        {
                                return new ZoneIdentityPermission(zone);
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                Zone other = (obj as Zone);
                                if(other != null)
                                {
                                        return (other.zone == zone);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return ((int)zone).GetHashCode();
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                return zone.ToString();
                        }

}; // class Zone

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

--- NEW FILE ---
/*
 * ZoneMembershipCondition.cs - Implementation of the
 *              "System.Security.Policy.ZoneMembershipCondition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Security.Policy
{

#if !ECMA_COMPAT

using System.Security.Permissions;

[Serializable]
public sealed class ZoneMembershipCondition
        : IMembershipCondition, ISecurityEncodable, ISecurityPolicyEncodable
{
        // Internal state.
        private SecurityZone zone;

        // Constructor.
        public ZoneMembershipCondition(SecurityZone zone)
                        {
                                this.zone = zone;
                        }

        // Get or set this object's properties.
        public SecurityZone SecurityZone
                        {
                                get
                                {
                                        return zone;
                                }
                                set
                                {
                                        zone = value;
                                }
                        }

        // Implement the IMembership interface.
        [TODO]
        public bool Check(Evidence evidence)
                        {
                                // TODO
                                return true;
                        }
        public IMembershipCondition Copy()
                        {
                                return new ZoneMembershipCondition(zone);
                        }
        public override bool Equals(Object obj)
                        {
                                ZoneMembershipCondition other;
                                other = (obj as ZoneMembershipCondition);
                                if(other != null)
                                {
                                        return (other.zone == zone);
                                }
                                else
                                {
                                        return false;
                                }
                        }
        [TODO]
        public override String ToString()
                        {
                                // TODO
                                return null;
                        }

        // Implement the ISecurityEncodable interface.
        public void FromXml(SecurityElement et)
                        {
                                FromXml(et, null);
                        }
        public SecurityElement ToXml()
                        {
                                return ToXml(null);
                        }

        // Implement the ISecurityPolicyEncodable interface.
        [TODO]
        public void FromXml(SecurityElement et, PolicyLevel level)
                        {
                                // TODO
                        }
        [TODO]
        public SecurityElement ToXml(PolicyLevel level)
                        {
                                // TODO
                                return null;
                        }

        // Get the hash code for this instance.
        public override int GetHashCode()
                        {
                                return ((int)zone);
                        }

}; // class ZoneMembershipCondition

#endif // !ECMA_COMPAT

}; // namespace System.Security.Policy

Index: PolicyLevel.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Security/Policy/PolicyLevel.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** PolicyLevel.cs      29 Mar 2003 01:38:07 -0000      1.1
--- PolicyLevel.cs      22 Apr 2003 04:43:34 -0000      1.2
***************
*** 25,33 ****
  #if !ECMA_COMPAT
  
! [TODO]
! public class PolicyLevel
  {
  
! // TODO
  
  }; // class PolicyLevel
--- 25,237 ----
  #if !ECMA_COMPAT
  
! using System.Collections;
! 
! [Serializable]
! public sealed class PolicyLevel
  {
+       // Internal state.
+       private ArrayList fullTrustAssemblies;
+       private String label;
+       private ArrayList namedPermissionSets;
+       private CodeGroup rootCodeGroup;
+       private String storeLocation;
+ 
+       // Constructor.
+       internal PolicyLevel(String label)
+                       {
+                               this.label = label;
+                               fullTrustAssemblies = new ArrayList();
+                               namedPermissionSets = new ArrayList();
+                       }
+ 
+       // Properties.
+       public IList FullTrustAssemblies
+                       {
+                               get
+                               {
+                                       return fullTrustAssemblies;
+                               }
+                       }
+       public String Label
+                       {
+                               get
+                               {
+                                       return label;
+                               }
+                       }
+       public IList NamedPermissionSets
+                       {
+                               get
+                               {
+                                       return namedPermissionSets;
+                               }
+                       }
+       public CodeGroup RootCodeGroup
+                       {
+                               get
+                               {
+                                       return rootCodeGroup;
+                               }
+                               set
+                               {
+                                       rootCodeGroup = value;
+                               }
+                       }
+       public String StoreLocation
+                       {
+                               get
+                               {
+                                       return storeLocation;
+                               }
+                       }
+ 
+       // Add an entry to the "full trust assembly" list.
+       public void AddFullTrustAssembly(StrongName sn)
+                       {
+                               if(sn == null)
+                               {
+                                       throw new ArgumentNullException("sn");
+                               }
+                               AddFullTrustAssembly
+                                       (new StrongNameMembershipCondition
+                                               (sn.PublicKey, sn.Name, 
sn.Version));
+                       }
+       [TODO]
+       public void AddFullTrustAssembly(StrongNameMembershipCondition snMC)
+                       {
+                               // TODO
+                       }
+ 
+       // Add an entry to the "named permission sets" list.
+       public void AddNamedPermissionSet(NamedPermissionSet permSet)
+                       {
+                               if(permSet == null)
+                               {
+                                       throw new 
ArgumentNullException("permSet");
+                               }
+                               namedPermissionSets.Add(permSet);
+                       }
+ 
+       // Change a named permission set.
+       [TODO]
+       public NamedPermissionSet ChangeNamedPermissionSet
+                               (String name, PermissionSet pSet)
+                       {
+                               if(name == null)
+                               {
+                                       throw new ArgumentNullException("name");
+                               }
+                               if(pSet == null)
+                               {
+                                       throw new ArgumentNullException("pSet");
+                               }
+                               // TODO
+                               return null;
+                       }
+ 
+       // Create a policy level object for the current application domain.
+       public static PolicyLevel CreateAppDomainLevel()
+                       {
+                               return new PolicyLevel("AppDomain");
+                       }
+ 
+       // Load policy information from an XML element.
+       [TODO]
+       public void FromXml(SecurityElement e)
+                       {
+                               // TODO
+                       }
+ 
+       // Get a specific named permission set.
+       public NamedPermissionSet GetNamedPermissionSet(String name)
+                       {
+                               if(name == null)
+                               {
+                                       throw new ArgumentNullException("name");
+                               }
+                               foreach(NamedPermissionSet set in 
namedPermissionSets)
+                               {
+                                       if(set.Name == name)
+                                       {
+                                               return set;
+                                       }
+                               }
+                               return null;
+                       }
+ 
+       // Recover the last backed-up policy configuration.
+       public void Recover()
+                       {
+                               // Nothing to do here: we don't support backups.
+                       }
+ 
+       // Remove an entry from the "full trust assembly" list.
+       [TODO]
+       public void RemoveFullTrustAssembly(StrongName sn)
+                       {
+                               // TODO
+                       }
+       [TODO]
+       public void RevoveFullTrustAssembly(StrongNameMembershipCondition snMC)
+                       {
+                               // TODO
+                       }
+ 
+       // Remove a named permission set.
+       [TODO]
+       public void RemoveNamedPermissionSet(NamedPermissionSet permSet)
+                       {
+                               if(permSet == null)
+                               {
+                                       throw new 
ArgumentNullException("permSet");
+                               }
+                               // TODO
+                       }
+       [TODO]
+       public void RemoveNamedPermissionSet(String name)
+                       {
+                               if(name == null)
+                               {
+                                       throw new ArgumentNullException("name");
+                               }
+                               // TODO
+                       }
+ 
+       // Reset to the default state.
+       [TODO]
+       public void Reset()
+                       {
+                               // TODO
+                       }
+ 
+       // Resolve policy information based on supplied evidence.
+       [TODO]
+       public PolicyStatement Resolve(Evidence evidence)
+                       {
+                               if(evidence == null)
+                               {
+                                       throw new 
ArgumentNullException("evidence");
+                               }
+                               // TODO
+                               return null;
+                       }
+       [TODO]
+       public CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
+                       {
+                               if(evidence == null)
+                               {
+                                       throw new 
ArgumentNullException("evidence");
+                               }
+                               // TODO
+                               return null;
+                       }
  
!       // Convert this object into an XML element.
!       [TODO]
!       public SecurityElement ToXml()
!                       {
!                               // TODO
!                               return null;
!                       }
  
  }; // class PolicyLevel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]