ChainSafe/js-libp2p-noise

plaintext payloads larger than 65,519 bytes will fail to decrypt

yusefnapora opened this issue · 0 comments

Because the max length of a Noise message is 65,535 bytes, including 16 bytes of AEAD authentication data, plaintext messages larger than 65,519 bytes need to be split up into smaller chunks before encrypting. Otherwise, the encrypted payloads will end up being prefixed with the wrong length (since the length-prefixes max out at 65,535) and decryption will fail.

libp2p/go-libp2p-noise#10 fixes this same issue in the go implementation, if that's helpful for reference.