Beispiel #1
0
 private void Dispose(bool Disposing)
 {
     if (!m_isDisposed && Disposing)
     {
         try
         {
             if (m_kdfMac != null && m_disposeEngine)
             {
                 m_kdfMac.Dispose();
                 m_kdfMac = null;
             }
             if (m_kdfKey != null)
             {
                 Array.Clear(m_kdfKey, 0, m_kdfKey.Length);
                 m_kdfKey = null;
             }
             if (m_kdfSalt != null)
             {
                 Array.Clear(m_kdfSalt, 0, m_kdfSalt.Length);
                 m_kdfSalt = null;
             }
         }
         finally
         {
             m_isDisposed = true;
         }
     }
 }
Beispiel #2
0
 private void Dispose(bool Disposing)
 {
     if (!m_isDisposed && Disposing)
     {
         try
         {
             if (m_disposeEngine)
             {
                 if (_macEngine != null)
                 {
                     _macEngine.Dispose();
                     _macEngine = null;
                 }
             }
             if (m_disposeStream)
             {
                 if (m_inStream != null)
                 {
                     m_inStream.Dispose();
                     m_inStream = null;
                 }
             }
         }
         finally
         {
             m_isDisposed = true;
         }
     }
 }
Beispiel #3
0
        private static void Test(IMac mac, string plainHex, string cipherHex)
        {
            Span <byte> plain  = plainHex.FromHex();
            Span <byte> cipher = cipherHex.FromHex();
            Span <byte> o      = stackalloc byte[16];

            Assert.AreEqual(@"GHash", mac.Name);

            mac.Update(plain);
            mac.GetMac(o);

            Assert.IsTrue(o.SequenceEqual(cipher));

            mac.Update(plain);
            mac.GetMac(o);

            Assert.IsTrue(o.SequenceEqual(cipher));

            mac.Update(plain);
            mac.Reset();

            mac.Update(plain);
            mac.GetMac(o);

            Assert.IsTrue(o.SequenceEqual(cipher));

            mac.Dispose();
        }
Beispiel #4
0
 private void Dispose(bool Disposing)
 {
     if (!_isDisposed && Disposing)
     {
         try
         {
             if (_digestMac != null && _disposeEngine)
             {
                 _digestMac.Dispose();
                 _digestMac = null;
             }
             if (_macKey != null)
             {
                 _macKey.Dispose();
                 _macKey = null;
             }
             if (_Salt != null)
             {
                 Array.Clear(_Salt, 0, _Salt.Length);
                 _Salt = null;
             }
         }
         finally
         {
             _isDisposed = true;
         }
     }
 }
Beispiel #5
0
        private void DisposeHmac()
        {
#if NO_NATIVE_HMACSHA512
            _hmacAlgorithm.Reset();
#else
            _hmacAlgorithm.Dispose();
#endif
        }
Beispiel #6
0
    private void Test(IMac mac)
    {
        Span <byte> o = stackalloc byte[16];

        mac.Update(_randombytes.Span);
        mac.GetMac(o);

        mac.Dispose();
    }
Beispiel #7
0
        public void Dispose()
        {
            if (!disposed)
            {
                mac.Dispose();
                ctr.Dispose();

                disposed = true;
            }
        }
Beispiel #8
0
 protected virtual void Dispose(bool disposing)
 {
     if (_mac != null)
     {
         _mac.Dispose();
     }
     if (_route != null)
     {
         _route.Dispose();
     }
 }
Beispiel #9
0
        public void Dispose()
        {
            _crypto.Dispose();
            _gHash.Dispose();

            ArrayPool <byte> .Shared.Return(_buffer);

            ArrayPool <byte> .Shared.Return(_tagBuffer);

            ArrayPool <byte> .Shared.Return(_counterBlock);
        }
Beispiel #10
0
 private void Dispose(bool Disposing)
 {
     if (!m_isDisposed && Disposing)
     {
         try
         {
             if (m_kdfMac != null && m_disposeEngine)
             {
                 m_kdfMac.Dispose();
                 m_kdfMac = null;
             }
             if (m_currentT != null)
             {
                 Array.Clear(m_currentT, 0, m_currentT.Length);
                 m_currentT = null;
             }
         }
         finally
         {
             m_isDisposed = true;
         }
     }
 }
Beispiel #11
0
 private void Dispose(bool Disposing)
 {
     if (!_isDisposed && Disposing)
     {
         try
         {
             if (_digestMac != null && _disposeEngine)
             {
                 _digestMac.Dispose();
                 _digestMac = null;
             }
             if (_currentT != null)
             {
                 Array.Clear(_currentT, 0, _currentT.Length);
                 _currentT = null;
             }
         }
         finally
         {
             _isDisposed = true;
         }
     }
 }