CngKey.Exists 方法

定义

检查特定密钥存储提供程序 (KSP) 中是否存在已命名的密钥。

重载

Exists(String)

检查默认的密钥存储提供程序 (KSP) 中是否存在已命名的密钥。

Exists(String, CngProvider)

检查指定的密钥存储提供程序 (KSP) 中是否存在已命名的密钥。

Exists(String, CngProvider, CngKeyOpenOptions)

根据指定的选项,检查指定的密钥存储提供程序 (KSP) 中是否存在已命名的密钥。

Exists(String)

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

检查默认的密钥存储提供程序 (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

参数

keyName
String

键名称。

返回

如果默认的 KSP 中存在该已命名的密钥,则为 true;否则为 false

属性

例外

keyNamenull

此系统上不支持下一代加密技术 (CNG)。

所有其他错误。

注解

默认 KSP 为 MicrosoftSoftwareKeyStorageProvider

适用于

Exists(String, CngProvider)

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

检查指定的密钥存储提供程序 (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

参数

keyName
String

键名称。

provider
CngProvider

用于检查密钥的 KSP。

返回

如果指定的提供程序中存在该已命名的密钥,则为 true;否则为 false

属性

例外

keyNameprovidernull

此系统上不支持下一代加密技术 (CNG)。

所有其他错误。

注解

使用此重载可检查是否存在除默认 KSP 以外的 KSP 中的键,即 MicrosoftSoftwareKeyStorageProvider

适用于

Exists(String, CngProvider, CngKeyOpenOptions)

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

根据指定的选项,检查指定的密钥存储提供程序 (KSP) 中是否存在已命名的密钥。

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

参数

keyName
String

键名称。

provider
CngProvider

用于搜索密钥的 KSP。

options
CngKeyOpenOptions

指定密钥打开选项的枚举值的按位组合。

返回

如果指定的提供程序中存在该已命名的密钥,则为 true;否则为 false

属性

例外

keyNameprovidernull

此系统上不支持下一代加密技术 (CNG)。

所有其他错误。

注解

使用此重载可检查 KSP 中是否存在默认 MicrosoftSoftwareKeyStorageProvider的 密钥,并指定密钥打开选项。

适用于