KeyInfoName.cs 1.0 KB

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