mscorlib(4.0.0.0) API with additions
CryptoKeyAccessRule.cs
2 
4 {
6  public sealed class CryptoKeyAccessRule : AccessRule
7  {
10  public CryptoKeyRights CryptoKeyRights => RightsFromAccessMask(base.AccessMask);
11 
17  : this(identity, AccessMaskFromRights(cryptoKeyRights, type), isInherited: false, InheritanceFlags.None, PropagationFlags.None, type)
18  {
19  }
20 
25  public CryptoKeyAccessRule(string identity, CryptoKeyRights cryptoKeyRights, AccessControlType type)
26  : this(new NTAccount(identity), AccessMaskFromRights(cryptoKeyRights, type), isInherited: false, InheritanceFlags.None, PropagationFlags.None, type)
27  {
28  }
29 
30  private CryptoKeyAccessRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
31  : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, type)
32  {
33  }
34 
35  private static int AccessMaskFromRights(CryptoKeyRights cryptoKeyRights, AccessControlType controlType)
36  {
37  switch (controlType)
38  {
39  case AccessControlType.Allow:
40  cryptoKeyRights |= CryptoKeyRights.Synchronize;
41  break;
42  case AccessControlType.Deny:
43  if (cryptoKeyRights != CryptoKeyRights.FullControl)
44  {
45  cryptoKeyRights &= ~CryptoKeyRights.Synchronize;
46  }
47  break;
48  default:
49  throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumValue", controlType, "controlType"), "controlType");
50  }
51  return (int)cryptoKeyRights;
52  }
53 
54  internal static CryptoKeyRights RightsFromAccessMask(int accessMask)
55  {
56  return (CryptoKeyRights)accessMask;
57  }
58  }
59 }
PropagationFlags
Specifies how Access Control Entries (ACEs) are propagated to child objects. These flags are signific...
CryptoKeyAccessRule(string identity, CryptoKeyRights cryptoKeyRights, AccessControlType type)
Initializes a new instance of the T:System.Security.AccessControl.CryptoKeyAccessRule class using the...
CryptoKeyRights
Specifies the cryptographic key operation for which an authorization rule controls access or auditing...
CryptoKeyRights CryptoKeyRights
Gets the cryptographic key operation to which this access rule controls access.
Represents an identity and is the base class for the T:System.Security.Principal.NTAccount and T:Syst...
Represents a combination of a user's identity, an access mask, and an access control type (allow or d...
Definition: AccessRule.cs:7
Definition: __Canon.cs:3
Represents a user or group account.
Definition: NTAccount.cs:10
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
AccessControlType
Specifies whether an T:System.Security.AccessControl.AccessRule object is used to allow or deny acces...
The exception that is thrown when one of the arguments provided to a method is not valid.
CryptoKeyAccessRule(IdentityReference identity, CryptoKeyRights cryptoKeyRights, AccessControlType type)
Initializes a new instance of the T:System.Security.AccessControl.CryptoKeyAccessRule class using the...
Represents an access rule for a cryptographic key. An access rule represents a combination of a user'...
AccessControlType AccessControlType
Gets the T:System.Security.AccessControl.AccessControlType value associated with this T:System....
Definition: AccessRule.cs:65
InheritanceFlags
Inheritance flags specify the semantics of inheritance for access control entries (ACEs).