2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Security / Signature.cs
1 //
2 // Signature.cs: Handles WS-Security 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;
11 using System.Xml;
12
13 namespace Microsoft.Web.Services.Security {
14
15         public sealed class Signature : SignedXml, ISecurityElement {
16
17                 private SecurityToken token;
18                 private SignatureOptions options;
19
20                 public Signature (SecurityToken token) 
21                 {
22                         if (token == null)
23                                 throw new ArgumentNullException ("token");
24                         if (!token.SupportsDigitalSignature)
25                                 throw new ArgumentException ("!SupportsDigitalSignature");
26                         this.token = token;
27                 }
28
29                 public SecurityToken SecurityToken {
30                         get { return token; }
31                 }
32
33                 public SignatureOptions SignatureOptions {
34                         get { return options; }
35                         set { options = value; }
36                 }
37
38                 [MonoTODO]
39                 public override bool CheckSignature () 
40                 {
41                         // note: strangely this is the only (of 3) CheckSignature methods overriden !?!
42                         return base.CheckSignature ();
43                 }
44
45                 [MonoTODO]
46                 public override XmlElement GetIdElement (XmlDocument document, string idValue) 
47                 {
48                         return base.GetIdElement (document, idValue);
49                 }
50
51                 [MonoTODO]
52                 public void LoadXml (Security container, XmlElement value)
53                 {
54                         if (container == null)
55                                 throw new ArgumentNullException ("container");
56                         // TODO
57                         if (value == null)
58                                 throw new SecurityFault ("value == null", null);
59                 }
60         }
61 }