CngKey.Delete Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Removes the key that is associated with the object.

Namespace:   System.Security.Cryptography
Assembly:  System.Core (in System.Core.dll)

public void Delete()

Exception Condition

An attempt was made to access a deleted key.


All other errors.

  • When you call the Delete method on an ephemeral key, it closes the handle to the key.

When you call the Delete method on a named key, the CngKey object can no longer be used after the named key is deleted.


for permission to sign data. Demand value: Demand. Associated enumeration: KeyContainerPermissionFlags.Delete

.NET Framework
Available since 3.5
Return to top