[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    Re: HP_HASHSIZE for HMAC
From:       Cameron Durham <cameron.durham () LITRONIC ! COM>
Date:       2000-04-13 0:57:28
[Download RAW message or body]


In the CryptoAPI archives (reachable via the link at the bottom of the page)
there is the CSP HMAC proposal by Jeff Spelman that describes the operation
of the HMAC.

Basically, HMAC isn't an algorithm, it's a way to perform a keyed hash.
Once you've created the hash object, you still need to specify the hash
algorithm.

If you follow the instructions Jeff lays out, the operation works great.

Cam

-----Original Message-----
From: Microsoft Cryptographic API
[mailto:CryptoAPI@DISCUSS.MICROSOFT.COM]On Behalf Of Harry Whitehouse
Sent: Wednesday, April 12, 2000 5:11 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: Re: HP_HASHSIZE for HMAC


Hmmmm... My test code used a SHA1 hash.

Could it be that a keyed hash can't use an RC2 key?  I don't know.

Perhaps an experiment would be to create a DES key rather than RC2, and then
see if the hash doesn't error on creation.

H
-----Original Message-----
From: Microsoft Cryptographic API
[mailto:CryptoAPI@DISCUSS.MICROSOFT.COM]On Behalf Of mzaturenski
Sent: Wednesday, April 12, 2000 5:07 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: Re: HP_HASHSIZE for HMAC


yes I do, and this code works fine for MD5 hash, but for HMAC it doesn't ,
something special with HMAC

-----Original Message-----
From: Harry Whitehouse [mailto:harry@ENVMGR.COM]
Sent: Wednesday, April 12, 2000 4:56 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: Re: HP_HASHSIZE for HMAC


On your latest code, you do have the '&' before the hashSize, yes?

-----Original Message-----
From: Microsoft Cryptographic API
[mailto:CryptoAPI@DISCUSS.MICROSOFT.COM]On Behalf Of mzaturenski
Sent: Wednesday, April 12, 2000 4:51 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: Re: HP_HASHSIZE for HMAC


I am sorry, this line should be read like this(cut and copy mistake), but
the same error is the same:
...
        if (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE*)&hashSize, &dwLen,
NULL))
...


-----Original Message-----
From: Harry Whitehouse [mailto:harry@ENVMGR.COM]
Sent: Wednesday, April 12, 2000 4:43 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: Re: HP_HASHSIZE for HMAC


Micheal

Try an address reference for hashSize ... &.  Also, you have a NULL at the
end, not an ULL, correct?

if (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE*)&hashSize, &dwLen, NULL))

HTH

Harry

-----Original Message-----
From: Microsoft Cryptographic API
[mailto:CryptoAPI@DISCUSS.MICROSOFT.COM]On Behalf Of Michael Zaturenski
Sent: Wednesday, April 12, 2000 4:34 PM
To: CryptoAPI@DISCUSS.MICROSOFT.COM
Subject: HP_HASHSIZE for HMAC


Hello all,
may be somebody can point me why the CryptGetHashParam(..HP_HASHSIZE..)
fails with err = 0x80090008 in the following conde:

.....

char *pName=   "Microsoft Enhanced Cryptographic Provider v1.0";
char* pCont = NULL;

HCRYPTPROV  hProvider;
HCRYPTKEY   hSecretKey;
HCRYPTHASH  hHash;
DWORD hashSize;
DWORD dwLen = 4;

if(!CryptAcquireContext(&hProvider, pCont, pName, PROV_RSA_FULL, ))
  printf("ERROR: CryptAcquireContext\n");

if (!CryptGenKey(hProvider, CALG_RC2,0, &hSecretKey))
  printf("ERROR: CryptGenKey\n");

if(!CryptCreateHash(hProvider, CALG_HMAC, hSecretKey, 0, &hHash))
  printf("ERROR: during CryptBeginHash!\n");

if (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE*)hashSize, &dwLen, ULL))
 {
  DWORD err = GetLastError();
  printf("ERROR: Fail to get teh HP_HASHSIZE.\n");
 }

.......


TIA,
Michael

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic