diff options
| author | Jeffrey Walton <noloader@gmail.com> | 2016-10-02 16:20:25 -0400 |
|---|---|---|
| committer | Jeffrey Walton <noloader@gmail.com> | 2016-10-02 16:20:25 -0400 |
| commit | 55bbc55a7e5729506eb98106678aac4500979b7b (patch) | |
| tree | f72f188f52e21213ae8d09828fde3f47dcf1d133 /test.cpp | |
| parent | 3ea28efa69de7b1360494b76f52da432c0dacd32 (diff) | |
| download | cryptopp-git-55bbc55a7e5729506eb98106678aac4500979b7b.tar.gz | |
Report computed MAC (Issue 314)
Diffstat (limited to 'test.cpp')
| -rw-r--r-- | test.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -287,9 +287,18 @@ int CRYPTOPP_API main(int argc, char *argv[]) f.AddRangeToSkip(0, certificateTablePos, certificateTableSize);
f.PutMessageEnd(buf.begin(), buf.size());
+ // Encode MAC
+ string hexEncoded;
+ HexEncoder encoder;
+ encoder.Put(mac, sizeof(mac)), encoder.MessageEnd();
+ hexEncoded.resize(static_cast<size_t>(encoder.MaxRetrievable()));
+ encoder.Get(reinterpret_cast<byte*>(&hexEncoded[0]), hexEncoded.size());
+
+ // Report MAC and location
+ std::cout << "Placing MAC " << hexEncoded << " in " << fname << "at location " << macPos;
+ std::cout << " (0x" << std::hex << macPos << std::dec << ").\n";
+
// place MAC
- cout << "Placing MAC in file " << fname << ", location " << macPos;
- cout << " (0x" << std::hex << macPos << std::dec << ").\n";
dllFile.seekg(macPos, std::ios_base::beg);
dllFile.write((char *)mac, sizeof(mac));
}
|
