Example with msdn for creating HMAC in CryptoApi does not work

0

I am trying to create an HMAC the same as shown on the MSDN site

https://docs.microsoft.com/ru-ru/windows/win32/seccrypto/example-c-program--creating-an-hmac?redirectedfrom=MSDN.

I just copied the code and ran the compile command

g++ hmac_create.c -o result

and i get compile error

    error: 'CALG_HMAC' undeclared (first use in this function); did you mean 'CALG_MAC'?
  115 |     CALG_HMAC,                // HMAC hash algorithm ID
      |     ^~~~~~~~~
      |     CALG_MAC
h.c:115:5: note: each undeclared identifier is reported only once for each function it appears in

If we replace CALG_HMAC with CALG_MAC, then the compilation completes successfully, but by running the file I still get an error

Error in CryptCreateHash 0x80090003

What must i do ?

c
msdn
cryptoapi
asked on Stack Overflow Jan 21, 2021 by СuriousBoy • edited Jan 21, 2021 by СuriousBoy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0