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 47ebcb71ae - Show all commits

View file

@ -8,12 +8,10 @@
class EncryptionChannelSecret implements SerializableInterface class EncryptionChannelSecret implements SerializableInterface
{ {
private string $channelUuid; private string $channelUuid;
private PeerAddress $receiver; private PeerAddress $recipient;
private string $signatureUuid; private string $localPublicEncryptionKey;
private string $publicEncryptionKey; private string $localPrivateEncryptionKey;
private string $privateEncryptionKey; private ?string $receivingPublicEncryptionKey;
private string $transportEncryptionAlgorithm;
private ?string $transportEncryptionKey;
/** /**
* Public constructor * Public constructor
@ -22,19 +20,17 @@
*/ */
public function __construct(array $data) public function __construct(array $data)
{ {
$this->channelUuid = $data['uuid']; $this->channelUuid = $data['channel_uuid'];
$this->receiver = PeerAddress::fromAddress($data['receiver']); $this->recipient = PeerAddress::fromAddress($data['recipient']);
$this->signatureUuid = $data['signature_uuid']; $this->localPublicEncryptionKey = $data['local_public_encryption_key'];
$this->publicEncryptionKey = $data['public_encryption_key']; $this->localPrivateEncryptionKey = $data['local_private_encryption_key'];
$this->privateEncryptionKey = $data['private_encryption_key']; $this->receivingPublicEncryptionKey = $data['receiving_public_encryption_key'] ?? null;
$this->transportEncryptionAlgorithm = $data['transport_encryption_algorithm'];
$this->transportEncryptionKey = $data['transport_encryption_key'] ?? null;
} }
/** /**
* Returns the UUID of the key pair * Returns the channel UUID
* *
* @return string The UUID of the key pair * @return string
*/ */
public function getChannelUuid(): string public function getChannelUuid(): string
{ {
@ -42,65 +38,53 @@
} }
/** /**
* Returns the receiver
*
* @return PeerAddress * @return PeerAddress
*/ */
public function getReceiver(): PeerAddress public function getRecipient(): PeerAddress
{ {
return $this->receiver; return $this->recipient;
} }
/** /**
* Returns the UUID of the signature * Returns the calling public encryption key
* *
* @return string The UUID of the signature
*/
public function getSignatureUuid(): string
{
return $this->signatureUuid;
}
/**
* Returns the public key of the key pair
*
* @return string The public key of the key pair
*/
public function getPublicEncryptionKey(): string
{
return $this->publicEncryptionKey;
}
/**
* Returns the private key of the key pair
*
* @return string The private key of the key pair
*/
public function getPrivateEncryptionKey(): string
{
return $this->privateEncryptionKey;
}
/**
* @return string * @return string
*/ */
public function getTransportEncryptionAlgorithm(): string public function getLocalPublicEncryptionKey(): string
{ {
return $this->transportEncryptionAlgorithm; return $this->localPublicEncryptionKey;
} }
/** /**
* Returns the calling private encryption key
*
* @return string
*/
public function getLocalPrivateEncryptionKey(): string
{
return $this->localPrivateEncryptionKey;
}
/**
* Returns the receiving public encryption key
*
* @return string|null * @return string|null
*/ */
public function getTransportEncryptionKey(): ?string public function getReceivingPublicEncryptionKey(): ?string
{ {
return $this->transportEncryptionKey; return $this->receivingPublicEncryptionKey;
} }
/** /**
* @param string|null $transportEncryptionKey * Sets the receiving public encryption key
*
* @param string $receivingPublicEncryptionKey The receiving public encryption key
*/ */
public function setTransportEncryptionKey(?string $transportEncryptionKey): void public function setReceivingPublicEncryptionKey(string $receivingPublicEncryptionKey): void
{ {
$this->transportEncryptionKey = $transportEncryptionKey; $this->receivingPublicEncryptionKey = $receivingPublicEncryptionKey;
} }
/** /**
@ -117,13 +101,11 @@
public function toArray(): array public function toArray(): array
{ {
return [ return [
'uuid' => $this->channelUuid, 'channel_uuid' => $this->channelUuid,
'receiver' => $this->receiver->getAddress(), 'recipient' => $this->recipient->getAddress(),
'signature_uuid' => $this->signatureUuid, 'local_public_encryption_key' => $this->localPublicEncryptionKey,
'public_key' => $this->publicEncryptionKey, 'local_private_encryption_key' => $this->localPrivateEncryptionKey,
'private_key' => $this->privateEncryptionKey, 'receiving_public_encryption_key' => $this->receivingPublicEncryptionKey
'transport_encryption_algorithm' => $this->transportEncryptionAlgorithm,
'transport_encryption_key' => $this->transportEncryptionKey
]; ];
} }
} }