예제 #1
0
 internal void FromXml( SecurityElement e )
 {
     String elAuth = e.Attribute( "Authenticated" );
     if (elAuth != null)
     {
         m_authenticated = String.Compare( elAuth, "true", true, CultureInfo.InvariantCulture) == 0;
     }
     else
     {
         m_authenticated = false;
     }
    
     String elID = e.Attribute( "ID" );
     if (elID != null)
     {
         m_id = elID;
     }
     else
     {
         m_id = null;
     }
     
     String elRole = e.Attribute( "Role" );
     if (elRole != null)
     {
         m_role = elRole;
     }
     else
     {
         m_role = null;
     }
 }
예제 #2
0
        internal void FromXml(SecurityElement e)
        {
            String elAuth = e.Attribute("Authenticated");

            if (elAuth != null)
            {
                m_authenticated = String.Compare(elAuth, "true", true, CultureInfo.InvariantCulture) == 0;
            }
            else
            {
                m_authenticated = false;
            }

            String elID = e.Attribute("ID");

            if (elID != null)
            {
                m_id = elID;
            }
            else
            {
                m_id = null;
            }

            String elRole = e.Attribute("Role");

            if (elRole != null)
            {
                m_role = elRole;
            }
            else
            {
                m_role = null;
            }
        }
        private void ParseHashValue()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elHash = m_element.Attribute(s_tagHashValue);

                if (elHash != null)
                {
                    m_value = System.Security.Util.Hex.DecodeHexString(elHash);
                }
                else
                {
                    throw new ArgumentException(String.Format(Environment.GetResourceString("Argument_InvalidXMLElement"), s_tagHashValue, this.GetType().FullName));
                }

                if (m_value != null && m_hashAlg != null)
                {
                    m_element = null;
                }
            }
        }
예제 #4
0
        /// <include file='doc\RegistryPermission.uex' path='docs/doc[@for="RegistryPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String et;

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_unrestricted = true;
                return;
            }


            m_unrestricted = false;

            et = esd.Attribute("Read");
            if (et != null)
            {
                m_read = new StringExpressionSet(et);
            }

            et = esd.Attribute("Write");
            if (et != null)
            {
                m_write = new StringExpressionSet(et);
            }

            et = esd.Attribute("Create");
            if (et != null)
            {
                m_create = new StringExpressionSet(et);
            }
        }
예제 #5
0
        /// <include file='doc\StrongNameIdentityPermission.uex' path='docs/doc[@for="StrongNameIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement e)
        {
            CodeAccessPermission.ValidateElement(e, this);
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            String elBlob = e.Attribute("PublicKeyBlob");

            if (elBlob != null)
            {
                m_publicKeyBlob = new StrongNamePublicKeyBlob(Hex.DecodeHexString(elBlob));
            }
            else
            {
                m_publicKeyBlob = null;
            }

            String elName = e.Attribute("Name");

            m_name = elName == null ? null : elName;

            String elVersion = e.Attribute("AssemblyVersion");

            m_version = elVersion == null ? null : new Version(elVersion);
        }
예제 #6
0
        internal void FromXml(SecurityElement e)
        {
            String elAuth = e.Attribute("Authenticated");

            if (elAuth != null)
            {
                m_authenticated = String.Compare(elAuth, "true", StringComparison.OrdinalIgnoreCase) == 0;
            }
            else
            {
                m_authenticated = false;
            }

            String elID = e.Attribute("ID");

            if (elID != null)
            {
                m_id = elID;
            }
            else
            {
                m_id = null;
            }

            String elRole = e.Attribute("Role");

            if (elRole != null)
            {
                m_role = elRole;
            }
            else
            {
                m_role = null;
            }
        }
 internal void FromXml( SecurityElement e )
 {
     String elAuth = e.Attribute( "Authenticated" );
     if (elAuth != null)
     {
         m_authenticated = String.Compare( elAuth, "true", StringComparison.OrdinalIgnoreCase) == 0;
     }
     else
     {
         m_authenticated = false;
     }
    
     String elID = e.Attribute( "ID" );
     if (elID != null)
     {
         m_id = elID;
     }
     else
     {
         m_id = null;
     }
     
     String elRole = e.Attribute( "Role" );
     if (elRole != null)
     {
         m_role = elRole;
     }
     else
     {
         m_role = null;
     }
 }
