crypto: switch to Keyutils - please review

This commit is contained in:
zotlabs 2018-12-14 12:46:03 -08:00
parent 957950b8fb
commit e47bc21034
4 changed files with 6 additions and 6 deletions

View file

@ -1325,7 +1325,7 @@ class Activity {
if($person_obj['id'] === $person_obj['publicKey']['owner']) {
$pubkey = $person_obj['publicKey']['publicKeyPem'];
if(strstr($pubkey,'RSA ')) {
$pubkey = rsatopem($pubkey);
$pubkey = Keyutils::rsatopem($pubkey);
}
}
}

View file

@ -170,14 +170,12 @@ class Inbox extends Controller {
if($AS->obj & ActivityStreams::is_an_actor($AS->obj['type'])) {
// do follow activity
Activity::follow($channel,$AS);
continue;
}
break;
case 'Accept':
if($AS->obj & $AS->obj['type'] === 'Follow') {
// do follow activity
Activity::follow($channel,$AS);
continue;
}
break;

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Webfinger;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\Keyutils;
/**
* @brief Implements HTTP Signatures per draft-cavage-http-signatures-10.
@ -217,10 +218,10 @@ class HTTPSig {
function convertKey($key) {
if(strstr($key,'RSA ')) {
return rsatopem($key);
return Keyutils::rsatopem($key);
}
elseif(substr($key,0,5) === 'data:') {
return convert_salmon_key($key);
return Keyutils::convert_salmon_key($key);
}
else {
return $key;

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityPub;
use Zotlabs\Lib\Queue;
use Zotlabs\Lib\System;
use Zotlabs\Lib\Keyutils;
use Zotlabs\Daemon\Master;
/**
@ -2164,7 +2165,7 @@ function get_webfinger_key($id) {
if($x && array_key_exists('properties',$x) && array_key_exists('https://w3id.org/security/v1#publicKeyPem',$x['properties'])) {
$key = $x['properties']['https://w3id.org/security/v1#publicKeyPem'];
if(strstr($key,'RSA ')) {
$key = rsatopem($key);
$key = Keyutils::rsatopem($key);
}
return $key;
}