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); } }
internal extern static unsafe int HmacUpdate(SafeHmacCtxHandle ctx, byte* data, int len);
internal extern static unsafe int HmacFinal(SafeHmacCtxHandle ctx, byte* data, ref int len);
internal extern static int HmacReset(SafeHmacCtxHandle ctx);