Edit

Share via


CspProviderFlags Enum

Definition

Specifies flags that modify the behavior of the cryptographic service providers (CSP).

This enumeration supports a bitwise combination of its member values.

public enum class CspProviderFlags
[System.Flags]
public enum CspProviderFlags
[System.Flags]
[System.Serializable]
public enum CspProviderFlags
[System.Flags]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum CspProviderFlags
[<System.Flags>]
type CspProviderFlags = 
[<System.Flags>]
[<System.Serializable>]
type CspProviderFlags = 
[<System.Flags>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type CspProviderFlags = 
Public Enum CspProviderFlags
Inheritance
CspProviderFlags
Attributes

Fields

Name Value Description
NoFlags 0

Do not specify any settings.

UseMachineKeyStore 1

Use key information from the computer's key store.

UseDefaultKeyContainer 2

Use key information from the default key container.

UseNonExportableKey 4

Use key information that cannot be exported.

UseExistingKey 8

Use key information from the current key.

UseArchivableKey 16

Allow a key to be exported for archival or recovery.

UseUserProtectedKey 32

Notify the user through a dialog box or another method when certain actions are attempting to use a key. This flag is not compatible with the NoPrompt flag.

NoPrompt 64

Prevent the CSP from displaying any user interface (UI) for this context.

CreateEphemeralKey 128

Create a temporary key that is released when the associated Rivest-Shamir-Adleman (RSA) object is closed. Do not use this flag if you want your key to be independent of the RSA object.

Remarks

Important

The CreateEphemeralKey flag provides temporary keys with more reliable cleanup. If this flag is not used, the common language runtime (CLR) generates a randomly named key when an RSA object is created. When the object is finalized or disposed of, the key is deleted. When impersonation is in effect, not explicitly calling Dispose can potentially create a problem. For example, if you use impersonation, create an RSA object, and do not dispose of it, the finalizer thread (which is not impersonating) can fail to delete the key, and then throws an exception. This exception is unhandled and can terminate the process. The resources allocated to the key are not recovered, resulting in a memory leak. The KeyContainerPermission demand is suppressed by this flag.

Applies to

See also