aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-12-21 21:31:52 +0000
committerMario <mario@mariovavti.com>2020-12-21 21:31:52 +0000
commit81a1aedeb9a4e07c3d1e11905ad3e2434d635e86 (patch)
tree79987c5dbf9878447047c6c563f4726e8c2a5311 /Zotlabs/Web
parent638f7a1c89b84e304a2900a3c70fae2c8b0a18b7 (diff)
downloadvolse-hubzilla-81a1aedeb9a4e07c3d1e11905ad3e2434d635e86.tar.gz
volse-hubzilla-81a1aedeb9a4e07c3d1e11905ad3e2434d635e86.tar.bz2
volse-hubzilla-81a1aedeb9a4e07c3d1e11905ad3e2434d635e86.zip
fix issue where an array was passed to get_key() instead of a string
Diffstat (limited to 'Zotlabs/Web')
-rw-r--r--Zotlabs/Web/HTTPSig.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 792556a10..1f6979191 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -151,13 +151,13 @@ class HTTPSig {
$result['signer'] = $sig_block['keyId'];
- $key = self::get_key($key,$keytype,$result['signer']);
+ $cached_key = self::get_key($key,$keytype,$result['signer']);
- if(! ($key && $key['public_key'])) {
+ if(! ($cached_key && $cached_key['public_key'])) {
return $result;
}
- $x = rsa_verify($signed_data,$sig_block['signature'],$key['public_key'],$algorithm);
+ $x = rsa_verify($signed_data,$sig_block['signature'],$cached_key['public_key'],$algorithm);
logger('verified: ' . $x, LOGGER_DEBUG);
@@ -166,15 +166,15 @@ class HTTPSig {
// try again, ignoring the local actor (xchan) cache and refetching the key
// from its source
- $fkey = self::get_key($key,$keytype,$result['signer'],true);
+ $fetched_key = self::get_key($key,$keytype,$result['signer'],true);
- if ($fkey && $fkey['public_key']) {
- $y = rsa_verify($signed_data,$sig_block['signature'],$fkey['public_key'],$algorithm);
+ if ($fetched_key && $fetched_key['public_key']) {
+ $y = rsa_verify($signed_data,$sig_block['signature'],$fetched_key['public_key'],$algorithm);
logger('verified: (cache reload) ' . $x, LOGGER_DEBUG);
}
if (! $y) {
- logger('verify failed for ' . $result['signer'] . ' alg=' . $algorithm . (($fkey['public_key']) ? '' : ' no key'));
+ logger('verify failed for ' . $result['signer'] . ' alg=' . $algorithm . (($fetched_key['public_key']) ? '' : ' no key'));
$sig_block['signature'] = base64_encode($sig_block['signature']);
logger('affected sigblock: ' . print_r($sig_block,true));
logger('headers: ' . print_r($headers,true));
@@ -184,6 +184,8 @@ class HTTPSig {
}
+ $key = (($fetched_key) ? $fetched_key : $cached_key);
+
$result['portable_id'] = $key['portable_id'];
$result['header_valid'] = true;
@@ -244,7 +246,7 @@ class HTTPSig {
function convertKey($key) {
- if(strstr($key,'RSA ')) {
+ if(strstr($key,'RSA ')) {
return rsatopem($key);
}
elseif(substr($key,0,5) === 'data:') {
@@ -453,7 +455,7 @@ class HTTPSig {
foreach($headers as $h) {
header($h);
}
- }
+ }
}