You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use TransportState::get_remote_static to get the remote end static public key to verify the identity of the remote peer in both ends. I call this right after the handshake is done, on the object returned by HandshakeState::into_transport_mode.
Here's a small program that does the handshake and sends some data from a tcp client stream to a tcp server stream, based on the example in the repo, but it also calls get_remote_static and prints everything from every step to stdout for debugging.
All static keys are hardcoded at the top of the program. https://gist.github.com/hMihaiDavid/dd2c58378b64b6ae9062cd1a743fe618
I've put some comments with the log of 2 runs, one with .remote_public_key(...) in the builder chain and one without it. It uses an XX noise pattern. The logs are the same.
The output of get_remote_static does not coincide with the peer's static public key.
Same output without .remote_public_key(...) in the builder chain.
Am I using this wrong? What should I expect from that api?
Also, as you can see, the Client (initiator), gets its static private key as the output of TransportState::get_remote_static.
Thanks in advance, have a nice day.
The text was updated successfully, but these errors were encountered:
Ok so right after writing this I just realised that my key gen code (at the bottom of the sample) used the pattern Noise_XXpsk3_25519_ChaChaPoly_BLAKE2s whereas the client and server use Noise_XX_25519_ChaChaPoly_BLAKE2s. When regenerating the static keys with the proper pattern the outputs of get_remote_static are as expected -- the pubkey of the other peer.
I've been stuck for days lol.
So I guess that problem solved, but why that weird behavior tho? Why did the client get its private key when calling get_remote_static?
hMihaiDavid
changed the title
Help understanding output of TransportState::get_remote_static
Weird output of TransportState::get_remote_static
Dec 8, 2022
Hello,
I'm trying to use
TransportState::get_remote_static
to get the remote end static public key to verify the identity of the remote peer in both ends. I call this right after the handshake is done, on the object returned byHandshakeState::into_transport_mode
.Here's a small program that does the handshake and sends some data from a tcp client stream to a tcp server stream, based on the example in the repo, but it also calls
get_remote_static
and prints everything from every step to stdout for debugging.All static keys are hardcoded at the top of the program.
https://gist.github.com/hMihaiDavid/dd2c58378b64b6ae9062cd1a743fe618
I've put some comments with the log of 2 runs, one with
.remote_public_key(...)
in the builder chain and one without it. It uses anXX
noise pattern. The logs are the same.The output of
get_remote_static
does not coincide with the peer's static public key.Whereas the output of
get_remote_static
is:Same output without
.remote_public_key(...)
in the builder chain.Am I using this wrong? What should I expect from that api?
Also, as you can see, the Client (initiator), gets its static private key as the output of
TransportState::get_remote_static
.Thanks in advance, have a nice day.
The text was updated successfully, but these errors were encountered: