Updates
This commit is contained in:
@@ -80,7 +80,7 @@ void ProtocolHandler::handleCommandInitIVExpend(ts::Command &cmd) {
|
||||
|
||||
string error;
|
||||
if(!this->crypt_handler.setupSharedSecret(alpha, beta, &server_key, &this->crypto.identity, error)) {
|
||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption")), true);
|
||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption (I)")), true);
|
||||
this->handle->close_connection();
|
||||
|
||||
log_error(category::connection, tr("Failed to setup crypto ({})"), error);
|
||||
@@ -135,7 +135,7 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
|
||||
auto proof = base64::decode(cmd["proof"]);
|
||||
|
||||
auto crypto_chain_data = base64::decode(cmd["l"]);
|
||||
auto crypto_root = cmd[0].has("root") ? base64::decode(cmd["root"]) : string((char*) license::teamspeak::public_root, 32);
|
||||
auto crypto_root = cmd[0].has("root") ? base64::decode(cmd["root"]) : std::string((char*) license::teamspeak::public_root, 32);
|
||||
auto crypto_hash = digest::sha256(crypto_chain_data);
|
||||
|
||||
/* suspecius, tries the server to hide himself? We dont know */
|
||||
@@ -170,11 +170,17 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(crypto_root.length() != 32) {
|
||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("invalid crypto chain root! (Invalid length)")), true);
|
||||
this->handle->close_connection();
|
||||
return;
|
||||
}
|
||||
|
||||
auto server_public_key = crypto_chain->generatePublicKey(*(license::teamspeak::LicensePublicKey*) crypto_root.data());
|
||||
crypto_chain->print();
|
||||
|
||||
u_char seed[32 * 2]; //FIXME more secure
|
||||
u_char public_key[32], private_key[32];
|
||||
u_char seed[32];
|
||||
u_char public_key[32], private_key[64]; /* private keys are only 32 bits long, but the SHA512 of the seed is 64 bytes! */
|
||||
ed25519_create_keypair(public_key, private_key, seed);
|
||||
|
||||
/* send clientek response */
|
||||
@@ -206,8 +212,9 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
|
||||
}); /* needs to be encrypted at the time! */
|
||||
}
|
||||
|
||||
|
||||
if(!this->crypt_handler.setupSharedSecretNew(string((char*) this->crypto.alpha, 10), beta, (char*) private_key, server_public_key.data())) {
|
||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption")), true);
|
||||
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption (II)")), true);
|
||||
this->handle->close_connection();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user