NCrypt Handle Class
Provides a safe handle that can be used by Cryptography Next Generation (CNG) objects.
This API supports the product infrastructure and is not intended to be used directly from your code.
public ref class SafeNCryptHandle abstract : Microsoft::Win32::SafeHandles::SafeHandleZeroOrMinusOneIsInvalid
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] public abstract class SafeNCryptHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
type SafeNCryptHandle = class inherit SafeHandleZeroOrMinusOneIsInvalid
Public MustInherit Class SafeNCryptHandle Inherits SafeHandleZeroOrMinusOneIsInvalid
This class wraps up the logic to correctly duplicate and free these handles to simulate a native duplication.
Each open handle object can be thought of as being in one of three states:
- Owner - Created via the marshaler, traditional style safe handle. Notably, only one owner handle exists for a given native handle.
- Duplicate - Points at a handle in the Holder state. Releasing a handle in the duplicate state results only in decrementing the reference count of the holder, not in a release of the native handle.
- Holder - Holds onto a native handle and is referenced by handles in the duplicate state. When all duplicate handles are closed, the holder handle releases the native handle. A holder handle will never be finalized, since this results in a race between the finalizers of the duplicate handles and the holder handle. Instead, it relies upon all of the duplicate handles to be finalized and decrement the ref count to zero. Instances of a holder handle should never be referenced by anything but a duplicate handle.
Initializes a new instance of the SafeNCryptHandle class.
Instantiates a new instance of the SafeNCryptHandle class.
Specifies the handle to be wrapped.(Inherited from SafeHandle)
Gets a value indicating whether the handle is closed.(Inherited from SafeHandle)
Marks the handle for releasing and freeing resources.(Inherited from SafeHandle)
Manually increments the reference counter on SafeHandle instances.(Inherited from SafeHandle)
Returns the value of the handle field.(Inherited from SafeHandle)
Manually decrements the reference counter on a SafeHandle instance.(Inherited from SafeHandle)
Releases all resources used by the SafeHandle class.(Inherited from SafeHandle)
Releases the unmanaged resources used by the SafeHandle class specifying whether to perform a normal dispose operation.(Inherited from SafeHandle)
Determines whether the specified object is equal to the current object.(Inherited from Object)
Serves as the default hash function.(Inherited from Object)
Gets the Type of the current instance.(Inherited from Object)
Creates a shallow copy of the current Object.(Inherited from Object)
Releases a handle used by a Cryptography Next Generation (CNG) object.
Releases a native handle used by a Cryptography Next Generation (CNG) object.
Sets the handle to the specified pre-existing handle.(Inherited from SafeHandle)
Marks a handle as no longer used.(Inherited from SafeHandle)
Returns a string that represents the current object.(Inherited from Object)