3 ms·
Not sure if I'm just bad at reading Rust code, but it looks like the end-to-end encryption is implemented by pre-sharing a symmetric key, and communicating a 24
by d-z-m 3y ago
Not sure if I'm just bad at reading Rust code, but it looks like the end-to-end encryption is implemented by pre-sharing a symmetric key, and communicating a 24 byte xChacha20Poly1305 nonce over the wire as websockets are established. This key and nonce are subsequently used to encrypt and decrypt messages sent between the two parties. It looks like the encrypt and decrypt functions are called as new websocket traffic is read or written to the stream.
If true, this means that every message sent via this means uses an identical keystream to encrypt all messages, and thus results in a loss of confidentiality of all messages. Am I missing something?
https://github.com/narrowlink/narrowlink/blob/abf35e38567b8802c1e6ab0bf9ee9c01a7f90a21/network/src/lib.rs#L99 https://github.com/narrowlink/narrowlink/blob/abf35e38567b88...
https://github.com/narrowlink/narrowlink/blob/abf35e38567b8802c1e6ab0bf9ee9c01a7f90a21/client/src/main.rs#L314 https://github.com/narrowlink/narrowlink/blob/abf35e38567b88...
- dathinab 3y ago(Disclaimer: not related to the referenced narrowlink code, but the sentiment of the parent post) I which stuff like libsodium would be both more widely available and more widely used. And with "stuff" I don't mean the internal core primitives but the slightly more higher level helper which often try (in the limits of C) limit miss use and have reasonable good documentation. E.g. crypto_secretstream_xchacha20poly1305* from https://doc.libsodium.org/secret-key_cryptography https://doc.libsodium.org/secret-key_cryptography /secretstream Because while by now most people have understood that inventing/putting together their own low level crypto primitives is a bad idea, people using existing low level primitives to invent their own "mid level" primitives still happen more often then healthy in the industry.