GenericParameter.cs: override Module properly
[mcs.git] / class / corlib / System.Security.Permissions / KeyContainerPermissionAccessEntry.cs
blob6bf67d4847a1db31788dead1aa3358a39f7b695a
1 //
2 // System.Security.Permissions.KeyContainerPermissionAccessEntry.cs
3 //
4 // Author
5 // Sebastien Pouliot <sebastien@ximian.com>
6 //
7 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Globalization;
30 using System.Runtime.InteropServices;
31 using System.Security.Cryptography;
33 namespace System.Security.Permissions {
35 [Serializable]
36 [ComVisible (true)]
37 public sealed class KeyContainerPermissionAccessEntry {
39 private KeyContainerPermissionFlags _flags;
40 private string _containerName;
41 private int _spec;
42 private string _store;
43 private string _providerName;
44 private int _type;
47 public KeyContainerPermissionAccessEntry (CspParameters parameters, KeyContainerPermissionFlags flags)
49 if (parameters == null)
50 throw new ArgumentNullException ("parameters");
52 ProviderName = parameters.ProviderName;
53 ProviderType = parameters.ProviderType;
54 KeyContainerName = parameters.KeyContainerName;
55 KeySpec = parameters.KeyNumber;
56 Flags = flags;
59 public KeyContainerPermissionAccessEntry (string keyContainerName, KeyContainerPermissionFlags flags)
61 KeyContainerName = keyContainerName;
62 Flags = flags;
65 public KeyContainerPermissionAccessEntry (string keyStore, string providerName, int providerType,
66 string keyContainerName, int keySpec, KeyContainerPermissionFlags flags)
68 KeyStore = keyStore;
69 ProviderName = providerName;
70 ProviderType = providerType;
71 KeyContainerName = keyContainerName;
72 KeySpec = keySpec;
73 Flags = flags;
77 public KeyContainerPermissionFlags Flags {
78 get { return _flags; }
79 set {
80 if ((value & KeyContainerPermissionFlags.AllFlags) != 0) {
81 string msg = String.Format (Locale.GetText ("Invalid enum {0}"), value);
82 throw new ArgumentException (msg, "KeyContainerPermissionFlags");
84 _flags = value;
88 public string KeyContainerName {
89 get { return _containerName; }
90 set { _containerName = value; }
93 public int KeySpec {
94 get { return _spec; }
95 set { _spec = value; }
98 public string KeyStore {
99 get { return _store; }
100 set { _store = value; }
103 public string ProviderName {
104 get { return _providerName; }
105 set { _providerName = value; }
108 public int ProviderType {
109 get { return _type; }
110 set { _type = value; }
114 public override bool Equals (object o)
116 if (o == null)
117 return false;
118 KeyContainerPermissionAccessEntry kcpae = (o as KeyContainerPermissionAccessEntry);
119 if (kcpae == null)
120 return false;
121 if (_flags != kcpae._flags)
122 return false;
123 if (_containerName != kcpae._containerName)
124 return false;
125 if (_store != kcpae._store)
126 return false;
127 if (_providerName != kcpae._providerName)
128 return false;
129 if (_type != kcpae._type)
130 return false;
131 return true;
134 public override int GetHashCode ()
136 int result = _type ^ _spec ^ (int) _flags;
137 if (_containerName != null)
138 result ^= _containerName.GetHashCode ();
139 if (_store != null)
140 result ^= _store.GetHashCode ();
141 if (_providerName != null)
142 result ^= _providerName.GetHashCode ();
143 return result;