The key_id was added

This commit is contained in:
Michael Vogel 2016-06-30 00:22:42 +02:00
parent 2d72e2d932
commit c0669d365b
1 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,9 @@
/* /*
This file is part of the Diaspora protocol. It is used for fetching single public posts. This file is part of the Diaspora protocol. It is used for fetching single public posts.
*/ */
require_once("include/crypto.php");
require_once("include/diaspora.php"); require_once("include/diaspora.php");
require_once("include/xml.php");
function fetch_init($a){ function fetch_init($a){
@ -51,7 +53,7 @@ function fetch_init($a){
$data = array("XML" => array("post" => array($nodename => $post))); $data = array("XML" => array("post" => array($nodename => $post)));
$xml = xml::from_array($data, $xmlobj); $xml = xml::from_array($data, $xmlobj);
$r = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d", intval($item[0]["uid"])); $r = q("SELECT `guid`, `prvkey` FROM `user` WHERE `uid` = %d", intval($item[0]["uid"]));
if (!$r) { if (!$r) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
killme(); killme();
@ -59,11 +61,10 @@ function fetch_init($a){
$user = $r[0]; $user = $r[0];
$key_id = "";
$b64url_data = base64url_encode($xml); $b64url_data = base64url_encode($xml);
$data = str_replace(array("\n", "\r", " ", "\t"), array("", "", "", ""), $b64url_data); $data = str_replace(array("\n", "\r", " ", "\t"), array("", "", "", ""), $b64url_data);
$key_id = base64url_encode($user["guid"]);
$type = "application/xml"; $type = "application/xml";
$encoding = "base64url"; $encoding = "base64url";
$alg = "RSA-SHA256"; $alg = "RSA-SHA256";