Re: [Help] Create HMAC

From: Mark_Pryor (marks.pryorCHENEY_at_SHRUBverizon.net)
Date: 03/17/04


Date: Tue, 16 Mar 2004 22:29:33 -0800


"Kevin" <kevin13@email.yfp.com.tw.NO_SPAM> wrote in message
news:uk197g8CEHA.3280@TK2MSFTNGP09.phx.gbl...
> I tried to create a hmac just like MSDN said.
> I generated a session key, and tried to use this key to create a hash:
> CryptCreateHash(hProv, CALG_HMAC, hKey, 0, &hHash);
> It works fine.
> But it always failed when I tried to hash data:
> CryptHashData(hHash, (BYTE*)"test string", strlen("test string") + 1, 0);
> Return code is 0x80090008 (NTE_BAD_ALGID), means this CSP doesn't
support!?
> Is there any thing I do wrong or I miss?
>
> BTW, I'm using Microsoft Base Cryptographic Provider v1.0 for my CSP.
>
>

The Base Provider will support HMAC, as long as
you specify the hash type.

What about passing the _HMAC_Info structure into
CryptSetHashParam? The first member of this struc
is the Hash Alg_ID.

What CALG_ did you use to derive your hKey? Only
40 bit RC4-RC2, or 56 bit DES are sure to work.

good luck,
msp



Relevant Pages

  • Re: [Help] Create HMAC
    ... > I tried to create a hmac just like MSDN said. ... > I generated a session key, and tried to use this key to create a hash: ... This is how I derive my session key, ... CryptDeriveKey(hProv, CALG_DES, hHash, CRYPT_CREATE_SALT, &hKey); ...
    (microsoft.public.platformsdk.security)
  • Importing a presisted hash value and using it CryptDeriveKey results in NTE_BAD_HASH
    ... I'm attempting to import a persisted hash value by calling ... CryptSetHashParamand then generate the derived session key I need ... The call to CryptDeriveKey returns ...
    (microsoft.public.platformsdk.security)
  • Re: Non-randomised session keys for encrypting files?
    ... If the hash of the unencrypted data is used as key, he wouldn't reuse the same combination of key and IV for more than one set of data. ... In fact, if a keyed PRF such as HMAC with a secret key is used as "session key", I think such a scheme might actually be made to have the security properties the OP would expect. ... he could use a static key as content encryption key and the output of the keyed PRF as IV. ...
    (sci.crypt)
  • Re: AES session key derivation
    ... > In PSDK there is a example how to derive RC4 session key from hash object. ...
    (microsoft.public.platformsdk.security)
  • Re: AES session key derivation
    ... > In PSDK there is a example how to derive RC4 session key from hash object. ...
    (microsoft.public.platformsdk.security)

Quantcast