std::string cipher;
StringSource(ct, sizeof(ct), true, new HexEncoder(new StringSink(cipher)));
const byte* xct = reinterpret_cast<const byte*>(cipher.data());
dec.DecryptAndVerify(rt, mac, sizeof(mac), iv, sizeof(iv), aad, sizeof(aad), xct, sizeof(xct));
but this doesn't seem to work
Thank you for your reply.I am following this example - https://www.cryptopp.com/wiki/XChaCha20Poly1305and trying to use std::string instead of byteinstead of using byte array for ct like thisdec.DecryptAndVerify(rt, mac, sizeof(mac), iv, sizeof(iv), aad, sizeof(aad), ct, sizeof(ct));I am trying to use string like thisstd::string cipher;
StringSource(ct, sizeof(ct), true, new HexEncoder(new StringSink(cipher)));
const byte* xct = reinterpret_cast<const byte*>(cipher.data());
dec.DecryptAndVerify(rt, mac, sizeof(mac), iv, sizeof(iv), aad, sizeof(aad), xct, sizeof(xct));
const byte* xmac = reinterpret_cast<const byte*>(strMac.data());
dec.DecryptAndVerify(rt, xmac, sizeof(xmac), iv, sizeof(iv), aad, sizeof(aad), ct, sizeof(ct));
the issue arises when I try to work with xct