Merge pull request #1847 from alexanderkyte/left_shift_dynamic
[mono.git] / mcs / class / corlib / System.Security / SecurityManager_mobile.cs
1 //
2 // System.Security.SecurityManager.cs
3 //
4 // Authors:
5 //      Nick Drochak(ndrochak@gol.com)
6 //      Sebastien Pouliot  <sebastien@ximian.com>
7 //
8 // (C) Nick Drochak
9 // Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
10 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 // 
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 // 
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 //
31
32 #if MOBILE
33
34 using System.Collections;
35 using System.Diagnostics;
36 using System.Globalization;
37 using System.IO;
38 using System.Reflection;
39 using System.Runtime.CompilerServices;
40 using System.Runtime.InteropServices;
41 using System.Security.Permissions;
42 using System.Security.Policy;
43
44 namespace System.Security {
45
46         // Must match MonoDeclSecurityActions in /mono/metadata/reflection.h
47         internal struct RuntimeDeclSecurityActions {
48                 public RuntimeDeclSecurityEntry cas;
49                 public RuntimeDeclSecurityEntry noncas;
50                 public RuntimeDeclSecurityEntry choice;
51         }
52
53         [ComVisible (true)]
54         public static class SecurityManager {
55
56                 // properties
57
58                 [Obsolete]
59                 public static bool CheckExecutionRights {
60                         get { return false; }
61                         set { ; }
62                 }
63
64                 [Obsolete ("The security manager cannot be turned off on MS runtime")]
65                 public static bool SecurityEnabled {
66                         get { return false; }
67                         set { ; }
68                 }
69                 
70                 internal static bool HasElevatedPermissions {
71                         get { return true; }
72                 }
73
74                 internal static bool CheckElevatedPermissions ()
75                 {
76                                 return true;
77                 }
78
79                 internal static void EnsureElevatedPermissions ()
80                 {
81                 }
82                 
83                 // methods
84
85                 [StrongNameIdentityPermission (SecurityAction.LinkDemand, PublicKey = "0x00000000000000000400000000000000")]
86                 public static void GetZoneAndOrigin (out ArrayList zone, out ArrayList origin) 
87                 {
88                         zone = new ArrayList ();
89                         origin = new ArrayList ();
90                 }
91
92                 [Obsolete]
93                 public static bool IsGranted (IPermission perm)
94                 {
95                         return true;
96                 }
97
98                 [Obsolete]
99                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
100                 public static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
101                 {
102                         throw new NotSupportedException ();
103                 }
104
105                 [Obsolete]
106                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
107                 public static PolicyLevel LoadPolicyLevelFromString (string str, PolicyLevelType type)
108                 {
109                         throw new NotSupportedException ();
110                 }
111
112                 [Obsolete]
113                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
114                 public static IEnumerator PolicyHierarchy ()
115                 {
116                         throw new NotSupportedException ();
117                 }
118
119                 [Obsolete]
120                 public static PermissionSet ResolvePolicy (Evidence evidence)
121                 {
122                         throw new NotSupportedException ();
123                 }
124
125                 [Obsolete]
126                 public static PermissionSet ResolvePolicy (Evidence[] evidences)
127                 {
128                         throw new NotSupportedException ();
129                 }
130
131                 [Obsolete]
132                 public static PermissionSet ResolveSystemPolicy (Evidence evidence)
133                 {
134                         throw new NotSupportedException ();
135                 }
136
137                 [Obsolete]
138                 public static PermissionSet ResolvePolicy (Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
139                 {
140                         throw new NotSupportedException ();
141                 }
142
143                 [Obsolete]
144                 public static IEnumerator ResolvePolicyGroups (Evidence evidence)
145                 {
146                         throw new NotSupportedException ();
147                 }
148
149                 [Obsolete]
150                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
151                 public static void SavePolicy () 
152                 {
153                         throw new NotSupportedException ();
154                 }
155
156                 [Obsolete]
157                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
158                 public static void SavePolicyLevel (PolicyLevel level) 
159                 {
160                         throw new NotSupportedException ();
161                 }
162
163                 // private/internal stuff
164
165                 internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence)
166                 {
167                         throw new NotSupportedException ();
168                 }
169
170                 internal static void ResolveIdentityPermissions (PermissionSet ps, Evidence evidence)
171                 {
172                         throw new NotSupportedException ();
173                 }
174
175                 internal static PolicyLevel ResolvingPolicyLevel {
176                         get { return null; }
177                         set { ; }
178                 }
179
180                 internal static IPermission CheckPermissionSet (Assembly a, PermissionSet ps, bool noncas)
181                 {
182                         return null;
183                 }
184
185                 internal static IPermission CheckPermissionSet (AppDomain ad, PermissionSet ps)
186                 {
187                         return null;
188                 }
189
190                 internal static PermissionSet Decode (IntPtr permissions, int length)
191                 {
192                         throw new NotSupportedException ();
193                 }
194
195                 internal static PermissionSet Decode (byte[] encodedPermissions)
196                 {
197                         throw new NotSupportedException ();
198                 }
199
200                 public static PermissionSet GetStandardSandbox (Evidence evidence)
201                 {
202                         if (evidence == null)
203                                 throw new ArgumentNullException ("evidence");
204
205                         throw new NotImplementedException ();
206                 }
207
208                 public static bool CurrentThreadRequiresSecurityContextCapture ()
209                 {
210                         throw new NotImplementedException ();
211                 }
212         }
213 }
214
215 #endif