diff options
Diffstat (limited to 'client/cmixclient.cpp')
| -rw-r--r-- | client/cmixclient.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/client/cmixclient.cpp b/client/cmixclient.cpp index 9ee1d81..cc743db 100644 --- a/client/cmixclient.cpp +++ b/client/cmixclient.cpp @@ -18,7 +18,16 @@ void CMixClient::key_exchange(int i) { ke.set_public_key(buffer, len); free(buffer); - + + data.at(i).secret_value = api.get_group_element(true); + void* shared_value = api.get_key_exchange_value(data.at(i).secret_value); + + api.get_key_array(&buffer, &len, shared_value); + + ke.set_value(buffer, len); + + free(buffer); + network_connections.at(i).async_send(ke); network_connections.at(i).async_receive([i, this](cmix_proto::CMixMessage message) { handle_message(i, message); @@ -48,7 +57,7 @@ void CMixClient::initialize_connections() { void CMixClient::handle_key_exchange(int node_id, cmix_proto::KeyExchange const& ke) { - data.at(node_id).shared_value = api.derive_shared_key(keypair, reinterpret_cast<uint8_t const*>(ke.public_key().c_str()), false); + data.at(node_id).shared_value = api.derive_shared_key(keypair, reinterpret_cast<uint8_t const*>(ke.public_key().c_str()), ke.public_key().size(), reinterpret_cast<uint8_t const*>(ke.value().c_str()), ke.value().size(), data.at(node_id).secret_value, false); cmix_proto::Bye bye; network_connections.at(node_id).async_send(bye); @@ -104,8 +113,9 @@ CMixClient::~CMixClient() api.free_key_pair(&keypair); for(auto&& d : data) { api.free_shared_key(&d.shared_value); + api.free_group_element(d.secret_value); } - + api.deinitialize(); } void CMixClient::run() { |
