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 371ebfec1a - Show all commits

View file

@ -181,13 +181,27 @@
* @param string|PeerAddress $requester The requester of the message * @param string|PeerAddress $requester The requester of the message
* @return EncryptionMessageRecipient|null The recipient of the message, or null if the requester is not a participant * @return EncryptionMessageRecipient|null The recipient of the message, or null if the requester is not a participant
*/ */
public function determineRecipient(string|PeerAddress $requester): ?EncryptionMessageRecipient public function determineRecipient(string|PeerAddress $requester, bool $reverse=false): ?EncryptionMessageRecipient
{ {
if($requester instanceof PeerAddress) if($requester instanceof PeerAddress)
{ {
$requester = $requester->getAddress(); $requester = $requester->getAddress();
} }
if($reverse)
{
if($this->callingPeerAddress->getAddress() === $requester)
{
return EncryptionMessageRecipient::SENDER;
}
elseif($this->receivingPeerAddress->getAddress() === $requester)
{
return EncryptionMessageRecipient::RECEIVER;
}
return null;
}
if($this->callingPeerAddress->getAddress() === $requester) if($this->callingPeerAddress->getAddress() === $requester)
{ {
return EncryptionMessageRecipient::RECEIVER; return EncryptionMessageRecipient::RECEIVER;
@ -206,7 +220,7 @@
* @param string|PeerAddress $sender The sender of the message * @param string|PeerAddress $sender The sender of the message
* @return PeerAddress|null The receiver of the message, or null if the sender is not a participant * @return PeerAddress|null The receiver of the message, or null if the sender is not a participant
*/ */
public function determineReceiver(string|PeerAddress $sender): ?PeerAddress public function determineReceiver(string|PeerAddress $sender): ?PeerAddress
{ {
if($sender instanceof PeerAddress) if($sender instanceof PeerAddress)
{ {