Exemplo n.º 1
0
        /// <summary>
        /// Create PolicyMappings extension from XML profile file entry
        /// </summary>
        /// <param name="xml">XML version of the extension</param>
        /// <remarks>Sample OSCA XML description of the PolicyMappings extension:
        /// <code>
        /// &lt;Extension&gt;
        ///  &lt;name description="Policy Mappings"&gt;PolicyMappings&lt;/name&gt;
        ///    &lt;critical&gt;false&lt;/critical&gt;
        ///    &lt;value&gt;
        ///      &lt;mapping&gt;
        ///        &lt;issuerPolicy name="Some policy"&gt;1.2.3.4&lt;/issuerPolicy&gt;
        ///        &lt;subjectPolicy name="Other policy"&gt;4.5.6.7&lt;/subjectPolicy&gt;
        ///      &lt;/mapping&gt;
        ///    &lt;/value&gt;
        /// &lt;/Extension&gt;
        /// </code>
        /// </remarks>
        public policyMappings(XElement xml) : base(xml)
        {
            base.oid = X509Extensions.PolicyMappings;

            foreach (XElement polID in xmlValue.Descendants("mapping"))
            {
                PolicyMapping map = new PolicyMapping()
                {
                    issuerOid         = polID.Element("issuerPolicy").Value,
                    issuerPolicyName  = polID.Element("issuerPolicy").Attribute("name").Value,
                    subjectOid        = polID.Element("subjectPolicy").Value,
                    subjectPolicyName = polID.Element("subjectPolicy").Attribute("name").Value,
                };
                mappings.Add(map);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create PolicyMappings extension from X509Extension
        /// </summary>
        /// <param name="Extension">Extension instance</param>
        public policyMappings(X509Extension Extension) : base(Extension)
        {
            base.oid         = X509Extensions.PolicyMappings;
            base.name        = "PolicyMappings";
            base.displayName = "Policy Mappings";

            PolicyMappings pm = PolicyMappings.GetInstance(Extension);

            foreach (Asn1Sequence inner in pm.Mappings)
            {
                PolicyMapping map = new PolicyMapping()
                {
                    issuerOid  = ((DerObjectIdentifier)inner[0]).Id,
                    subjectOid = ((DerObjectIdentifier)inner[1]).Id
                };
                mappings.Add(map);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Remove a PolicyMapping from the extension
 /// </summary>
 /// <param name="Mapping">Policy mapping</param>
 public void Remove(PolicyMapping Mapping)
 {
     mappings.Remove(Mapping);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Add a new PolicyMapping to the extension
 /// </summary>
 /// <param name="Mapping">Policy mapping</param>
 public void Add(PolicyMapping Mapping)
 {
     mappings.Add(Mapping);
 }