예제 #8
0
        /// <include file='doc\FileIOPermission.uex' path='docs/doc[@for="FileIOPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String et;

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_unrestricted = true;
                return;
            }


            m_unrestricted = false;

            et = esd.Attribute("Read");
            if (et != null)
            {
                m_read = new FileIOAccess(et);
            }
            else
            {
                m_read = null;
            }

            et = esd.Attribute("Write");
            if (et != null)
            {
                m_write = new FileIOAccess(et);
            }
            else
            {
                m_write = null;
            }

            et = esd.Attribute("Append");
            if (et != null)
            {
                m_append = new FileIOAccess(et);
            }
            else
            {
                m_append = null;
            }

            et = esd.Attribute("PathDiscovery");
            if (et != null)
            {
                m_pathDiscovery = new FileIOAccess(et);
                m_pathDiscovery.PathDiscovery = true;
            }
            else
            {
                m_pathDiscovery = null;
            }
        }
        public override void FromXml(SecurityElement e)
        {
            m_unrestricted = false;
            m_strongNames  = null;
            CodeAccessPermission.ValidateElement(e, this);
            String unr = e.Attribute("Unrestricted");

            if (unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
            {
                m_unrestricted = true;
                return;
            }
            String             elBlob    = e.Attribute("PublicKeyBlob");
            String             elName    = e.Attribute("Name");
            String             elVersion = e.Attribute("AssemblyVersion");
            StrongName2        sn;
            List <StrongName2> al = new List <StrongName2>();

            if (elBlob != null || elName != null || elVersion != null)
            {
                sn = new StrongName2(
                    (elBlob == null ? null : new StrongNamePublicKeyBlob(elBlob)),
                    elName,
                    (elVersion == null ? null : new Version(elVersion)));
                al.Add(sn);
            }
            ArrayList alChildren = e.Children;

            if (alChildren != null)
            {
                foreach (SecurityElement child in alChildren)
                {
                    elBlob    = child.Attribute("PublicKeyBlob");
                    elName    = child.Attribute("Name");
                    elVersion = child.Attribute("AssemblyVersion");
                    if (elBlob != null || elName != null || elVersion != null)
                    {
                        sn = new StrongName2(
                            (elBlob == null ? null : new StrongNamePublicKeyBlob(elBlob)),
                            elName,
                            (elVersion == null ? null : new Version(elVersion)));
                        al.Add(sn);
                    }
                }
            }
            if (al.Count != 0)
            {
                m_strongNames = al.ToArray();
            }
        }
예제 #10
0
        private void ParseZone()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String eZone = m_element.Attribute("Zone");

                m_zone = SecurityZone.NoZone;
                if (eZone != null)
                {
                    m_zone = (SecurityZone)Enum.Parse(typeof(SecurityZone), eZone);
                }
                else
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_ZoneCannotBeNull"));
                }
                VerifyZone(m_zone);

                m_element = null;
            }
        }
예제 #11
0
        /// <include file='doc\URLIdentityPermission.uex' path='docs/doc[@for="UrlIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String elem = esd.Attribute("Url");

            m_url = elem == null ? null : new URLString(elem, true);
        }
예제 #12
0
        /// <include file='doc\SiteIdentityPermission.uex' path='docs/doc[@for="SiteIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String elem = esd.Attribute("Site");

            m_site = elem == null ? null : new SiteString(elem);
        }
        /// <include file='doc\PublisherIdentityPermission.uex' path='docs/doc[@for="PublisherIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String elem = esd.Attribute("X509v3Certificate");

            m_certificate = elem == null ? null : new X509Certificate(System.Security.Util.Hex.DecodeHexString(elem));
        }
예제 #14
0
        static public void ReadTransformEx(System.Security.SecurityElement node, Transform trans)
        {
            Vector3 p = Vector3.zero;

            ReadVector3(node.Attribute("P"), ref p);

            Vector3 r = Vector3.zero;

            ReadVector3(node.Attribute("R"), ref r);

            Vector3 s = Vector3.one;

            ReadVector3(node.Attribute("S"), ref s);

            trans.localPosition = p;
            trans.localScale    = s;
            trans.localRotation = Quaternion.Euler(r);
        }
예제 #15
0
        private void ParseName()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elSite = m_element.Attribute(s_tagName);
                m_name = elSite == null ? null : elSite;

                if ((Object)m_version != null && m_name != null && m_publicKeyBlob != null)
                {
                    m_element = null;
                }
            }
        }
