Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let rust and node handshake #1

Closed
Frando opened this issue Jan 28, 2020 · 5 comments
Closed

Let rust and node handshake #1

Frando opened this issue Jan 28, 2020 · 5 comments

Comments

@Frando
Copy link
Member

Frando commented Jan 28, 2020

The handshake does not work at the moment. See this issue in datrs/hypercore for a high-level overview.

This issue is only concerned with the handshake. I managed to track down where exactly the handshake fails:

It's always the client (initiator) that crashes. And both in Rust and in Node it happens at the same place. It happens when receiving the S token and then calling into the SymetricState and its DecryptAndHash function. There, the cipher's DecryptWithAd function is called, and this decryption fails.

So - either the input parameters to the decrypt function are different, or the XChaCha20 impls differ.

@Frando
Copy link
Member Author

Frando commented Jan 28, 2020

The README of noise-protocol states the following:

Deviations from the Noise specification

  • Uses libsodiums crypto_kx_* API which hashes the shared secret with the
    client and server public key; BLAKE2b-512(shared || client_pk || server_pk)
  • Uses crypto_aead_xchacha20poly1305_ietf_* for symmetric cryptography with
    nonces 128-bit zero || 64-bit counter, meaning the protocol name is Noise_*_25519_XChaChaPoly_BLAKE2b, with * being the handshake pattern

@Frando
Copy link
Member Author

Frando commented Jan 28, 2020

I hackily replaced the x25519 DH calculation in snow with crypto_kx_* from sodiumoxide and again, it works between rust and rust but not rust and node/noise-protocol. Hm.

@bltavares
Copy link
Member

I'm trying the following, yet I'm not sure what should be the values for Key to initiate the XSalsa20 stream:

master...bltavares:cipher

It compiles, but I didn't even try to run as the keys are dummy values so far.

@Frando
Copy link
Member Author

Frando commented Feb 7, 2020

I managed to get this to work 😅

still not with the released versions, but it works!

@Frando
Copy link
Member Author

Frando commented Feb 11, 2021

This was fixed quite a while ago

@Frando Frando closed this as completed Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants