CngKey.Exists 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
检查特定密钥存储提供程序(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
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
检查默认密钥存储提供程序(KSP)中是否存在命名密钥。
public:
static bool Exists(System::String ^ keyName);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists(string keyName);
public static bool Exists(string keyName);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string -> bool
static member Exists : string -> bool
Public Shared Function Exists (keyName As String) As Boolean
参数
- keyName
- String
键名称。
返回
true 如果命名键存在于默认 KSP 中,则为 ;否则,为 false.
- 属性
例外
keyName 是 null。
此系统上不支持下一代加密(CNG)。
所有其他错误。
注解
默认的 KSP 为 MicrosoftSoftwareKeyStorageProvider.
适用于
Exists(String, CngProvider)
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- 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.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists(string keyName, System.Security.Cryptography.CngProvider provider);
public static bool Exists(string keyName, System.Security.Cryptography.CngProvider provider);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string * System.Security.Cryptography.CngProvider -> bool
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.
- 属性
例外
keyName 或 provider 为 null.
此系统上不支持下一代加密(CNG)。
所有其他错误。
注解
使用此重载检查 KSP 中是否存在密钥,而不是默认 KSP(即 MicrosoftSoftwareKeyStorageProvider)。
适用于
Exists(String, CngProvider, CngKeyOpenOptions)
- Source:
- Cng.NotSupported.cs
- Source:
- Cng.NotSupported.cs
- 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);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static bool Exists(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.Security.SecurityCritical]
public static bool Exists(string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions options);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Exists : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> bool
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.
- 属性
例外
keyName 或 provider 为 null.
此系统上不支持下一代加密(CNG)。
所有其他错误。
注解
使用此重载检查 KSP 中是否存在键,而不是默认值 MicrosoftSoftwareKeyStorageProvider,并指定键打开选项。