On Sun, Nov 5, 2023 at 4:38 AM Lucas Marchetti <lmarchetti...@gmail.com>
wrote:

> Sorry, seeing now that I've linked the wrong Golang library, here it is:
> https://pkg.go.dev/golang.org/x/crypto/chacha20poly1305
>
> On Sunday, November 5, 2023 at 10:10:44 AM UTC+1 Lucas Marchetti wrote:
>
>> I've just made a test encrypting the string "Hello World!" with both
>> client and server functions and these are the results.
>>
>> [image: Screenshot 2023-11-05 100312.png]
>>
>> Both green-highlighted bytes corresponds to the input string but, as you
>> can see, there is a different padding that I'm 100% sure is the source of
>> the problem.
>>
>> On Saturday, November 4, 2023 at 7:39:31 PM UTC+1 Lucas Marchetti wrote:
>>
>>> Good evening.
>>>
>>> I'm building a client-server application and I want to implement a
>>> XChaCha20 communication over TCP after performing key exchange.
>>>
>>> What I'm issuing is a bad decryption output like the one shown in the
>>> pic.
>>>
>>> [image: Screenshot 2023-11-04 193625.png]
>>>
>>> I'm currently using crypto++ 8.9 in the client-side and
>>> https://pkg.go.dev/golang.org/x/crypto/chacha20 in the server-side.
>>>
>>> Is that something related to sealing or authentication implemented in
>>> the Golang library?
>>>
>>> Functions that I'm using:
>>>
>>> [image: Screenshot 2023-11-04 193751.png]
>>>
>>> [image: Screenshot 2023-11-04 193832.png]
>>>
>>> Thanks in advance.
>>>
>> If you want help, then you should provide source code and post a link to
a minimal reproducer. Pictures are not helpful.

The wiki is full of little working examples. For example, <
https://www.cryptopp.com/wiki/XChaCha20> and <
https://www.cryptopp.com/wiki/XChaCha20Poly1305>.

You should also probably start with test vectors, and then move onto
arbitrary messages once things work with test vectors. Here are the ones
Crypto++ uses for XChaCha: <
https://github.com/weidai11/cryptopp/blob/master/TestVectors/chacha.txt>.
And here are the ones for ChaCha20/Poly1305: <
https://github.com/weidai11/cryptopp/blob/master/TestVectors/chacha20poly1305.txt#L4669
>.

I'm just guessing, but the 16-bytes of garbage at the end of the
[encrypted] message may be a Poly1305 authentication tag. But it is just a
guess. The go documentation should tell you what you have.

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/CAH8yC8nsoQPBtdeHhtMTRw%3DB8mFBpCj2QkcrEQbSJMuLRZw98w%40mail.gmail.com.

Reply via email to