Microsoft.Win32.SafeHandles.SafeProvOrNCryptKeyHandleUwp.ReleaseHandle C# (CSharp) Method

ReleaseHandle() protected final method

protected final ReleaseHandle ( ) : bool
return bool
        protected override sealed bool ReleaseHandle()
        {
            if (_parentHandle != null)
            {
                _parentHandle.DangerousRelease();
                _parentHandle = null;
                SetHandle(IntPtr.Zero);
                return true;
            }
            else if (_isNcrypt)
            {
                ErrorCode errorCode = Interop.NCrypt.NCryptFreeObject(handle);
                return errorCode == ErrorCode.ERROR_SUCCESS;
            }
            else
            {
                bool success = Interop.Crypt32.CryptReleaseContext(handle, 0);
                return success;
            }
        }