MacTripleDes (.NET managed and CryptoApi unmanaged interop)

From: casey chesnut (casey_at_brains-N-brawn.com)
Date: 10/07/03


Date: Mon, 6 Oct 2003 18:16:23 -0500

I need to do both keyed hashes (MacTripleDes and HmacSha1).
I can do HmacSha1 using pInvokes to the CryptoApi,
and then get the same hash value using .NET.

But I am not having the same luck with MacTripleDes.
On the managed side all i do is:
MACTripleDES mtd = new MACTripleDES(_key);
byte [] mHash = mtd.ComputeHash(_value);

For the cryptoApi, its something like this:
//get TripleDes key handle
IntPtr key = CryptGenKey(prov, Calg.TRIP_DES, GenKeyParam.EXPORTABLE);
//get 24 byte key as byte [] 'baKey' using nullKey export hack, and then
reverse it
IntPtr hash = CryptCreateHash(prov, Calg.MAC, key);
HashData(baKey, data);
byte [] hashVal = CryptGetHashParam(hash);
CryptDestroyHash(hash);
CryptDestroyKey(key);

Any ideas?

Thanks
casey



Relevant Pages

  • MacTripleDes (.NET managed and CryptoApi unmanaged interop)
    ... I need to do both keyed hashes (MacTripleDes and HmacSha1). ... I can do HmacSha1 using pInvokes to the CryptoApi, ... and then get the same hash value using .NET. ...
    (microsoft.public.platformsdk.security)
  • RE: MacTripleDes (.NET managed and CryptoApi unmanaged interop)
    ... the CryptoApi functions. ... This posting is provided "AS IS" with no warranties and confers no rights. ... I need to do both keyed hashes (MacTripleDes and HmacSha1). ...
    (microsoft.public.platformsdk.security)
  • Re: HMAC-MD5
    ... You don't have the HMACMD5 in v1.1., only HMACSHA1 and MACTripleDES. ... might use any of this algs. ...
    (microsoft.public.dotnet.framework.aspnet.security)

Quantcast