public sealed override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_hmacCtx != null)
         {
             _hmacCtx.Dispose();
             _hmacCtx = null;
         }
     }
 }
            public unsafe HmacHashProvider(IntPtr algorithmEvp, byte[] key)
            {
                Debug.Assert(algorithmEvp != IntPtr.Zero);
                Debug.Assert(key != null);

                _hashSize = Interop.Crypto.EvpMdSize(algorithmEvp);
                if (_hashSize <= 0 || _hashSize > Interop.Crypto.EVP_MAX_MD_SIZE)
                {
                    throw new CryptographicException();
                }

                fixed (byte* keyPtr = key)
                {
                    _hmacCtx = Interop.Crypto.HmacCreate(keyPtr, key.Length, algorithmEvp);
                    Interop.libcrypto.CheckValidOpenSslHandle(_hmacCtx);
                }
            }
Exemple #3
0
 internal extern static unsafe int HmacUpdate(SafeHmacCtxHandle ctx, byte* data, int len);
Exemple #4
0
 internal extern static unsafe int HmacFinal(SafeHmacCtxHandle ctx, byte* data, ref int len);
Exemple #5
0
 internal extern static int HmacReset(SafeHmacCtxHandle ctx);