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));


but this doesn't seem to work
On Saturday, 6 March 2021 at 04:45:58 UTC-5 Jeffrey Walton wrote:

> On Friday, March 5, 2021 at 5:23:20 PM UTC-5 devhar...@gmail.com wrote:
>
>> I am trying to convert a std::string to cryptopp::byte like this
>> const byte* pt = reinterpret_cast<const byte*>(&alert[0]);
>>
>> but it doesn't copy the full string, as confirmed by sizeof
>> sizeof(alert) = 24
>> sizeof(pt) = 8
>>
>> why is it truncating to first 8 bytes?
>>
>
> pt is a pointer. A pointer on x86_64 is 8 bytes.
>
> 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/2bc2f089-3869-4cdd-86ce-99e26d560651n%40googlegroups.com.

Reply via email to