CngKey.Exists Method

Definition

Checks for a named key in a specific key storage provider(KSP).

Overloads

Exists(String)

Checks to see whether a named key exists in the default key storage provider (KSP).

Exists(String, CngProvider)

Checks to see whether a named key exists in the specified key storage provider (KSP).

Exists(String, CngProvider, CngKeyOpenOptions)

Checks to see whether a named key exists in the specified key storage provider (KSP), according to the specified options.

Exists(String)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Checks to see whether a named key exists in the default key storage provider (KSP).

public:
 static bool Exists(System::String ^ keyName);
public static bool Exists (string keyName);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists (string keyName);
static member Exists : string -> bool
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string -> bool
Public Shared Function Exists (keyName As String) As Boolean

Parameters

keyName
String

The key name.

Returns

true if the named key exists in the default KSP; otherwise, false.

Attributes

Exceptions

keyName is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

Remarks

The default KSP is MicrosoftSoftwareKeyStorageProvider.

Applies to

Exists(String, CngProvider)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Checks to see whether a named key exists in the specified key storage provider (KSP).

public:
 static bool Exists(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider);
public static bool Exists (string keyName, System.Security.Cryptography.CngProvider provider);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists (string keyName, System.Security.Cryptography.CngProvider provider);
static member Exists : string * System.Security.Cryptography.CngProvider -> bool
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string * System.Security.Cryptography.CngProvider -> bool
Public Shared Function Exists (keyName As String, provider As CngProvider) As Boolean

Parameters

keyName
String

The key name.

provider
CngProvider

The KSP to check for the key.

Returns

true if the named key exists in the specified provider; otherwise, false.

Attributes

Exceptions

keyName or provider is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

Remarks

Use this overload to check for the existence of a key in a KSP other than the default KSP, which is MicrosoftSoftwareKeyStorageProvider.

Applies to

Exists(String, CngProvider, CngKeyOpenOptions)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Checks to see whether a named key exists in the specified key storage provider (KSP), according to the specified options.

public:
 static bool Exists(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider, System::Security::Cryptography::CngKeyOpenOptions options);
public static bool Exists (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions options);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions options);
[System.Security.SecurityCritical]
public static bool Exists (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions options);
static member Exists : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> bool
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> bool
[<System.Security.SecurityCritical>]
static member Exists : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> bool
Public Shared Function Exists (keyName As String, provider As CngProvider, options As CngKeyOpenOptions) As Boolean

Parameters

keyName
String

The key name.

provider
CngProvider

The KSP to search for the key.

options
CngKeyOpenOptions

A bitwise combination of the enumeration values that specify options for opening a key.

Returns

true if the named key exists in the specified provider; otherwise, false.

Attributes

Exceptions

keyName or provider is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

Remarks

Use this overload to check for the existence of a key in a KSP other than the default MicrosoftSoftwareKeyStorageProvider, and to specify key open options.

Applies to