aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Zot6/Receiver.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-10-26 21:56:32 +0000
committerMario <mario@mariovavti.com>2022-10-26 21:56:32 +0000
commit95f6f9e10aca66c30a1ef7ac6ed24fd6e352007d (patch)
tree582116e7571ae7eaa4a51578b2f5ebeae31f75a9 /Zotlabs/Zot6/Receiver.php
parentef2448e17e742e7dcef458993bce1e0a29756aa7 (diff)
parent9554f535199b5fb3a23dd40f9921a15339da3bd7 (diff)
downloadvolse-hubzilla-95f6f9e10aca66c30a1ef7ac6ed24fd6e352007d.tar.gz
volse-hubzilla-95f6f9e10aca66c30a1ef7ac6ed24fd6e352007d.tar.bz2
volse-hubzilla-95f6f9e10aca66c30a1ef7ac6ed24fd6e352007d.zip
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Zot6/Receiver.php')
-rw-r--r--Zotlabs/Zot6/Receiver.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php
index 964c61651..b276cbe31 100644
--- a/Zotlabs/Zot6/Receiver.php
+++ b/Zotlabs/Zot6/Receiver.php
@@ -34,6 +34,7 @@ class Receiver {
$this->rawdata = null;
$this->site_id = null;
$this->prvkey = Config::get('system','prvkey');
+ $this->hub = null;
if($localdata) {
$this->rawdata = $localdata;
@@ -71,12 +72,16 @@ class Receiver {
if ($this->encrypted && $this->prvkey) {
$uncrypted = Crypto::unencapsulate($this->data,$this->prvkey);
- if ($uncrypted) {
+
+ // openssl_decrypt() will sometimes return garbage instead of false when
+ // a wrong key is used. This can happen in case of hub re-installs.
+ // Hence also check with str_starts_with().
+ if ($uncrypted && str_starts_with($uncrypted, '{')) {
$this->data = json_decode($uncrypted,true);
}
else {
$this->error = true;
- $this->response['message'] = 'no data';
+ $this->response['message'] = 'no data (decryption failed)';
}
}
}