aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Zot6
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-02-09 13:50:03 +0000
committerMario <mario@mariovavti.com>2021-02-09 13:50:03 +0000
commitb4693870ba647455e6bd0a3919a544130cee118b (patch)
tree97fe6de09c5ce3b5e6ed247c6a6105008631e79a /Zotlabs/Zot6
parent5aee2f172ecdf58e13dd328c787fd199c48d24c5 (diff)
downloadvolse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.tar.gz
volse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.tar.bz2
volse-hubzilla-b4693870ba647455e6bd0a3919a544130cee118b.zip
port Lib/Crypto from zap
Diffstat (limited to 'Zotlabs/Zot6')
-rw-r--r--Zotlabs/Zot6/Receiver.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php
index a9a7ab0df..6440c5da5 100644
--- a/Zotlabs/Zot6/Receiver.php
+++ b/Zotlabs/Zot6/Receiver.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Zot6;
use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\Libzot;
use Zotlabs\Web\HTTPSig;
@@ -70,7 +71,7 @@ class Receiver {
$this->encrypted = ((array_key_exists('encrypted',$this->data) && intval($this->data['encrypted'])) ? true : false);
if ($this->encrypted && $this->prvkey) {
- $uncrypted = crypto_unencapsulate($this->data,$this->prvkey);
+ $uncrypted = Crypto::unencapsulate($this->data,$this->prvkey);
if ($uncrypted) {
$this->data = json_decode($uncrypted,true);
}
@@ -88,7 +89,7 @@ class Receiver {
if ($this->error) {
// make timing attacks on the decryption engine a bit more difficult
usleep(mt_rand(10000,100000));
- return($this->response);
+ return($this->response);
}
if ($this->data) {
@@ -126,7 +127,7 @@ class Receiver {
$x = Libzot::register_hub($this->sigdata['signer']);
if($x['success']) {
$hub = Libzot::valid_hub($this->sender,$this->site_id);
- }
+ }
if(! $hub) {
$this->response['message'] = 'sender unknown';
return false;
@@ -168,8 +169,8 @@ class Receiver {
}
}
return $result;
- }
-
+ }
+
function Dispatch() {
switch ($this->messagetype) {
@@ -207,13 +208,13 @@ class Receiver {
$this->EncryptResponse();
}
- return($this->response);
+ return($this->response);
}
function EncryptResponse() {
$algorithm = Libzot::best_algorithm($this->hub['site_crypto']);
if ($algorithm) {
- $this->response = crypto_encapsulate(json_encode($this->response),$this->hub['hubloc_sitekey'], $algorithm);
+ $this->response = Crypto::encapsulate(json_encode($this->response),$this->hub['hubloc_sitekey'], $algorithm);
}
}