I found a way to generate an MessageAuthenticationCode, but I am having
trouble figuring out how to best verify that code later on.
The code I have to generate it looks like this:
CryptoPP::member_ptr<CryptoPP::MessageAuthenticationCode> mac;
std::string decodedKey;
CryptoPP::HexDecoder *myDecoder = new
CryptoPP::HexDecoder(new CryptoPP::StringSink(decodedKey));
CryptoPP::StringSource(hexKey, true, myDecoder);
mac.reset(new CryptoPP::HMAC<CryptoPP::SHA1>((const byte
*)decodedKey.data(),
decodedKey.size()));
CryptoPP::FileSource(file,
true,
new CryptoPP::HashFilter(*mac,
new CryptoPP::HexEncoder(
new CryptoPP::FileSink(std::cout))));
What don't know is if I should use the HashCodeVerifier or just call
HMAC.Verify()? If I do call the Verify method, do I set up the whole
HMAC as if I were generating the hash, but call verify instead?
Thanks in advance,
Jason