rust-bitcoin / rust-bitcoin/bip324
Example of a streamed variant of BIP324
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Despite the word "stream" being mentioned multiple times in BIP-324, the handshake part is message-based. This issue is indirectly addressed in the proposal:
To avoid the recognizable pattern of first messages being at least 64 bytes, a future backwards-compatible upgrade to this protocol may allow both peers to send their public key + garbage + garbage terminator in multiple rounds, slicing those bytes up into messages arbitrarily, as long as progress is guaranteed
It's a big task, understandably, to turn this protocol into a fully streamed one. The adversarial model might be different, and the security requirements might change. So, I didn't create this issue to critique an implementation that is following the design laid out by BIP-324. I'm only showcasing my attempt at implementing a streamed variant of this protocol.
I am working on a library that performs a MitM over BIP-324. One requirement of the library is to be as transparent as possible. So, I don't assume the order in which the bytes are transmitted, meaning that as soon as a byte is intercepted on one side, a byte is transmitted on the other. This can only be achieved if the channels are fully streamed on both sides of the MitM channel. The only exception to this is the garbage terminator, which can only be detected when we receive it in its entirety.
https://github.com/RazorBest/bip324-mitm/pull/1
Here are some differences from the original BIP324 protocol:
- The state needs to include some extra buffers for the messages that are partially received but can't be processed yet
FSChaCha20is rewritten to support streaming- Similarly,
ChaCha20Poly1305has its streamed implementation. However, the rekeying mechanism made it challenging to fully replaceFSChaCha20Poly1305. So, I kept the original struct in order to keep track of rekeying, and used a second struct, namedChaCha20Poly1305Streamthat supports streamed encryption of one payload. For each payload, a new instance of typeChaCha20Poly1305Streamis created. - Lastly, my library doesn't implement the classic client-server paradigm, so it's not a substitute for this
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named. Start by reading the BIP-324 handshake description and the linked bip324-mitm PR, then compare the proposed streaming state, FSChaCha20, and ChaCha20Poly1305Stream with the repository; the issue provides no repository acceptance criteria, so completion needs scope agreed first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100