KeyInfoRetrievalMethod.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // KeyInfoRetrievalMethod.cs - KeyInfoRetrievalMethod implementation for XML Signature
  3. //
  4. // Author:
  5. // Sebastien Pouliot ([email protected])
  6. //
  7. // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
  8. //
  9. using System.Xml;
  10. namespace System.Security.Cryptography.Xml {
  11. public class KeyInfoRetrievalMethod : KeyInfoClause {
  12. private string URI;
  13. public KeyInfoRetrievalMethod () {}
  14. public KeyInfoRetrievalMethod (string strUri)
  15. {
  16. URI = strUri;
  17. }
  18. public string Uri {
  19. get { return URI; }
  20. set { URI = value; }
  21. }
  22. public override XmlElement GetXml ()
  23. {
  24. XmlDocument document = new XmlDocument ();
  25. XmlElement xel = document.CreateElement (XmlSignature.ElementNames.RetrievalMethod, XmlSignature.NamespaceURI);
  26. if (URI != null)
  27. xel.SetAttribute (XmlSignature.AttributeNames.URI, URI);
  28. return xel;
  29. }
  30. public override void LoadXml (XmlElement value)
  31. {
  32. if (value == null)
  33. throw new ArgumentNullException ();
  34. if ((value.LocalName != XmlSignature.ElementNames.RetrievalMethod) || (value.NamespaceURI != XmlSignature.NamespaceURI))
  35. URI = ""; // not null - so we return URI="" as attribute !!!
  36. else
  37. URI = value.Attributes [XmlSignature.AttributeNames.URI].Value;
  38. }
  39. }
  40. }