You're getting that error because CMAC doesn't need an IV. Call SetKey 
instead.

--------------------------------------------------
From: "Ger" <[email protected]>
Sent: Thursday, October 15, 2009 2:07 AM
To: "Crypto++ Users" <[email protected]>
Subject: error on implementing CMAC in VS 2003

>
> Hello,
>
> I need to implement CMAC message authentication according to NIST
> Special Publication 800-38B. I try to use the CMAC module from the
> Crypto++ library (version 5.6), but until now I did not succeed.
> I first wrote a short test program with some test data as input, so I
> can verify the output.
> I use Visual studio 2003 and the program is made in C++.
> The program compile is okay, but when I run it, the program stops at
> the “SetKeyWithIV” the message generated by Visual Studio is:
>
>  "Unhandled exception at <address> in <programName>: Microsoft C++
>    exception:
> CryptoPP::AlgorithmParametersBase::ParameterNotUsed@<address>"
>
> I have tried several version but this issue keeps coming up.
>
> This is the code:
>
> #include "cmac.h"
>
> USING_NAMESPACE(CryptoPP)
>
> USING_NAMESPACE(std)
>
> BOOL TestCMAC()
> {
>      byte iv[16];
>      byte bKey[16];
>      byte bTestdata[8];
>      byte bTestDecr[8];
>      CMAC<AES > Cmac;
>
>      // fill bKey with test data
>      // fill iv with test data
>      // fill bTestdata with test data
>
>      Cmac.SetKeyWithIV(bKey, sizeof(bKey), iv, sizeoff(iv));  // Here
> the exception comes up
>
>
>      Cmac.Update(bTestdata, 8);
>      return (TRUE);
> }
>
> Does anyone have an idea what I am doing wrong?
>
> Ger
>
> >
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to