Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
2 changed files with 25 additions and 17 deletions
Showing only changes of commit edf6677256 - Show all commits

View file

@ -494,7 +494,7 @@
{ {
return (bool)$this->sendRequest( return (bool)$this->sendRequest(
new RpcRequest(StandardMethods::SETTINGS_SET_DISPLAY_NAME->value, Utilities::randomCrc32(), [ new RpcRequest(StandardMethods::SETTINGS_SET_DISPLAY_NAME->value, Utilities::randomCrc32(), [
'display_name' => $displayName 'name' => $displayName
]) ])
)->getResponse()->getResult(); )->getResponse()->getResult();
} }

View file

@ -56,27 +56,35 @@
// Handle the request type, only `init` and `dhe` are not encrypted using the session's encrypted key // Handle the request type, only `init` and `dhe` are not encrypted using the session's encrypted key
// RPC Requests must be encrypted and signed by the client, vice versa for server responses. // RPC Requests must be encrypted and signed by the client, vice versa for server responses.
switch($clientRequest->getRequestType()) try
{ {
case RequestType::INFO: switch($clientRequest->getRequestType())
self::handleInformationRequest(); {
break; case RequestType::INFO:
self::handleInformationRequest();
break;
case RequestType::INITIATE_SESSION: case RequestType::INITIATE_SESSION:
self::handleInitiateSession($clientRequest); self::handleInitiateSession($clientRequest);
break; break;
case RequestType::DHE_EXCHANGE: case RequestType::DHE_EXCHANGE:
self::handleDheExchange($clientRequest); self::handleDheExchange($clientRequest);
break; break;
case RequestType::RPC: case RequestType::RPC:
self::handleRpc($clientRequest); self::handleRpc($clientRequest);
break; break;
default: default:
self::returnError(400, StandardError::BAD_REQUEST, 'Invalid Request-Type header'); self::returnError(400, StandardError::BAD_REQUEST, 'Invalid Request-Type header');
}
} }
catch(Exception $e)
{
self::returnError(500, StandardError::INTERNAL_SERVER_ERROR, 'An internal error occurred while processing the request', $e);
}
} }
/** /**
@ -607,7 +615,7 @@
privateKey: Configuration::getCryptographyConfiguration()->getHostPrivateKey() privateKey: Configuration::getCryptographyConfiguration()->getHostPrivateKey()
); );
} }
catch (Exceptions\CryptographyException $e) catch (Exception $e)
{ {
self::returnError(500, StandardError::INTERNAL_SERVER_ERROR, 'Failed to encrypt the server response', $e); self::returnError(500, StandardError::INTERNAL_SERVER_ERROR, 'Failed to encrypt the server response', $e);
return; return;