MacTripleDes (.NET managed and CryptoApi unmanaged interop)
From: casey chesnut (casey_at_brains-N-brawn.com)
Date: 10/07/03
- Next message: smp: "Urgent encryption help needed"
- Previous message: Gabriele Zannoni: "XmlSigned: Criptography implementation & WSE implementation"
- Next in thread: Sebastien Pouliot: "Re: MacTripleDes (.NET managed and CryptoApi unmanaged interop)"
- Reply: Sebastien Pouliot: "Re: MacTripleDes (.NET managed and CryptoApi unmanaged interop)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: smp: "Urgent encryption help needed"
- Previous message: Gabriele Zannoni: "XmlSigned: Criptography implementation & WSE implementation"
- Next in thread: Sebastien Pouliot: "Re: MacTripleDes (.NET managed and CryptoApi unmanaged interop)"
- Reply: Sebastien Pouliot: "Re: MacTripleDes (.NET managed and CryptoApi unmanaged interop)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|