Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​CngKey
Assembly: System.Security.Cryptography
Inheritance: object → CngKey
Defines the core functionality for keys that are used with Cryptography Next Generation (CNG) objects.
Properties
public
CngAlgorithm
Algorithm
Gets the algorithm that is used by the key.
public
CngAlgorithmGroup
AlgorithmGroup
Gets the algorithm group that is used by the key.
public
CngExportPolicies
ExportPolicy
Gets the export policy that is used by the key.
public
Microsoft.​Win32.​SafeHandles.​SafeNCryptKeyHandle
Handle
Gets a safe handle that represents a native key (NCRYPT_KEY_HANDLE).
public
bool
IsEphemeral
Gets the persistence state of the key.
public
bool
IsMachineKey
Gets the scope (machine or user) of the key.
public
string
KeyName
Gets the name of the key.
public
int
KeySize
Gets the key size in bits.
public
CngKeyUsages
KeyUsage
Gets the cryptographic operations specified by the key.
public
nint
ParentWindowHandle
Gets or sets the window handle (HWND) that should be used for user interface (UI) prompts caused by accessing the key.
public
CngProvider
Provider
Gets the key storage provider (KSP) that manages the key.
public
Microsoft.​Win32.​SafeHandles.​SafeNCryptProviderHandle
ProviderHandle
Gets a native handle (an NCRYPT_PROV_HANDLE) to the key storage provider (KSP).
public
CngUIPolicy
UIPolicy
Gets parameters that control the user interface (UI) for accessing the key.
public
string
UniqueName
Gets the unique name for the key.
Methods
public
void
Delete​()
Removes the key that is associated with the object.
public
void
Dispose​()
Releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.CngKey" /> class.
public
byte[]
Export​(CngKeyBlobFormat format)
format
An object that specifies the format of the key BLOB.
Returns A BLOB that contains the key material in the specified format.
Exports the key material into a BLOB, in the specified format.
public
CngProperty
GetProperty​(string name,
CngPropertyOptions options)
name
The name of the desired property.
options
A bitwise combination of the enumeration values that specify options for the named property.
Returns An object that contains the raw value of the specified property.
Gets a property, given a name and a set of property options.
public
bool
HasProperty​(string name,
CngPropertyOptions options)
name
The property name to check.
options
A bitwise combination of the enumeration values that specify options for the named property.
Returns <see langword="true" /> if the specified property is found; otherwise, <see langword="false" /> .
Checks to see whether the specified property exists on the key.
Sets a named property on the key.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object