예제 #16
0
        /// <summary>
        /// Verifica se o SecurityElement não tem restrição.
        /// </summary>
        /// <param name="el"></param>
        /// <returns></returns>
        public static bool IsUnrestricted(System.Security.SecurityElement el)
        {
            string str = el.Attribute("Unrestricted");

            if (str == null)
            {
                return(false);
            }
            if (!str.Equals("true") && !str.Equals("TRUE"))
            {
                return(str.Equals("True"));
            }
            return(true);
        }
예제 #17
0
        /// <include file='doc\ZoneIdentityPermission.uex' path='docs/doc[@for="ZoneIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String eZone = esd.Attribute("Zone");

            if (eZone == null)
            {
                m_zone = SecurityZone.NoZone;
            }
            else
            {
                m_zone = (SecurityZone)Enum.Parse(typeof(SecurityZone), eZone);
            }
        }
        public override void FromXml(SecurityElement esd)
        {
            m_unrestricted = false;
            m_certs        = null;
            CodeAccessPermission.ValidateElement(esd, this);
            String unr = esd.Attribute("Unrestricted");

            if (unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
            {
                m_unrestricted = true;
                return;
            }
            String    elem = esd.Attribute("X509v3Certificate");
            ArrayList al   = new ArrayList();

            if (elem != null)
            {
                al.Add(new X509Certificate(System.Security.Util.Hex.DecodeHexString(elem)));
            }
            ArrayList alChildren = esd.Children;

            if (alChildren != null)
            {
                foreach (SecurityElement child in alChildren)
                {
                    elem = child.Attribute("X509v3Certificate");
                    if (elem != null)
                    {
                        al.Add(new X509Certificate(System.Security.Util.Hex.DecodeHexString(elem)));
                    }
                }
            }
            if (al.Count != 0)
            {
                m_certs = (X509Certificate[])al.ToArray(typeof(X509Certificate));
            }
        }
예제 #19
0
        public override void FromXml(SecurityElement esd)
        {
            m_unrestricted = false;
            m_sites        = null;
            CodeAccessPermission.ValidateElement(esd, this);
            String unr = esd.Attribute("Unrestricted");

            if (unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
            {
                m_unrestricted = true;
                return;
            }
            String            elem = esd.Attribute("Site");
            List <SiteString> al   = new List <SiteString>();

            if (elem != null)
            {
                al.Add(new SiteString(elem));
            }
            ArrayList alChildren = esd.Children;

            if (alChildren != null)
            {
                foreach (SecurityElement child in alChildren)
                {
                    elem = child.Attribute("Site");
                    if (elem != null)
                    {
                        al.Add(new SiteString(elem));
                    }
                }
            }
            if (al.Count != 0)
            {
                m_sites = al.ToArray();
            }
        }
예제 #20
0
        private void ParseCertificate()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elCert = m_element.Attribute("X509Certificate");
                m_certificate = elCert == null ? null : new X509Certificate(System.Security.Util.Hex.DecodeHexString(elCert));
                CheckCertificate(m_certificate);
                m_element = null;
            }
        }
예제 #21
0
        private void ParseSite()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elSite = m_element.Attribute("Site");
                if (elSite == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_SiteCannotBeNull"));
                }
                else
                {
                    m_site = new SiteString(elSite);
                }
                m_element = null;
            }
        }
예제 #22
0
        private void ParseURL()
        {
            lock (this)
            {
                if (m_element == null)
                {
                    return;
                }

                String elurl = m_element.Attribute("Url");
                if (elurl == null)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_UrlCannotBeNull"));
                }
                else
                {
                    m_url = new URLString(elurl, true);
                }

                m_element = null;
            }
        }
        public override void FromXml(SecurityElement esd)
        {
            m_zones = 0;
            CodeAccessPermission.ValidateElement(esd, this);
            String eZone = esd.Attribute("Zone");

            if (eZone != null)
            {
                SecurityZone = (SecurityZone)Enum.Parse(typeof(SecurityZone), eZone);
            }
            if (esd.Children != null)
            {
                foreach (SecurityElement child in esd.Children)
                {
                    eZone = child.Attribute("Zone");
                    int enm = (int)Enum.Parse(typeof(SecurityZone), eZone);
                    if (enm == (int)SecurityZone.NoZone)
                    {
                        continue;
                    }
                    m_zones |= ((uint)1 << enm);
                }
            }
        }
