get rid of special "short salmon key" for statusnet
This commit is contained in:
parent
71afdf3d9c
commit
3f414aec63
@ -155,7 +155,7 @@ function delivery_run($argv, $argc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
|
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
|
||||||
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
|
`user`.`timezone`, `user`.`nickname`,
|
||||||
`user`.`page-flags`, `user`.`prvnets`
|
`user`.`page-flags`, `user`.`prvnets`
|
||||||
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||||
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
||||||
|
@ -537,7 +537,7 @@ function fetch_xrd_links($url) {
|
|||||||
|
|
||||||
$xrd_timeout = intval(get_config('system','xrd_timeout'));
|
$xrd_timeout = intval(get_config('system','xrd_timeout'));
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 20));
|
$xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 30));
|
||||||
|
|
||||||
logger('fetch_xrd_links: ' . $xml, LOGGER_DATA);
|
logger('fetch_xrd_links: ' . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
@ -547,11 +547,9 @@ function fetch_xrd_links($url) {
|
|||||||
// fix diaspora's bad xml
|
// fix diaspora's bad xml
|
||||||
$xml = str_replace(array('href="','"/>'),array('href="','"/>'),$xml);
|
$xml = str_replace(array('href="','"/>'),array('href="','"/>'),$xml);
|
||||||
|
|
||||||
$h = parse_xml_string($xml);
|
$arr = xml2array($xml);
|
||||||
if(! $h)
|
|
||||||
return array();
|
|
||||||
|
|
||||||
$arr = convert_xml_element_to_array($h);
|
logger('fetch_xrd_links: ' . print_r($arr,true), LOGGER_DATA);
|
||||||
|
|
||||||
$links = array();
|
$links = array();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ function notifier_run($argv, $argc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
|
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
|
||||||
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
|
`user`.`timezone`, `user`.`nickname`,
|
||||||
`user`.`page-flags`, `user`.`prvnets`
|
`user`.`page-flags`, `user`.`prvnets`
|
||||||
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||||
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
|
||||||
|
@ -74,7 +74,7 @@ function slapper($owner,$url,$slap) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if(! $owner['sprvkey']) {
|
if(! $owner['prvkey']) {
|
||||||
logger(sprintf("slapper: user '%s' (%d) does not have a salmon private key. Send failed.",
|
logger(sprintf("slapper: user '%s' (%d) does not have a salmon private key. Send failed.",
|
||||||
$owner['username'],$owner['uid']));
|
$owner['username'],$owner['uid']));
|
||||||
return;
|
return;
|
||||||
@ -103,17 +103,17 @@ EOT;
|
|||||||
$data_type = 'application/atom+xml';
|
$data_type = 'application/atom+xml';
|
||||||
$encoding = 'base64url';
|
$encoding = 'base64url';
|
||||||
$algorithm = 'RSA-SHA256';
|
$algorithm = 'RSA-SHA256';
|
||||||
$keyhash = base64url_encode(hash('sha256',salmon_key($owner['spubkey'])),true);
|
$keyhash = base64url_encode(hash('sha256',salmon_key($owner['pubkey'])),true);
|
||||||
|
|
||||||
// precomputed base64url encoding of data_type, encoding, algorithm concatenated with periods
|
// precomputed base64url encoding of data_type, encoding, algorithm concatenated with periods
|
||||||
|
|
||||||
$precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng==';
|
$precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng==';
|
||||||
|
|
||||||
$signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['sprvkey']));
|
$signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['prvkey']));
|
||||||
|
|
||||||
$signature2 = base64url_encode(rsa_sign($data . $precomputed,$owner['sprvkey']));
|
$signature2 = base64url_encode(rsa_sign($data . $precomputed,$owner['prvkey']));
|
||||||
|
|
||||||
$signature3 = base64url_encode(rsa_sign($data,$owner['sprvkey']));
|
$signature3 = base64url_encode(rsa_sign($data,$owner['prvkey']));
|
||||||
|
|
||||||
$salmon_tpl = get_markup_template('magicsig.tpl');
|
$salmon_tpl = get_markup_template('magicsig.tpl');
|
||||||
|
|
||||||
|
@ -162,24 +162,9 @@ function create_user($arr) {
|
|||||||
$prvkey = $keys['prvkey'];
|
$prvkey = $keys['prvkey'];
|
||||||
$pubkey = $keys['pubkey'];
|
$pubkey = $keys['pubkey'];
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Create another keypair for signing/verifying
|
|
||||||
* salmon protocol messages. We have to use a slightly
|
|
||||||
* less robust key because this won't be using openssl
|
|
||||||
* but the phpseclib. Since it is PHP interpreted code
|
|
||||||
* it is not nearly as efficient, and the larger keys
|
|
||||||
* will take several minutes each to process.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sres = new_keypair(512);
|
|
||||||
$sprvkey = $sres['prvkey'];
|
|
||||||
$spubkey = $sres['pubkey'];
|
|
||||||
|
|
||||||
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
|
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
|
||||||
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` )
|
`pubkey`, `prvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` )
|
||||||
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )",
|
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )",
|
||||||
dbesc(generate_user_guid()),
|
dbesc(generate_user_guid()),
|
||||||
dbesc($username),
|
dbesc($username),
|
||||||
dbesc($new_password_encoded),
|
dbesc($new_password_encoded),
|
||||||
@ -188,8 +173,6 @@ function create_user($arr) {
|
|||||||
dbesc($nickname),
|
dbesc($nickname),
|
||||||
dbesc($pubkey),
|
dbesc($pubkey),
|
||||||
dbesc($prvkey),
|
dbesc($prvkey),
|
||||||
dbesc($spubkey),
|
|
||||||
dbesc($sprvkey),
|
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($verified),
|
intval($verified),
|
||||||
intval($blocked),
|
intval($blocked),
|
||||||
|
@ -8,14 +8,14 @@ function modexp_init(&$a) {
|
|||||||
killme();
|
killme();
|
||||||
|
|
||||||
$nick = $a->argv[1];
|
$nick = $a->argv[1];
|
||||||
$r = q("SELECT `spubkey` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
|
$r = q("SELECT `pubkey` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
|
||||||
dbesc($nick)
|
dbesc($nick)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($r))
|
if(! count($r))
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
$lines = explode("\n",$r[0]['spubkey']);
|
$lines = explode("\n",$r[0]['pubkey']);
|
||||||
unset($lines[0]);
|
unset($lines[0]);
|
||||||
unset($lines[count($lines)]);
|
unset($lines[count($lines)]);
|
||||||
$x = base64_decode(implode('',$lines));
|
$x = base64_decode(implode('',$lines));
|
||||||
|
@ -22,7 +22,7 @@ function xrd_init(&$a) {
|
|||||||
if(! count($r))
|
if(! count($r))
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
$salmon_key = salmon_key($r[0]['spubkey']);
|
$salmon_key = salmon_key($r[0]['pubkey']);
|
||||||
|
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
header("Content-type: text/xml");
|
header("Content-type: text/xml");
|
||||||
|
Reference in New Issue
Block a user