public void Delete() { KeyContainerPermission permission = this.BuildKeyContainerPermission(KeyContainerPermissionFlags.Delete); if (permission != null) { permission.Demand(); } NCryptNative.DeleteKey(this.m_keyHandle); this.Dispose(); }
public void Delete() { Contract.Assert(m_keyHandle != null); // Make sure we have permission to delete this key KeyContainerPermission permission = BuildKeyContainerPermission(KeyContainerPermissionFlags.Delete); if (permission != null) { permission.Demand(); } NCryptNative.DeleteKey(m_keyHandle); // Once the key is deleted, the handles are no longer valid so dispose of this instance Dispose(); }