/// <summary>Creates an XML encoding of the security object and its current state with the specified <see cref="T:System.Security.Policy.PolicyLevel" />.</summary> /// <returns>An XML encoding of the security object, including any state information.</returns> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, which is used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> /// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Security.Policy.PublisherMembershipCondition.Certificate" /> property is null. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Create" /> /// </PermissionSet> public SecurityElement ToXml(PolicyLevel level) { SecurityElement securityElement = MembershipConditionHelper.Element(typeof(PublisherMembershipCondition), this.version); securityElement.AddAttribute("X509Certificate", this.x509.GetRawCertDataString()); return(securityElement); }
/// <summary>Creates an XML encoding of the security object and its current state with the specified <see cref="T:System.Security.Policy.PolicyLevel" />.</summary> /// <returns>An XML encoding of the security object, including any state information.</returns> /// <param name="level">The policy level context for resolving named permission set references. </param> /// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Security.Policy.UrlMembershipCondition.Url" /> property is null. </exception> public SecurityElement ToXml(PolicyLevel level) { SecurityElement securityElement = MembershipConditionHelper.Element(typeof(UrlMembershipCondition), this.version); securityElement.AddAttribute("Url", this.userUrl); return(securityElement); }
public SecurityElement ToXml(PolicyLevel level) { SecurityElement se = MembershipConditionHelper.Element(typeof(ApplicationDirectoryMembershipCondition), version); // nothing to add return(se); }
/// <summary>Creates an XML encoding of the security object and its current state with the specified <see cref="T:System.Security.Policy.PolicyLevel" />.</summary> /// <returns>An XML encoding of the security object, including any state information.</returns> /// <param name="level">The policy level context for resolving named permission set references. </param> /// <exception cref="T:System.ArgumentNullException">The <see cref="P:System.Security.Policy.ZoneMembershipCondition.SecurityZone" /> property is null. </exception> /// <exception cref="T:System.ArgumentException">The <see cref="P:System.Security.Policy.ZoneMembershipCondition.SecurityZone" /> property is not a valid <see cref="T:System.Security.SecurityZone" />. </exception> public SecurityElement ToXml(PolicyLevel level) { SecurityElement securityElement = MembershipConditionHelper.Element(typeof(ZoneMembershipCondition), this.version); securityElement.AddAttribute("Zone", this.zone.ToString()); return(securityElement); }
/// <summary>Creates an XML encoding of the security object and its current state with the specified <see cref="T:System.Security.Policy.PolicyLevel" />.</summary> /// <returns>An XML encoding of the security object, including any state information.</returns> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> /// <exception cref="T:System.ArgumentException">The <see cref="P:System.Security.Policy.SiteMembershipCondition.Site" /> property is null. </exception> public SecurityElement ToXml(PolicyLevel level) { SecurityElement securityElement = MembershipConditionHelper.Element(typeof(SiteMembershipCondition), this.version); securityElement.AddAttribute("Site", this._site); return(securityElement); }
public SecurityElement ToXml(PolicyLevel level) { // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references SecurityElement se = MembershipConditionHelper.Element(typeof(GacMembershipCondition), version); // nothing to add return(se); }
public SecurityElement ToXml(PolicyLevel level) { // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references SecurityElement se = MembershipConditionHelper.Element(typeof(PublisherMembershipCondition), version); se.AddAttribute("X509Certificate", x509.GetRawCertDataString()); return(se); }
public SecurityElement ToXml(PolicyLevel level) { // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references SecurityElement se = MembershipConditionHelper.Element(typeof(ZoneMembershipCondition), version); se.AddAttribute("Zone", zone.ToString()); return(se); }
public SecurityElement ToXml(PolicyLevel level) { SecurityElement se = MembershipConditionHelper.Element(typeof(HashMembershipCondition), version); se.AddAttribute("HashValue", CryptoConvert.ToHex(HashValue)); se.AddAttribute("HashAlgorithm", hash_algorithm.GetType().FullName); return(se); }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The policy level context, used to resolve named permission set references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); this.hash_value = CryptoConvert.FromHex(e.Attribute("HashValue")); string text = e.Attribute("HashAlgorithm"); this.hash_algorithm = ((text != null) ? HashAlgorithm.Create(text) : null); }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); if (!Boolean.TryParse(e.Attribute("LookAtDir"), out _lookAtDir)) { _lookAtDir = false; } // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); hash_value = CryptoConvert.FromHex(e.Attribute("HashValue")); string algorithm = e.Attribute("HashAlgorithm"); hash_algorithm = (algorithm == null) ? null : HashAlgorithm.Create(algorithm); }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The policy level context used to resolve named permission set references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); string text = e.Attribute("Zone"); if (text != null) { this.zone = (SecurityZone)((int)Enum.Parse(typeof(SecurityZone), text)); } }
public SecurityElement ToXml(PolicyLevel level) { // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references SecurityElement se = MembershipConditionHelper.Element(typeof(ApplicationMembershipCondition), version); if (_lookAtDir) { se.AddAttribute("LookAtDir", "true"); } return(se); }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); string z = e.Attribute("Zone"); if (z != null) { zone = (SecurityZone)Enum.Parse(typeof(SecurityZone), z); } }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); string text = e.Attribute("X509Certificate"); if (text != null) { byte[] data = CryptoConvert.FromHex(text); this.x509 = new X509Certificate(data); } }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); string cert = e.Attribute("X509Certificate"); if (cert != null) { byte[] rawcert = CryptoConvert.FromHex(cert); x509 = new X509Certificate(rawcert); } // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The policy level context, used to resolve named permission set references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); string text = e.Attribute("Url"); if (text != null) { this.CheckUrl(text); this.url = new Url(text); } else { this.url = null; } this.userUrl = text; }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); this.blob = StrongNamePublicKeyBlob.FromString(e.Attribute("PublicKeyBlob")); this.name = e.Attribute("Name"); string text = e.Attribute("AssemblyVersion"); if (text == null) { this.assemblyVersion = null; } else { this.assemblyVersion = new Version(text); } }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); string u = e.Attribute("Url"); if (u != null) { CheckUrl(u); url = new Url(u); } else { url = null; } userUrl = u; }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); blob = StrongNamePublicKeyBlob.FromString(e.Attribute("PublicKeyBlob")); name = e.Attribute("Name"); string v = (string)e.Attribute("AssemblyVersion"); if (v == null) { assemblyVersion = null; } else { assemblyVersion = new Version(v); } }
public void FromXml(SecurityElement element, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(element, "element", version, version); string u = element.Attribute("Url"); #if NET_2_0 if (u != null) { CheckUrl(u); url = new Url(u); } else { url = null; } #else url = (u == null) ? null : new Url(u); #endif userUrl = u; }
/// <summary>Creates an XML encoding of the security object and its current state with the specified <see cref="T:System.Security.Policy.PolicyLevel" />.</summary> /// <returns>An XML encoding of the security object, including any state information.</returns> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, which is used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> public SecurityElement ToXml(PolicyLevel level) { SecurityElement securityElement = MembershipConditionHelper.Element(typeof(StrongNameMembershipCondition), this.version); if (this.blob != null) { securityElement.AddAttribute("PublicKeyBlob", this.blob.ToString()); } if (this.name != null) { securityElement.AddAttribute("Name", this.name); } if (this.assemblyVersion != null) { string text = this.assemblyVersion.ToString(); if (text != "0.0") { securityElement.AddAttribute("AssemblyVersion", text); } } return(securityElement); }
public SecurityElement ToXml(PolicyLevel level) { // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references SecurityElement se = MembershipConditionHelper.Element(typeof(StrongNameMembershipCondition), version); if (blob != null) { se.AddAttribute("PublicKeyBlob", blob.ToString()); } if (name != null) { se.AddAttribute("Name", name); } if (assemblyVersion != null) { string v = assemblyVersion.ToString(); if (v != "0.0") { se.AddAttribute("AssemblyVersion", v); } } return(se); }
/// <summary>Reconstructs a security object with a specified state from an XML encoding.</summary> /// <param name="e">The XML encoding to use to reconstruct the security object. </param> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context, used to resolve <see cref="T:System.Security.NamedPermissionSet" /> references. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="e" /> parameter is null. </exception> /// <exception cref="T:System.ArgumentException">The <paramref name="e" /> parameter is not a valid membership condition element. </exception> public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", this.version, this.version); this._site = e.Attribute("Site"); }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); }
/// <summary>Creates an XML encoding of the security object and its current state, using the specified policy level context.</summary> /// <returns>A <see cref="T:System.Security.SecurityElement" /> that contains the XML encoding of the security object, including any state information.</returns> /// <param name="level">The <see cref="T:System.Security.Policy.PolicyLevel" /> context for resolving <see cref="T:System.Security.NamedPermissionSet" /> references. </param> public SecurityElement ToXml(PolicyLevel level) { return(MembershipConditionHelper.Element(typeof(GacMembershipCondition), this.version)); }
public void FromXml(SecurityElement e, PolicyLevel level) { MembershipConditionHelper.CheckSecurityElement(e, "e", version, version); // PolicyLevel isn't used as there's no need to resolve NamedPermissionSet references }