2004-03-27 Atsushi Enomoto <atsushi@ximian.com>
[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, 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
9
10 using System.Xml;
11
12 namespace System.Security.Cryptography.Xml {
13
14         public class KeyInfoName : KeyInfoClause {
15
16                 private string name;
17
18                 public KeyInfoName() {}
19
20                 public string Value {
21                         get { return name; }
22                         set { name = value; }
23                 }
24
25                 public override XmlElement GetXml () 
26                 {
27                         XmlDocument document = new XmlDocument ();
28                         XmlElement xel = document.CreateElement (XmlSignature.ElementNames.KeyName, XmlSignature.NamespaceURI);
29                         xel.InnerText = name;
30                         return xel;
31                 }
32
33                 public override void LoadXml (XmlElement value) 
34                 {
35                         if (value == null)
36                                 throw new ArgumentNullException ();
37                         if ((value.LocalName != XmlSignature.ElementNames.KeyName) || (value.NamespaceURI != XmlSignature.NamespaceURI))
38                                 name = "";
39                         else
40                                 name = value.InnerText;
41                 }
42         }
43 }