New test.
[mono.git] / mcs / tools / security / certview / X509ExtensionsHandler.cs
1 //
2 // ExtensionsHandler.cs: Extensions Configuration Handler (not GUI specific)
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 using System;
11 using System.Collections;
12 using System.Configuration;
13 using System.Xml;
14
15 namespace Mono.Tools.CertView {
16
17         public class X509ExtensionsHandler : DictionarySectionHandler {
18
19                 public X509ExtensionsHandler () : base () {}
20
21                 public override object Create (object parent, object context, XmlNode section) 
22                 {
23                         XmlNodeList xnl = section.SelectNodes ("/X509.Extensions/Extension");
24                         if (xnl == null)
25                                 return null;
26
27                         Hashtable ht = new Hashtable ();
28                         foreach (XmlNode xn in xnl) {
29                                 XmlAttribute xaOid = xn.Attributes ["OID"];
30                                 XmlAttribute xaClass = xn.Attributes ["Class"];
31                                 if ((xaOid != null) && (xaClass != null))
32                                         ht.Add (xaOid.InnerText, xaClass.InnerText);
33                         }
34                         return ht;
35                 }
36         }
37 }