2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
[mono.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / KeyInfoName.cs
1 //
2 // KeyInfoName.cs - KeyInfoName implementation for XML Signature
3 //
4 // Author:
5 //      Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2002 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 using System.Text;
11 using System.Xml;
12
13 namespace System.Security.Cryptography.Xml {
14
15 public class KeyInfoName : KeyInfoClause {
16
17         private string Name;
18
19         public KeyInfoName() {}
20
21         public string Value {
22                 get { return Name; }
23                 set { Name = value; }
24         }
25
26         public override XmlElement GetXml () 
27         {
28                 StringBuilder sb = new StringBuilder ();
29                 sb.Append ("<KeyName xmlns=\"http://www.w3.org/2000/09/xmldsig#\">");
30                 sb.Append (Name);
31                 sb.Append ("</KeyName>");
32
33                 XmlDocument doc = new XmlDocument ();
34                 doc.LoadXml(sb.ToString ());
35                 return doc.DocumentElement;
36         }
37
38         public override void LoadXml (XmlElement value) 
39         {
40                 if (value == null)
41                         throw new ArgumentNullException ();
42
43                 if ((value.LocalName == "KeyName") && (value.NamespaceURI == "http://www.w3.org/2000/09/xmldsig#"))
44                         Name = value.InnerXml;
45                 else
46                         Name = null;
47         }
48 }
49
50 }