예제 #24
0
        [System.Security.SecuritySafeCritical]  // auto-generated 
        public override void FromXml(SecurityElement esd) 
        {
            CodeAccessPermission.ValidateElement( esd, this ); 
            String et;

            if (XMLUtil.IsUnrestricted( esd ))
            { 
                m_unrestricted = true;
                return; 
            } 

            m_unrestricted = false; 
            m_read = null;
            m_write = null;
            m_create = null;
            m_viewAcl = null; 
            m_changeAcl = null;
 
            et = esd.Attribute( "Read" ); 
            if (et != null)
            { 
                m_read = new StringExpressionSet( et );
            }

            et = esd.Attribute( "Write" ); 
            if (et != null)
            { 
                m_write = new StringExpressionSet( et ); 
            }
 
            et = esd.Attribute( "Create" );
            if (et != null)
            {
                m_create = new StringExpressionSet( et ); 
            }
 
            et = esd.Attribute( "ViewAccessControl" ); 
            if (et != null)
            { 
                m_viewAcl = new StringExpressionSet( et );
            }

            et = esd.Attribute( "ChangeAccessControl" ); 
            if (et != null)
            { 
                m_changeAcl = new StringExpressionSet( et ); 
            }
        } 
 public override void FromXml(SecurityElement e)
 {
     m_unrestricted = false;
     m_strongNames = null;
     CodeAccessPermission.ValidateElement( e, this );
     String unr = e.Attribute( "Unrestricted" );
     if(unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
     {
         m_unrestricted = true;
         return;
     }
     String elBlob = e.Attribute("PublicKeyBlob");
     String elName = e.Attribute("Name");
     String elVersion = e.Attribute("AssemblyVersion");
     StrongName2 sn;
     ArrayList al = new ArrayList();
     if(elBlob != null || elName != null || elVersion != null)
     {
         sn = new StrongName2(
                             (elBlob == null ? null : new StrongNamePublicKeyBlob(elBlob)), 
                             elName, 
                             (elVersion == null ? null : new Version(elVersion)));
         al.Add(sn);
     }
     ArrayList alChildren = e.Children;
     if(alChildren != null)
     {
         foreach(SecurityElement child in alChildren)
         {
             elBlob = child.Attribute("PublicKeyBlob");
             elName = child.Attribute("Name");
             elVersion = child.Attribute("AssemblyVersion");
             if(elBlob != null || elName != null || elVersion != null)
             {
                 sn = new StrongName2(
                                     (elBlob == null ? null : new StrongNamePublicKeyBlob(elBlob)), 
                                     elName, 
                                     (elVersion == null ? null : new Version(elVersion)));
                 al.Add(sn);
             }
         }
     }
     if(al.Count != 0)
         m_strongNames = (StrongName2[])al.ToArray(typeof(StrongName2));
 }
예제 #26
0
 public override void FromXml(SecurityElement esd) 
 { 
     m_zones = 0;
     CodeAccessPermission.ValidateElement( esd, this ); 
     String eZone = esd.Attribute( "Zone" );
     if (eZone != null)
         SecurityZone = (SecurityZone)Enum.Parse( typeof( SecurityZone ), eZone );
     if(esd.Children != null) 
     {
         foreach(SecurityElement child in esd.Children) 
         { 
             eZone = child.Attribute( "Zone" );
             int enm = (int)Enum.Parse( typeof( SecurityZone ), eZone ); 
             if(enm == (int)SecurityZone.NoZone)
                 continue;
             m_zones |= ((uint)1 << enm);
         } 
     }
 } 
예제 #27
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        public override void FromXml(SecurityElement esd)
        {
            CodeAccessPermission.ValidateElement(esd, this);
            String et;

            if (XMLUtil.IsUnrestricted(esd))
            {
                m_unrestricted = true;
                return;
            }


            m_unrestricted = false;

            et = esd.Attribute("Read");
            if (et != null)
            {
                m_read = new FileIOAccess(et);
            }
            else
            {
                m_read = null;
            }

            et = esd.Attribute("Write");
            if (et != null)
            {
                m_write = new FileIOAccess(et);
            }
            else
            {
                m_write = null;
            }

            et = esd.Attribute("Append");
            if (et != null)
            {
                m_append = new FileIOAccess(et);
            }
            else
            {
                m_append = null;
            }

            et = esd.Attribute("PathDiscovery");
            if (et != null)
            {
                m_pathDiscovery = new FileIOAccess(et);
                m_pathDiscovery.PathDiscovery = true;
            }
            else
            {
                m_pathDiscovery = null;
            }

            et = esd.Attribute("ViewAcl");
            if (et != null)
            {
                m_viewAcl = new FileIOAccess(et);
            }
            else
            {
                m_viewAcl = null;
            }

            et = esd.Attribute("ChangeAcl");
            if (et != null)
            {
                m_changeAcl = new FileIOAccess(et);
            }
            else
            {
                m_changeAcl = null;
            }
        }
예제 #28
0
 /// <include file='doc\ZoneIdentityPermission.uex' path='docs/doc[@for="ZoneIdentityPermission.FromXml"]/*' />
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement( esd, this );
     String eZone = esd.Attribute( "Zone" );
     if (eZone == null)
     {
         m_zone = SecurityZone.NoZone;
     }
     else
     {
         m_zone = (SecurityZone)Enum.Parse( typeof( SecurityZone ), eZone );
     }
 }
