use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
+use Friendica\Protocol\Salmon;
use Friendica\Util\Crypto;
function hostxrd_init(App $a)
'$zhost' => $a->get_hostname(),
'$zroot' => System::baseUrl(),
'$domain' => System::baseUrl(),
- '$bigkey' => Crypto::salmonKey(Config::get('system', 'site_pubkey')))
+ '$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey')))
);
exit();
use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBM;
-use Friendica\Util\Crypto;
+use Friendica\Protocol\Salmon;
function xrd_init(App $a)
{
function xrd_json($a, $uri, $alias, $profile_url, $r)
{
- $salmon_key = Crypto::salmonKey($r['spubkey']);
+ $salmon_key = Salmon::salmonKey($r['spubkey']);
header('Access-Control-Allow-Origin: *');
header("Content-type: application/json; charset=utf-8");
function xrd_xml($a, $uri, $alias, $profile_url, $r)
{
- $salmon_key = Crypto::salmonKey($r['spubkey']);
+ $salmon_key = Salmon::salmonKey($r['spubkey']);
header('Access-Control-Allow-Origin: *');
header("Content-type: text/xml");
$data_type = 'application/atom+xml';
$encoding = 'base64url';
$algorithm = 'RSA-SHA256';
- $keyhash = base64url_encode(hash('sha256', Crypto::salmonKey($owner['spubkey'])), true);
+ $keyhash = base64url_encode(hash('sha256', self::salmonKey($owner['spubkey'])), true);
$precomputed = '.' . base64url_encode($data_type) . '.' . base64url_encode($encoding) . '.' . base64url_encode($algorithm);
return (($return_code >= 200) && ($return_code < 300)) ? 0 : 1;
}
+
+ /**
+ * @param string $pubkey public key
+ * @return string
+ */
+ public static function salmonKey($pubkey)
+ {
+ self::pemToMe($pubkey, $m, $e);
+ return 'RSA' . '.' . base64url_encode($m, true) . '.' . base64url_encode($e, true);
+ }
}
return $key;
}
- /**
- * @param string $pubkey public key
- * @return string
- */
- public static function salmonKey($pubkey)
- {
- self::pemToMe($pubkey, $m, $e);
- return 'RSA' . '.' . base64url_encode($m, true) . '.' . base64url_encode($e, true);
- }
-
/**
* @param integer $bits number of bits
* @return mixed