aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-06-27 13:05:25 +0200
committerMario <mario@mariovavti.com>2019-06-27 13:05:25 +0200
commit49ba3ffee6e53eefe11a03c62ee673398717b167 (patch)
treea0f0b45249487bd471bcf0545dfbb23f7b871623 /Zotlabs/Module
parent5ccef18d4e5b7901f78a11e0124c16e1c484e3bf (diff)
parentcf844cb27c02c3aae636eb1aa1587b1d5e3e81a0 (diff)
downloadvolse-hubzilla-49ba3ffee6e53eefe11a03c62ee673398717b167.tar.gz
volse-hubzilla-49ba3ffee6e53eefe11a03c62ee673398717b167.tar.bz2
volse-hubzilla-49ba3ffee6e53eefe11a03c62ee673398717b167.zip
Merge branch 'httpsig' into 'dev'
http signature consolidation See merge request hubzilla/core!1685
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Cdav.php5
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--Zotlabs/Module/Dav.php9
-rw-r--r--Zotlabs/Module/Getfile.php6
-rw-r--r--Zotlabs/Module/Id.php2
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--Zotlabs/Module/Magic.php7
-rw-r--r--Zotlabs/Module/Owa.php6
-rw-r--r--Zotlabs/Module/Zfinger.php8
-rw-r--r--Zotlabs/Module/Zot_probe.php2
10 files changed, 28 insertions, 21 deletions
diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php
index de639e281..b199019c1 100644
--- a/Zotlabs/Module/Cdav.php
+++ b/Zotlabs/Module/Cdav.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Web\Controller;
+use Zotlabs\Web\HTTPSig;
require_once('include/event.php');
@@ -41,7 +42,7 @@ class Cdav extends Controller {
continue;
}
- $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]);
+ $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]);
if($sigblock) {
$keyId = str_replace('acct:','',$sigblock['keyId']);
if($keyId) {
@@ -64,7 +65,7 @@ class Cdav extends Controller {
continue;
if($record) {
- $verified = \Zotlabs\Web\HTTPSig::verify('',$record['channel']['channel_pubkey']);
+ $verified = HTTPSig::verify('',$record['channel']['channel_pubkey']);
if(! ($verified && $verified['header_signed'] && $verified['header_valid'])) {
$record = null;
}
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 144c2472a..afd82ed2f 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -6,7 +6,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
-use Zotlabs\Zot6\HTTPSig;
+use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Libzot;
require_once('include/items.php');
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php
index 9f64e2fea..866520461 100644
--- a/Zotlabs/Module/Dav.php
+++ b/Zotlabs/Module/Dav.php
@@ -8,8 +8,9 @@
namespace Zotlabs\Module;
-use \Sabre\DAV as SDAV;
-use \Zotlabs\Storage;
+use Sabre\DAV as SDAV;
+use Zotlabs\Storage;
+use Zotlabs\Web\HTTPSig;
require_once('include/attach.php');
require_once('include/auth.php');
@@ -46,7 +47,7 @@ class Dav extends \Zotlabs\Web\Controller {
continue;
}
- $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]);
+ $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]);
if($sigblock) {
$keyId = str_replace('acct:','',$sigblock['keyId']);
if($keyId) {
@@ -69,7 +70,7 @@ class Dav extends \Zotlabs\Web\Controller {
continue;
if($record) {
- $verified = \Zotlabs\Web\HTTPSig::verify('',$record['channel']['channel_pubkey']);
+ $verified = HTTPSig::verify('',$record['channel']['channel_pubkey']);
if(! ($verified && $verified['header_signed'] && $verified['header_valid'])) {
$record = null;
}
diff --git a/Zotlabs/Module/Getfile.php b/Zotlabs/Module/Getfile.php
index 583cf38f0..6d31d23fd 100644
--- a/Zotlabs/Module/Getfile.php
+++ b/Zotlabs/Module/Getfile.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Web\HTTPSig;
+
/**
* module: getfile
*
@@ -46,7 +48,7 @@ class Getfile extends \Zotlabs\Web\Controller {
continue;
}
- $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]);
+ $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]);
if($sigblock) {
$keyId = $sigblock['keyId'];
@@ -57,7 +59,7 @@ class Getfile extends \Zotlabs\Web\Controller {
);
if($r) {
$hubloc = $r[0];
- $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']);
+ $verified = HTTPSig::verify('',$hubloc['xchan_pubkey']);
if($verified && $verified['header_signed'] && $verified['header_valid'] && $hash == $hubloc['hubloc_hash']) {
$header_verified = true;
}
diff --git a/Zotlabs/Module/Id.php b/Zotlabs/Module/Id.php
index 15abfa2a3..e08568d00 100644
--- a/Zotlabs/Module/Id.php
+++ b/Zotlabs/Module/Id.php
@@ -12,7 +12,7 @@ namespace Zotlabs\Module;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\LDSignatures;
-use Zotlabs\Zot6\HTTPSig;
+use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ThreadListener;
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 3eac2b6a0..cb78e4047 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -9,7 +9,7 @@ use Zotlabs\Daemon\Master;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\LDSignatures;
-use Zotlabs\Zot6\HTTPSig;
+use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ThreadListener;
use App;
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php
index e8e960574..6ac656a04 100644
--- a/Zotlabs/Module/Magic.php
+++ b/Zotlabs/Module/Magic.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Web\HTTPSig;
+
@require_once('include/zot.php');
@@ -152,10 +154,9 @@ class Magic extends \Zotlabs\Web\Controller {
$headers['Accept'] = 'application/x-zot+json' ;
$headers['X-Open-Web-Auth'] = random_string();
$headers['Host'] = $parsed['host'];
- $headers['Digest'] = 'SHA-256=' . \Zotlabs\Web\HTTPSig::generate_digest($data,false);
+ $headers['Digest'] = HTTPSig::generate_digest_header($data);
- $headers = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'],
- 'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false,true,'sha512');
+ $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], 'acct:' . channel_reddress($channel),true,'sha512');
$x = z_post_url($basepath . '/owa',$data,$redirects,[ 'headers' => $headers ]);
if($x['success']) {
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php
index cf116a96c..89f83bf8f 100644
--- a/Zotlabs/Module/Owa.php
+++ b/Zotlabs/Module/Owa.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Module;
+use Zotlabs\Web\HTTPSig;
+
/**
* OpenWebAuth verifier and token generator
* See https://macgirvin.com/wiki/mike/OpenWebAuth/Home
@@ -25,7 +27,7 @@ class Owa extends \Zotlabs\Web\Controller {
continue;
}
- $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]);
+ $sigblock = HTTPSig::parse_sigheader($_SERVER[$head]);
if($sigblock) {
$keyId = $sigblock['keyId'];
@@ -65,7 +67,7 @@ class Owa extends \Zotlabs\Web\Controller {
if ($r) {
foreach($r as $hubloc) {
- $verified = \Zotlabs\Web\HTTPSig::verify(file_get_contents('php://input'),$hubloc['xchan_pubkey']);
+ $verified = HTTPSig::verify(file_get_contents('php://input'),$hubloc['xchan_pubkey']);
if($verified && $verified['header_signed'] && $verified['header_valid']) {
logger('OWA header: ' . print_r($verified,true),LOGGER_DATA);
logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA);
diff --git a/Zotlabs/Module/Zfinger.php b/Zotlabs/Module/Zfinger.php
index 6ed001df5..3a20144a5 100644
--- a/Zotlabs/Module/Zfinger.php
+++ b/Zotlabs/Module/Zfinger.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Web\HTTPSig;
class Zfinger extends \Zotlabs\Web\Controller {
@@ -23,10 +24,9 @@ class Zfinger extends \Zotlabs\Web\Controller {
$ret = json_encode($x);
if($chan) {
- $hash = \Zotlabs\Web\HTTPSig::generate_digest($ret,false);
- $headers['Digest'] = 'SHA-256=' . $hash;
- \Zotlabs\Web\HTTPSig::create_sig('',$headers,$chan['channel_prvkey'],
- 'acct:' . $chan['channel_address'] . '@' . \App::get_hostname(),true);
+ $headers['Digest'] = HTTPSig::generate_digest_header($ret);
+ $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],'acct:' . channel_reddress($chan));
+ HTTPSig::set_headers($h);
}
else {
foreach($headers as $k => $v) {
diff --git a/Zotlabs/Module/Zot_probe.php b/Zotlabs/Module/Zot_probe.php
index d0c7e688f..648ed2175 100644
--- a/Zotlabs/Module/Zot_probe.php
+++ b/Zotlabs/Module/Zot_probe.php
@@ -3,7 +3,7 @@
namespace Zotlabs\Module;
use Zotlabs\Lib\Zotfinger;
-use Zotlabs\Zot6\HTTPSig;
+use Zotlabs\Web\HTTPSig;
class Zot_probe extends \Zotlabs\Web\Controller {