diff options
Diffstat (limited to 'test/conn_test.exs')
-rw-r--r-- | test/conn_test.exs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/conn_test.exs b/test/conn_test.exs index 48c92f8..a8cda43 100644 --- a/test/conn_test.exs +++ b/test/conn_test.exs @@ -15,11 +15,10 @@ defmodule ShardTest.Conn do {:ok, challenge} = Salty.Random.buf 32 {:ok, socket} = :gen_tcp.connect {127,0,0,1}, 4044, [:binary, packet: 2, active: false] - :gen_tcp.send(socket, srv_pkey <> sess_pkey <> challenge) + hello = {srv_pkey, sess_pkey, challenge, 0} + :gen_tcp.send(socket, :erlang.term_to_binary hello) {:ok, pkt} = :gen_tcp.recv(socket, 0) - cli_pkey = binary_part(pkt, 0, Sign.publickeybytes) - cli_sess_pkey = binary_part(pkt, Sign.publickeybytes, Box.publickeybytes) - cli_challenge = binary_part(pkt, Sign.publickeybytes + Box.publickeybytes, 32) + {cli_pkey, cli_sess_pkey, cli_challenge, _his_port} = :erlang.binary_to_term(pkt, [:safe]) {:ok, cli_challenge_sign} = Sign.sign_detached(cli_challenge, srv_skey) sendmsg(socket, cli_challenge_sign, cli_sess_pkey, sess_skey) |