diff options
author | Mario Vavti <mario@mariovavti.com> | 2022-10-14 17:13:23 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2022-10-14 17:13:23 +0200 |
commit | 4547a9d9d3e40330750729be3b1c302e6c7456c9 (patch) | |
tree | 79ad61f2f00cbbe9a4547c4bdc5f82cdcf3e15b6 | |
parent | 71accb6b0a2aa5e3c77f7ef73d685639d0c6526a (diff) | |
download | volse-hubzilla-4547a9d9d3e40330750729be3b1c302e6c7456c9.tar.gz volse-hubzilla-4547a9d9d3e40330750729be3b1c302e6c7456c9.tar.bz2 volse-hubzilla-4547a9d9d3e40330750729be3b1c302e6c7456c9.zip |
catch decryption failure edgecase
-rw-r--r-- | Zotlabs/Zot6/Receiver.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Zotlabs/Zot6/Receiver.php b/Zotlabs/Zot6/Receiver.php index b9a89262a..78661865e 100644 --- a/Zotlabs/Zot6/Receiver.php +++ b/Zotlabs/Zot6/Receiver.php @@ -72,7 +72,11 @@ 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 { |