From 591349ee7493ad09690900ecd0274ab02809c009 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 20 Mar 2022 08:58:18 +0000 Subject: add the signing algo to zotinfo, and store it in import_xchan() if present --- Zotlabs/Lib/Crypto.php | 4 ++++ Zotlabs/Lib/Libzot.php | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Crypto.php b/Zotlabs/Lib/Crypto.php index f1794ae64..188c6bd81 100644 --- a/Zotlabs/Lib/Crypto.php +++ b/Zotlabs/Lib/Crypto.php @@ -87,6 +87,10 @@ class Crypto { return false; } + if (!$alg) { + $alg = 'sha256'; + } + try { $verify = openssl_verify($data, $sig, $key, $alg); } catch (Exception $e) { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 40422a7d8..3003aa516 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -676,6 +676,10 @@ class Libzot { logger('import_xchan: ' . $xchan_hash, LOGGER_DEBUG); + if (isset($arr['signing_algorithm']) && $arr['signing_algorithm']) { + set_xconfig($xchan_hash, 'system', 'signing_algorithm', $arr['signing_algorithm']); + } + $r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($xchan_hash) ); @@ -2877,6 +2881,7 @@ class Libzot { ]; $ret['public_key'] = $e['xchan_pubkey']; + $ret['signing_algorithm'] = 'rsa-sha256'; $ret['username'] = $e['channel_address']; $ret['name'] = $e['xchan_name']; $ret['name_updated'] = $e['xchan_name_date']; -- cgit v1.2.3