当前位置: 首页>>代码示例>>C#>>正文


C# Security.SecurityElement类代码示例

本文整理汇总了C#中System.Security.SecurityElement的典型用法代码示例。如果您正苦于以下问题:C# System.Security.SecurityElement类的具体用法?C# System.Security.SecurityElement怎么用?C# System.Security.SecurityElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Security.SecurityElement类属于命名空间,在下文中一共展示了System.Security.SecurityElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromXml

 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;
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:32,代码来源:principalpermission.cs

示例2: FromXml

 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;
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:PrincipalPermission.cs

示例3: ToXml

 internal SecurityElement ToXml()
 {
     SecurityElement root = new SecurityElement( "Identity" );
     
     if (m_authenticated)
         root.AddAttribute( "Authenticated", "true" );
         
     if (m_id != null)
     {
         root.AddAttribute( "ID", SecurityElement.Escape( m_id ) );
     }
        
     if (m_role != null)
     {
         root.AddAttribute( "Role", SecurityElement.Escape( m_role ) );
     }
                     
     return root;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:19,代码来源:PrincipalPermission.cs

示例4: FromXml

 internal void FromXml( SecurityElement e )
 {
     SecurityElement elem;
     elem = e.SearchForChildByTag( "Key" );
     if (elem == null || elem.Text == null || elem.Text.Length == 0)
     {
         PublicKey = new byte[0];
     }
     else
     {
         try
         {
             PublicKey = Hex.DecodeHexString( elem.Text );
         }
         catch (Exception)
         {
             PublicKey = new byte[0];
         }
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:20,代码来源:strongnamepublickeyblob.cs

示例5: ToXml

        public SecurityElement ToXml( PolicyLevel level )
        {
            SecurityElement root = new SecurityElement( "IMembershipCondition" );
            System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), "System.Security.Policy.StrongNameMembershipCondition" );
            // If you hit this assert then most likely you are trying to change the name of this class. 
            // This is ok as long as you change the hard coded string above and change the assert below.
            Contract.Assert( this.GetType().FullName.Equals( "System.Security.Policy.StrongNameMembershipCondition" ), "Class name changed!" );

            root.AddAttribute( "version", "1" );
            
            if (PublicKey != null)
                root.AddAttribute( s_tagPublicKeyBlob, System.Security.Util.Hex.EncodeHexString( PublicKey.PublicKey ) );

            if (Name != null)
                root.AddAttribute( s_tagName, Name );

            if ((Object) Version != null)
                root.AddAttribute( s_tagVersion, Version.ToString() );

            return root;

        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:22,代码来源:strongnamemembershipcondition.cs

示例6: FromXml

 public void FromXml( SecurityElement e, PolicyLevel level )
 {
     if (e == null)
         throw new ArgumentNullException("e");
 
     if (!e.Tag.Equals( "IMembershipCondition" ))
     {
         throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
     }
     Contract.EndContractBlock();
     
     lock (this)
     {
         m_name = null;
         m_publicKeyBlob = null;
         m_version = null;
         m_element = e;
     }
 }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:19,代码来源:strongnamemembershipcondition.cs

示例7: FromXml

 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));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:28,代码来源:PublisherIdentityPermission.cs

示例8: FromXml

        [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 ); 
            }
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:49,代码来源:RegistryPermission.cs

示例9: ToXml

 public override SecurityElement ToXml()
 { 
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.ZoneIdentityPermission" );
     if (SecurityZone != SecurityZone.NoZone)
     {
         esd.AddAttribute( "Zone", Enum.GetName( typeof( SecurityZone ), this.SecurityZone ) ); 
     }
     else 
     { 
         int nEnum = 0;
         uint nFlag; 
         for(nFlag = 1; nFlag < AllZones; nFlag <<= 1)
         {
             if((m_zones & nFlag) != 0)
             { 
                 SecurityElement child = new SecurityElement("Zone");
                 child.AddAttribute( "Zone", Enum.GetName( typeof( SecurityZone ), (SecurityZone)nEnum ) ); 
                 esd.AddChild(child); 
             }
             nEnum++; 
         }
     }
     return esd;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:24,代码来源:ZoneIdentityPermission.cs

示例10: ToXml

 /// <include file='doc\PrincipalPermission.uex' path='docs/doc[@for="PrincipalPermission.ToXml"]/*' />
 public SecurityElement ToXml()
 {
     SecurityElement root = new SecurityElement( "Permission" );
     
     XMLUtil.AddClassAttribute( root, this.GetType() );
     root.AddAttribute( "version", "1" );
     
     int count = m_array.Length;
     for (int i = 0; i < count; ++i)
     {
         root.AddChild( m_array[i].ToXml() );
     }
     
     return root;
 }
开发者ID:ArildF,项目名称:masters,代码行数:16,代码来源:principalpermission.cs

示例11: FromXml

 public override void FromXml(SecurityElement securityElement) 
 {
     CodeAccessPermission.ValidateElement(securityElement, this); 
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:GACIdentityPermission.cs

示例12: FromXml

 /// <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 );
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:zoneidentitypermission.cs

示例13: FromXml

        /// <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 );
        }
开发者ID:ArildF,项目名称:masters,代码行数:23,代码来源:strongnameidentitypermission.cs

示例14: ToXml

 public override SecurityElement ToXml()
 {
     SecurityElement esd = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.PublisherIdentityPermission" );
     if (m_unrestricted)
         esd.AddAttribute( "Unrestricted", "true" );
     else if (m_certs != null)
     {
         if (m_certs.Length == 1)
             esd.AddAttribute( "X509v3Certificate", m_certs[0].GetRawCertDataString() );
         else
         {
             int n;
             for(n = 0; n < m_certs.Length; n++)
             {
                 SecurityElement child = new SecurityElement("Cert");
                 child.AddAttribute( "X509v3Certificate", m_certs[n].GetRawCertDataString() );
                 esd.AddChild(child);
             }
         }
     }
     return esd;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:PublisherIdentityPermission.cs

示例15: FromXml

 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));
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:45,代码来源:strongnameidentitypermission.cs


注:本文中的System.Security.SecurityElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。