cipher.size() doesn't help :/ the problem is not related to size but the xct pointer itself
however, if I do something similar with mac, it works *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 On Tuesday, 9 March 2021 at 15:53:42 UTC-5 Jeffrey Walton wrote: > On Tuesday, March 9, 2021 at 3:45:47 PM UTC-5 devhar...@gmail.com wrote: > >> Thank you for your reply. >> >> I am following this example - >> https://www.cryptopp.com/wiki/XChaCha20Poly1305 >> >> and trying to use std::string instead of byte >> >> instead of using byte array for ct like this >> dec.DecryptAndVerify(rt, mac, sizeof(mac), iv, sizeof(iv), aad, >> sizeof(aad), ct, sizeof(ct)); >> >> I am trying to use string like this >> >> 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)); >> > > dec.DecryptAndVerify(rt, mac, sizeof(mac), iv, sizeof(iv), aad, > sizeof(aad), xct, cipher.size()); > > Jeff > -- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/cryptopp-users/cb4168cd-ea83-4bc0-b5bb-4685fb9a0e44n%40googlegroups.com.