2003-12-29 Sebastien Pouliot <spouliot@videotron.ca>
[mono.git] / mcs / class / corlib / System.Security.Permissions / StrongNameIdentityPermission.cs
1 //
2 // StrongNameIdentityPermission.cs: Strong Name Identity Permission
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
12 namespace System.Security.Permissions {
13
14         [Serializable]
15         public sealed class StrongNameIdentityPermission : CodeAccessPermission, IBuiltInPermission {
16         
17                 private StrongNamePublicKeyBlob publickey;
18                 private string name;
19                 private Version version;
20         
21                 public StrongNameIdentityPermission (PermissionState state) 
22                 {
23                         if (state == PermissionState.Unrestricted)
24                                 throw new ArgumentException ("state");
25                         name = String.Empty;
26                         version = new Version (0, 0);
27                 }
28         
29                 public StrongNameIdentityPermission (StrongNamePublicKeyBlob blob, string name, Version version) 
30                 {
31                         if (blob == null)
32                                 throw new ArgumentNullException ("blob");
33                         if (name == null)
34                                 throw new ArgumentNullException ("name");
35                         if (version == null)
36                                 throw new ArgumentNullException ("version");
37         
38                         publickey = blob;
39                         this.name = name;
40                         this.version = version;
41                 }
42         
43                 ~StrongNameIdentityPermission () 
44                 {
45                 }
46         
47                 public string Name { 
48                         get { return name; }
49                         set { name = value; }
50                 }
51         
52                 public StrongNamePublicKeyBlob PublicKey { 
53                         get { return publickey; }
54                         set {
55                                 if (value == null)
56                                         throw new ArgumentNullException ("value");
57                                 publickey = value;
58                         }
59                 }
60         
61                 public Version Version { 
62                         get { return version; }
63                         set { version = value; }
64                 }
65         
66                 public override IPermission Copy () 
67                 {
68                         return new StrongNameIdentityPermission (publickey, name, version);
69                 }
70         
71                 [MonoTODO]
72                 public override void FromXml (SecurityElement e) 
73                 {
74                         if (e == null)
75                                 throw new ArgumentNullException ("e");
76                         throw new NotImplementedException ();
77                 }
78         
79                 [MonoTODO]
80                 public override IPermission Intersect (IPermission target) 
81                 {
82                         throw new NotImplementedException ();
83                 }
84         
85                 [MonoTODO]
86                 public override bool IsSubsetOf (IPermission target) 
87                 {
88                         throw new NotImplementedException ();
89                 }
90         
91                 [MonoTODO]
92                 public override SecurityElement ToXml () 
93                 {
94                         throw new NotImplementedException ();
95                 }
96         
97                 [MonoTODO]
98                 public override IPermission Union (IPermission target) 
99                 {
100                         throw new NotImplementedException ();
101                 }
102         
103                 // IBuiltInPermission
104                 int IBuiltInPermission.GetTokenIndex ()
105                 {
106                         return 11;
107                 }
108         } 
109 }