예제 #29
0
 /// <include file='doc\SiteIdentityPermission.uex' path='docs/doc[@for="SiteIdentityPermission.FromXml"]/*' />
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement( esd, this );
     String elem = esd.Attribute( "Site" );
     m_site = elem == null ? null : new SiteString( elem );
     
 }
 public override void FromXml(SecurityElement esd)
 {
     m_unrestricted = false;
     m_certs = null;
     CodeAccessPermission.ValidateElement( esd, this );
     String unr = esd.Attribute( "Unrestricted" );
     if(unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
     {
         m_unrestricted = true;
         return;
     }
     String elem = esd.Attribute( "X509v3Certificate" );
     ArrayList al = new ArrayList();
     if(elem != null)
         al.Add(new X509Certificate(System.Security.Util.Hex.DecodeHexString(elem)));
     ArrayList alChildren = esd.Children;
     if(alChildren != null)
     {
         foreach(SecurityElement child in alChildren)
         {
             elem = child.Attribute( "X509v3Certificate" );
             if(elem != null)
                 al.Add(new X509Certificate(System.Security.Util.Hex.DecodeHexString(elem)));
         }
     }
     if(al.Count != 0)
         m_certs = (X509Certificate[])al.ToArray(typeof(X509Certificate));
 }
예제 #31
0
 /// <include file='doc\URLIdentityPermission.uex' path='docs/doc[@for="UrlIdentityPermission.FromXml"]/*' />
 public override void FromXml(SecurityElement esd)
 {
     CodeAccessPermission.ValidateElement( esd, this );
     String elem = esd.Attribute( "Url" );
     m_url = elem == null ? null : new URLString( elem, true );
     
 }
 public override void FromXml(SecurityElement esd)
 {
     m_unrestricted = false;
     m_urls = null;
     CodeAccessPermission.ValidateElement( esd, this );
     String unr = esd.Attribute( "Unrestricted" );
     if(unr != null && String.Compare(unr, "true", StringComparison.OrdinalIgnoreCase) == 0)
     {
         m_unrestricted = true;
         return;
     }
     String elem = esd.Attribute( "Url" );
     List<URLString> al = new List<URLString>();
     if(elem != null)
         al.Add(new URLString( elem, true ));
     ArrayList alChildren = esd.Children;
     if(alChildren != null)
     {
         foreach(SecurityElement child in alChildren)
         {
             elem = child.Attribute( "Url" );
             if(elem != null)
                 al.Add(new URLString( elem, true ));
         }
     }
     if(al.Count != 0)
         m_urls = al.ToArray();
 }
예제 #33
0
        /// <include file='doc\StrongNameIdentityPermission.uex' path='docs/doc[@for="StrongNameIdentityPermission.FromXml"]/*' />
        public override void FromXml(SecurityElement e)
        {
            CodeAccessPermission.ValidateElement( e, this );
            if (e == null) 
                throw new ArgumentNullException( "e" );

            String elBlob = e.Attribute( "PublicKeyBlob" );
            if (elBlob != null)
            {
                m_publicKeyBlob = new StrongNamePublicKeyBlob( elBlob );
            }
            else
            {  
                m_publicKeyBlob = null;
            }
            
            String elName = e.Attribute( "Name" );
            m_name = elName == null ? null : elName;
            
            String elVersion = e.Attribute( "AssemblyVersion" );
            m_version = elVersion == null ? null : new Version( elVersion );
        }