64 if (accessList ==
null)
71 for (
int i = 0; i < accessList.Length; i++)
73 m_accessEntries.
Add(accessList[i]);
98 private bool IsEmpty()
106 if (current.
Flags != 0)
128 if (!VerifyType(target))
133 if ((m_flags & keyContainerPermission.m_flags) != m_flags)
142 if ((current.
Flags & applicableFlags) != current.
Flags)
152 if ((applicableFlags2 & current2.
Flags) != applicableFlags2)
171 if (!VerifyType(target))
176 if (IsEmpty() || keyContainerPermission.IsEmpty())
186 keyContainerPermission2.AddAccessEntryAndIntersect(current, keyContainerPermission);
192 keyContainerPermission2.AddAccessEntryAndIntersect(current2,
this);
194 if (!keyContainerPermission2.IsEmpty())
196 return keyContainerPermission2;
212 if (!VerifyType(target))
227 keyContainerPermission2.AddAccessEntryAndUnion(current, keyContainerPermission);
233 keyContainerPermission2.AddAccessEntryAndUnion(current2,
this);
235 if (!keyContainerPermission2.IsEmpty())
237 return keyContainerPermission2;
257 return keyContainerPermission;
267 securityElement.
AddAttribute(
"Flags", m_flags.ToString());
282 securityElement2.
AddChild(securityElement3);
284 securityElement.
AddChild(securityElement2);
291 return securityElement;
303 if (XMLUtil.IsUnrestricted(securityElement))
310 string text = securityElement.Attribute(
"Flags");
318 if (securityElement.InternalChildren ==
null || securityElement.InternalChildren.
Count == 0)
326 if (securityElement2 !=
null &&
string.
Equals(securityElement2.
Tag,
"AccessList"))
328 AddAccessEntries(securityElement2);
333 int IBuiltInPermission.GetTokenIndex()
335 return GetTokenIndex();
340 if (securityElement.InternalChildren ==
null || securityElement.InternalChildren.
Count == 0)
347 SecurityElement securityElement2 = (SecurityElement)enumerator.
Current;
348 if (securityElement2 ==
null || !
string.
Equals(securityElement2.Tag,
"AccessEntry"))
352 int count = securityElement2.m_lAttributes.Count;
353 string keyStore =
null;
354 string providerName =
null;
355 int providerType = -1;
356 string keyContainerName =
null;
359 for (
int i = 0; i < count; i += 2)
361 string a = (string)securityElement2.m_lAttributes[i];
362 string text = (
string)securityElement2.m_lAttributes[i + 1];
363 if (
string.
Equals(a,
"KeyStore"))
367 if (
string.
Equals(a,
"ProviderName"))
371 else if (
string.
Equals(a,
"ProviderType"))
373 providerType =
Convert.ToInt32(text,
null);
375 else if (
string.
Equals(a,
"KeyContainerName"))
377 keyContainerName = text;
379 else if (
string.
Equals(a,
"KeySpec"))
381 keySpec =
Convert.ToInt32(text,
null);
383 else if (
string.
Equals(a,
"Flags"))
388 KeyContainerPermissionAccessEntry accessEntry =
new KeyContainerPermissionAccessEntry(keyStore, providerName, providerType, keyContainerName, keySpec, flags);
393 private void AddAccessEntryAndUnion(KeyContainerPermissionAccessEntry accessEntry,
KeyContainerPermission target)
395 KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry =
new KeyContainerPermissionAccessEntry(accessEntry);
396 keyContainerPermissionAccessEntry.Flags |= GetApplicableFlags(accessEntry, target);
400 private void AddAccessEntryAndIntersect(KeyContainerPermissionAccessEntry accessEntry,
KeyContainerPermission target)
402 KeyContainerPermissionAccessEntry keyContainerPermissionAccessEntry =
new KeyContainerPermissionAccessEntry(accessEntry);
403 keyContainerPermissionAccessEntry.Flags &= GetApplicableFlags(accessEntry, target);
411 throw new ArgumentException(Environment.GetResourceString(
"Arg_EnumIllegalVal", (
int)flags));
419 int num = target.AccessEntries.IndexOf(accessEntry);
422 return target.AccessEntries[num].Flags;
424 KeyContainerPermissionAccessEntryEnumerator enumerator = target.AccessEntries.GetEnumerator();
425 while (enumerator.MoveNext())
427 KeyContainerPermissionAccessEntry current = enumerator.
Current;
428 if (accessEntry.IsSubsetOf(current))
432 keyContainerPermissionFlags &= current.Flags;
435 keyContainerPermissionFlags = current.Flags;
441 keyContainerPermissionFlags = target.Flags;
443 return keyContainerPermissionFlags;
446 private static int GetTokenIndex()
Allows a permission to expose an unrestricted state.
override void FromXml(SecurityElement securityElement)
Reconstructs a permission with a specified state from an XML encoding.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
bool MoveNext()
Moves to the next element in the collection.
bool MoveNext()
Advances the enumerator to the next element of the collection.
override IPermission Union(IPermission target)
Creates a permission that is the union of the current permission and the specified permission.
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
KeyContainerPermissionFlags Flags
Gets the key container permission flags that apply to all key containers associated with the permissi...
int KeySpec
Gets or sets the key specification.
Specifies access rights for specific key containers. This class cannot be inherited.
string ProviderName
Gets or sets the provider name.
Controls the ability to access key containers. This class cannot be inherited.
string Tag
Gets or sets the tag name of an XML element.
int ProviderType
Gets or sets the provider type.
static object Parse(Type enumType, string value)
Converts the string representation of the name or numeric value of one or more enumerated constants t...
void AddChild(SecurityElement child)
Adds a child element to the XML element.
KeyContainerPermission(KeyContainerPermissionFlags flags, KeyContainerPermissionAccessEntry[] accessList)
Initializes a new instance of the T:System.Security.Permissions.KeyContainerPermission class with the...
KeyContainerPermissionAccessEntry Current
Gets the current entry in the collection.
Provides information about, and means to manipulate, the current environment and platform....
bool IsUnrestricted()
Determines whether the current permission is unrestricted.
int Count
Gets the number of items in the collection.
KeyContainerPermission(PermissionState state)
Initializes a new instance of the T:System.Security.Permissions.KeyContainerPermission class with eit...
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
Provides the base class for enumerations.
string KeyContainerName
Gets or sets the key container name.
Represents the XML object model for encoding security objects. This class cannot be inherited.
int Add(KeyContainerPermissionAccessEntry accessEntry)
Adds a T:System.Security.Permissions.KeyContainerPermissionAccessEntry object to the collection.
KeyContainerPermissionAccessEntryCollection AccessEntries
Gets the collection of T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects associ...
object Current
Gets the element in the collection at the current position of the enumerator.
Defines the underlying structure of all code access permissions.
override bool Equals(object obj)
Determines whether the specified T:System.Security.CodeAccessPermission object is equal to the curren...
KeyContainerPermissionFlags
Specifies the type of key container access allowed.
Defines methods implemented by permission types.
The exception that is thrown when one of the arguments provided to a method is not valid.
KeyContainerPermission(KeyContainerPermissionFlags flags)
Initializes a new instance of the T:System.Security.Permissions.KeyContainerPermission class with the...
override SecurityElement ToXml()
Creates an XML encoding of the permission and its current state.
override IPermission Copy()
Creates and returns an identical copy of the current permission.
Attribute can be applied to an enumeration.
PermissionState
Specifies whether a permission should have all or no access to resources at creation.
KeyContainerPermissionAccessEntryEnumerator GetEnumerator()
Returns a T:System.Security.Permissions.KeyContainerPermissionAccessEntryEnumerator object that can b...
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
Represents a collection of T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects....
ArrayList Children
Gets or sets the array of child elements of the XML element.
virtual IEnumerator GetEnumerator()
Returns an enumerator for the entire T:System.Collections.ArrayList.
override IPermission Intersect(IPermission target)
Creates and returns a permission that is the intersection of the current permission and the specified...
KeyContainerPermissionFlags Flags
Gets or sets the key container permissions.
override bool IsSubsetOf(IPermission target)
Determines whether the current permission is a subset of the specified permission.
Supports a simple iteration over a non-generic collection.
Represents the enumerator for T:System.Security.Permissions.KeyContainerPermissionAccessEntry objects...
string KeyStore
Gets or sets the name of the key store.