2003-09-25 Todd Berman <tberman@gentoo.org>
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Security / KeyIdentifier.cs
1 //\r
2 // KeyIdentifier.cs: Handles WS-Security KeyIdentifier\r
3 //\r
4 // Author:\r
5 //      Sebastien Pouliot (spouliot@motus.com)\r
6 //\r
7 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)\r
8 //\r
9 // Licensed under MIT X11 (see LICENSE) with this specific addition:\r
10 //\r
11 // \93This source code may incorporate intellectual property owned by Microsoft \r
12 // Corporation. Our provision of this source code does not include any licenses\r
13 // or any other rights to you under any Microsoft intellectual property. If you\r
14 // would like a license from Microsoft (e.g. rebrand, redistribute), you need \r
15 // to contact Microsoft directly.\94 \r
16 //\r
17 \r
18 using System;\r
19 using System.Security.Cryptography.Xml;\r
20 using System.Xml;\r
21 using Microsoft.Web.Services;\r
22 using Microsoft.Web.Services.Xml;\r
23 \r
24 namespace Microsoft.Web.Services.Security {\r
25 \r
26         public class KeyIdentifier : IXmlElement {\r
27 \r
28                 private byte[] kivalue;\r
29                 private XmlQualifiedName vtype;\r
30 \r
31                 public KeyIdentifier (byte[] identifier) \r
32                 {\r
33                         if (identifier == null)\r
34                                 throw new ArgumentNullException ("identifier");\r
35                         kivalue = (byte[]) identifier.Clone ();\r
36                 }\r
37 \r
38                 public KeyIdentifier (XmlElement element) \r
39                 {\r
40                         LoadXml (element);\r
41                 }\r
42 \r
43                 public KeyIdentifier (byte[] identifier, XmlQualifiedName valueType) \r
44                 {\r
45                         if (identifier == null)\r
46                                 throw new ArgumentNullException ("identifier");\r
47                         kivalue = (byte[]) identifier.Clone ();\r
48                         vtype = valueType;\r
49                 }\r
50 \r
51                 public byte[] Value {\r
52                         get { return (byte[]) kivalue.Clone (); }\r
53                         set {\r
54                                 if (value == null)\r
55                                         throw new ArgumentNullException ("value");\r
56                                 kivalue = value;\r
57                         }\r
58                 }\r
59 \r
60                 public XmlQualifiedName ValueType {\r
61                         get { return vtype; }\r
62                         set { vtype = value; }\r
63                 }\r
64 \r
65                 public XmlElement GetXml (XmlDocument document) \r
66                 {\r
67                         if (document == null)\r
68                                 throw new ArgumentNullException ("document");\r
69                         return null;\r
70                 }\r
71 \r
72                 public void LoadXml (XmlElement element) \r
73                 {\r
74                         if ((element.LocalName != WSSecurity.ElementNames.KeyIdentifier) || (element.NamespaceURI != WSSecurity.NamespaceURI))\r
75                                 throw new System.ArgumentException ("invalid LocalName or NamespaceURI");\r
76                         // TODO\r
77                 }\r
78         }\r
79 }\r