Example #1
0
 public void Dispose()
 {
     _bufferPool.Return(_keyStore);
     _keyStore = null;
     _key.Dispose();
     GC.SuppressFinalize(this);
 }
Example #2
0
        public void Dispose()
        {
            if (m_key != null)
            {
                m_key.Dispose();
            }

            if (m_algorithm != null)
            {
                m_algorithm.Dispose();
            }
        }
Example #3
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (m_key != null)
                {
                    m_key.Dispose();
                }

                if (m_algorithm != null)
                {
                    m_algorithm.Dispose();
                }

                if (m_inputBuffer != null)
                {
                    m_inputBuffer.Dispose();
                }
            }

            if (m_authInfo.pbAuthData != IntPtr.Zero)
            {
                Marshal.FreeCoTaskMem(m_authInfo.pbAuthData);
                m_authInfo.pbAuthData = IntPtr.Zero;
                m_authInfo.cbAuthData = 0;
            }

            if (m_authInfo.pbMacContext != IntPtr.Zero)
            {
                Marshal.FreeCoTaskMem(m_authInfo.pbMacContext);
                m_authInfo.pbMacContext = IntPtr.Zero;
                m_authInfo.cbMacContext = 0;
            }

            if (m_authInfo.pbNonce != IntPtr.Zero)
            {
                Marshal.FreeCoTaskMem(m_authInfo.pbNonce);
                m_authInfo.pbNonce = IntPtr.Zero;
                m_authInfo.cbNonce = 0;
            }

            if (m_authInfo.pbTag != IntPtr.Zero)
            {
                Marshal.FreeCoTaskMem(m_authInfo.pbTag);
                m_authInfo.pbTag = IntPtr.Zero;
                m_authInfo.cbTag = 0;
            }
        }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                SafeBCryptKeyHandle hKey = _hKey;
                _hKey = null;
                if (hKey != null)
                {
                    hKey.Dispose();
                }

                byte[] currentIv = _currentIv;
                _currentIv = null;
                if (currentIv != null)
                {
                    Array.Clear(currentIv, 0, currentIv.Length);
                }
            }

            base.Dispose(disposing);
        }
Example #5
0
 public void Dispose()
 {
     _key?.Dispose();
     _peerKey?.Dispose();
 }
Example #6
0
 public void Dispose()
 {
     _key?.Dispose();
 }