|
|
@ -110,3 +110,26 @@ func TestSessionData(t *testing.T) {
|
|
|
|
t.Fatalf("Parsed message(%s) != test message(%s)", parsed_message, message)
|
|
|
|
t.Fatalf("Parsed message(%s) != test message(%s)", parsed_message, message)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestSessionClose(t *testing.T) {
|
|
|
|
|
|
|
|
_, client_key, err := ed25519.GenerateKey(rand.Reader)
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, server_key, err := ed25519.GenerateKey(rand.Reader)
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client_so, client_ecdh, err := NewSessionOpen(client_key)
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server_so, server_ecdh, err := NewSessionOpen(server_key)
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
server_session, err := ParseSessionOpen(server_ecdh, client_so[COMMAND_LENGTH:])
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client_session, err := ParseSessionOpen(client_ecdh, server_so[COMMAND_LENGTH:])
|
|
|
|
|
|
|
|
fatalErr(t, err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session_close := NewSessionClose(&client_session)
|
|
|
|
|
|
|
|
fatalErr(t, ParseSessionClose(&server_session, session_close[COMMAND_LENGTH+ID_LENGTH:]))
|
|
|
|
|
|
|
|
}
|
|
|
|