CngKey.Exists 方法

定義

檢查特定金鑰儲存提供者 (KSP) 中是否有具名金鑰。

多載

Exists(String)

查看具名金鑰是否存在預設的金鑰儲存提供者 (KSP) 中。

Exists(String, CngProvider)

查看具名金鑰是否存在指定的金鑰儲存提供者 (KSP) 中。

Exists(String, CngProvider, CngKeyOpenOptions)

根據指定的選項,查看具名金鑰是否存在指定的金鑰儲存提供者 (KSP) 中。

Exists(String)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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,並指定密鑰開啟選項。

適用於