internal AppleHmacProvider(Interop.AppleCrypto.PAL_HashAlgorithm algorithm, byte[] key) { _key = key.CloneByteArray(); int hashSizeInBytes = 0; _ctx = Interop.AppleCrypto.HmacCreate(algorithm, ref hashSizeInBytes); if (hashSizeInBytes < 0) { _ctx.Dispose(); throw new PlatformNotSupportedException( SR.Format( SR.Cryptography_UnknownHashAlgorithm, Enum.GetName(typeof(Interop.AppleCrypto.PAL_HashAlgorithm), algorithm))); } if (_ctx.IsInvalid) { _ctx.Dispose(); throw new CryptographicException(); } HashSizeInBytes = hashSizeInBytes; }
internal static extern unsafe int HmacFinal(SafeHmacHandle ctx, byte* pbOutput, int cbOutput);
internal static extern unsafe int HmacUpdate(SafeHmacHandle ctx, byte* pbData, int cbData);
internal static extern unsafe int HmacInit(SafeHmacHandle ctx, byte* pbKey, int cbKey);