|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
error on implementing CMAC in VS 2003Hello, 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 cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: error on implementing CMAC in VS 2003You're getting that error because CMAC doesn't need an IV. Call SetKey instead. -------------------------------------------------- From: "Ger" <haven@...> Sent: Thursday, October 15, 2009 2:07 AM To: "Crypto++ Users" <cryptopp-users@...> 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 cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: error on implementing CMAC in VS 2003Thank you, I have now succesfully done some CMAC calculations. I have one remaining problem: when the message is e.g. 6 byte, according to the specification Padding bytes have to be added till the correct block size is reached (eg 8 bytes). The first padding byte has to be 0x80 the others 0x00. When I do this the output is not as expected. In the next attempt I did not provide padding bytes and pass the real length to the Updata function (eg. 6). This also did not give the expected output. The code I am using: CMAC<AES> Cmac; // Fill bKey; bTestdata with testdata : result in bTestDecr Cmac.SetKey(bKey, sizeof(bKey)); Cmac.Update(bTestdata, sizeof(bTestdata)); Cmac.Final(bTestDecr); Can anyone tell me what I do wrong ? Regards, Ger On 20 okt, 02:25, "Wei Dai" <wei...@...> wrote: > You're getting that error because CMAC doesn't need an IV. Call SetKey > instead. > > -------------------------------------------------- > From: "Ger" <ha...@...> > Sent: Thursday, October 15, 2009 2:07 AM > To: "Crypto++ Users" <cryptopp-users@...> > 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- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscribe@.... More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |