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

Closed
netkas wants to merge 421 commits from master into dev
Showing only changes of commit 1723983072 - Show all commits

View file

@ -2,6 +2,8 @@
namespace Socialbox\Objects\Client;
use Socialbox\Classes\Cryptography;
use Socialbox\Exceptions\CryptographyException;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Objects\PeerAddress;
@ -87,6 +89,22 @@
$this->receivingPublicEncryptionKey = $receivingPublicEncryptionKey;
}
/**
* Preform a Diffie-Hellman Exchange to get the shared secret between the two peers
*
* @return string The shared secret
* @throws CryptographyException If the receiving public encryption key is not set
*/
public function getSharedSecret(): string
{
if($this->receivingPublicEncryptionKey === null)
{
throw new CryptographyException('The receiving public encryption key is not set');
}
return Cryptography::performDHE($this->receivingPublicEncryptionKey, $this->localPrivateEncryptionKey);
}
/**
* @inheritDoc
*/