Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

I'm trying to generate HMAC of a message, but the hash generated is not correct. The code, I'm using, is:

if (ISHELL_CreateInstance(pMe->piShell, AEECLSID_SHA1Ctx,(void**)&pMe->piHashCtx) != SUCCESS){
	return;


IHashCtx_Init(pMe->piHashCtx,&ctxHMAC, sizeof(ctxHMAC));

if(IHashCtx_SetKey(pMe->piHashCtx, &ctxHMAC, sizeof(ctxHMAC),Key, TAM_KEY)!= SUCCESS){
	return;


IHashCtx_Update(pMe->piHashCtx, &ctxHMAC, sizeof(ctxHMAC), Msg, Length);

IHashCtx_Final(pMe->piHashCtx, &ctxHMAC, sizeof(ctxHMAC), (byte*)HMACCalculated, &HMACCalculatedLen);

 

What is the problem? 

 

Thanks

These is the declaration of variables:
char scHMACCalculated[SHA1_DIGEST_LENGTH];
int slHMACCalculatedLen = SHA1_DIGEST_LENGTH;
AEE_SHA1_CTX ctxHMAC;

These is the declaration of variables:
char scHMACCalculated[SHA1_DIGEST_LENGTH];
int slHMACCalculatedLen = SHA1_DIGEST_LENGTH;
AEE_SHA1_CTX ctxHMAC;

how do u know its giving wrong output?
try to read my 2 posts on the below thread:-
https://developer.brewmp.com/forum/ihash-error
see if it helps.

how do u know its giving wrong output?
try to read my 2 posts on the below thread:-
https://developer.brewmp.com/forum/ihash-error
see if it helps.