aboutsummaryrefslogtreecommitdiffstats
path: root/mod/receive.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-30 00:51:59 -0700
committerFriendika <info@friendika.com>2011-07-30 00:51:59 -0700
commit01703f3be6fae07d9fbb24f1b57b8c181cb59df9 (patch)
treea63ec6761fad2d3fb44eb1b5ce1658e7ee6baad3 /mod/receive.php
parenta61ec584d60013f7845d0999deb550a2149f4e76 (diff)
downloadvolse-hubzilla-01703f3be6fae07d9fbb24f1b57b8c181cb59df9.tar.gz
volse-hubzilla-01703f3be6fae07d9fbb24f1b57b8c181cb59df9.tar.bz2
volse-hubzilla-01703f3be6fae07d9fbb24f1b57b8c181cb59df9.zip
get_diaspora_key()
Diffstat (limited to 'mod/receive.php')
-rw-r--r--mod/receive.php40
1 files changed, 31 insertions, 9 deletions
diff --git a/mod/receive.php b/mod/receive.php
index 18f323f42..86d612dc9 100644
--- a/mod/receive.php
+++ b/mod/receive.php
@@ -6,7 +6,7 @@
require_once('include/salmon.php');
-require_once('library/simplepie/simplepie.inc');
+require_once('include/certfns.php');
function receive_return($val) {
@@ -21,6 +21,30 @@ function receive_return($val) {
}
+
+function get_diaspora_key($uri) {
+ $key = '';
+
+ logger('Fetching diaspora key for: ' . $uri);
+
+ $arr = lrdd($uri);
+
+ if(is_array($arr)) {
+ foreach($arr as $a) {
+ if($a['@attributes']['rel'] === 'diaspora-public-key') {
+ $key = base64_decode($a['@attributes']['href']);
+ }
+ }
+ }
+ else {
+ return '';
+ }
+
+ if($key)
+ return rsatopem($key);
+ return '';
+}
+
function receive_post(&$a) {
if($a->argc != 3 || $a->argv[1] !== 'users')
@@ -125,12 +149,12 @@ function receive_post(&$a) {
logger('signature: ' . bin2hex($signature));
- openssl_public_encrypt('test',$rrr,$ryanpubkey);
- logger('rrr: ' . $rrr);
+// openssl_public_encrypt('test',$rrr,$rpubkey);
+// logger('rrr: ' . $rrr);
- $pubdecsig = '';
- openssl_public_decrypt($signature,$pubdecsig,$ryanpubkey);
- logger('decsig: ' . bin2hex($pubdecsig));
+// $pubdecsig = '';
+// openssl_public_decrypt($signature,$pubdecsig,$rpubkey);
+// logger('decsig: ' . bin2hex($pubdecsig));
// unpack the data
@@ -178,9 +202,7 @@ function receive_post(&$a) {
logger('mod-diaspora: Fetching key for ' . $author_link );
// Get diaspora public key (pkcs#1) and convert to pkcs#8
-// $key = get_diaspora_key($author_link);
-
-// $key = get_salmon_key($author_link,$keyhash);
+ $key = get_diaspora_key($author_link);
if(! $key) {
logger('mod-salmon: Could not retrieve author key.');