13 private bool m_randomKeyContainer;
48 [SecuritySafeCritical]
51 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
52 if (Utils._OpenCSP(m_parameters, 64u, ref hProv) != 0)
56 string result = (string)Utils._GetProviderParameter(hProv, m_parameters.KeyNumber, 8u);
73 [SecuritySafeCritical]
80 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
81 if (Utils._OpenCSP(m_parameters, 64u, ref hProv) != 0)
85 byte[] array = (
byte[])Utils._GetProviderParameter(hProv, m_parameters.KeyNumber, 3u);
95 public bool HardwareDevice
97 [SecuritySafeCritical]
100 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
104 uint flags = 4026531840u;
105 if (Utils._OpenCSP(cspParameters, flags, ref hProv) != 0)
109 byte[] array = (
byte[])Utils._GetProviderParameter(hProv, cspParameters.
KeyNumber, 5u);
111 return array[0] == 1;
119 public bool Removable
121 [SecuritySafeCritical]
124 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
128 uint flags = 4026531840u;
129 if (Utils._OpenCSP(cspParameters, flags, ref hProv) != 0)
133 byte[] array = (
byte[])Utils._GetProviderParameter(hProv, cspParameters.
KeyNumber, 4u);
135 return array[0] == 1;
143 public bool Accessible
145 [SecuritySafeCritical]
148 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
149 if (Utils._OpenCSP(m_parameters, 64u, ref hProv) != 0)
153 byte[] array = (
byte[])Utils._GetProviderParameter(hProv, m_parameters.KeyNumber, 6u);
155 return array[0] == 1;
164 public bool Protected
166 [SecuritySafeCritical]
173 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
174 if (Utils._OpenCSP(m_parameters, 64u, ref hProv) != 0)
178 byte[] array = (
byte[])Utils._GetProviderParameter(hProv, m_parameters.KeyNumber, 7u);
180 return array[0] == 1;
190 [SecuritySafeCritical]
196 keyContainerPermission.
Demand();
197 SafeProvHandle hProv = SafeProvHandle.InvalidHandle;
198 if (Utils._OpenCSP(m_parameters, 64u, ref hProv) != 0)
212 public bool RandomlyGenerated => m_randomKeyContainer;
221 if (!CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
226 keyContainerPermission.
Demand();
228 m_parameters =
new CspParameters(parameters);
229 if (m_parameters.KeyNumber == -1)
231 if (m_parameters.ProviderType == 1 || m_parameters.ProviderType == 24)
233 m_parameters.KeyNumber = 1;
235 else if (m_parameters.ProviderType == 13)
237 m_parameters.KeyNumber = 2;
240 m_randomKeyContainer = randomKeyContainer;
245 [SecuritySafeCritical]
247 : this(parameters, randomKeyContainer: false)
The exception that is thrown when an error occurs during a cryptographic operation.
int ProviderType
Gets the provider type of a key.
int KeyNumber
Specifies whether an asymmetric key is created as a signature key or an exchange key.
string KeyContainerName
Represents the key container name for T:System.Security.Cryptography.CspParameters.
bool MachineKeyStore
Gets a value indicating whether a key is from a machine key set.
Specifies access rights for specific key containers. This class cannot be inherited.
CspProviderFlags
Specifies flags that modify the behavior of the cryptographic service providers (CSP).
Controls the ability to access key containers. This class cannot be inherited.
bool? HardwareDevice
Gets a value indicating whether a key is a hardware key.
string ProviderName
Gets the provider name of a key.
Provides information about, and means to manipulate, the current environment and platform....
KeyNumber KeyNumber
Gets a value that describes whether an asymmetric key was created as a signature key or an exchange k...
string UniqueKeyContainerName
Gets a unique key container name.
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...
Contains parameters that are passed to the cryptographic service provider (CSP) that performs cryptog...
KeyContainerPermissionFlags
Specifies the type of key container access allowed.
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
bool Exportable
Gets a value indicating whether a key can be exported from a key container.
KeyNumber
Specifies whether to create an asymmetric signature key or an asymmetric exchange key.
Provides the ability to control access to a cryptographic key object without direct manipulation of a...
Provides additional information about a cryptographic key pair. This class cannot be inherited.
string KeyContainerName
Gets a key container name.
AccessControlSections
Specifies which sections of a security descriptor to save or load.
CspKeyContainerInfo(CspParameters parameters)
Initializes a new instance of the T:System.Security.Cryptography.CspKeyContainerInfo class using the ...
CspProviderFlags Flags
Represents the flags for T:System.Security.Cryptography.CspParameters that modify the behavior of the...