CngKey::Exists Method (String^, CngProvider^, CngKeyOpenOptions)
Checks to see whether a named key exists in the specified key storage provider (KSP), according to the specified options.
Assembly: System.Core (in System.Core.dll)
public: static bool Exists( String^ keyName, CngProvider^ provider, CngKeyOpenOptions options )
Parameters
- keyName
-
Type:
System::String^
The key name.
- provider
-
Type:
System.Security.Cryptography::CngProvider^
The KSP to search for the key.
- options
-
Type:
System.Security.Cryptography::CngKeyOpenOptions
A bitwise combination of the enumeration values that specify options for opening a key.
Return Value
Type: System::Booleantrue if the named key exists in the specified provider; otherwise, false.
| Exception | Condition |
|---|---|
| ArgumentNullException | keyName or provider is null. |
| PlatformNotSupportedException | Cryptography Next Generation (CNG) is not supported on this system. |
| CryptographicException | All other errors. |
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.
Available since 3.5