mirror of
https://github.com/friendica/friendica
synced 2025-04-27 13:50:12 +00:00
Move salmonKey to Salmon class
move the salmonKey function from Crypto to Salmon
This commit is contained in:
parent
0131fd5745
commit
db653e4451
4 changed files with 16 additions and 15 deletions
|
@ -106,7 +106,7 @@ class Salmon
|
|||
$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);
|
||||
|
||||
|
@ -200,4 +200,14 @@ class Salmon
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,16 +215,6 @@ class Crypto
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue