- logger('mod-salmon: key details: ' . print_r($key_info,true));
-
- $rsa = new CRYPT_RSA();
- $rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1;
- $rsa->setHash('sha256');
-
- $rsa->modulus = new Math_BigInteger($m, 256);
- $rsa->k = strlen($rsa->modulus->toBytes());
- $rsa->exponent = new Math_BigInteger($e, 256);
-
- $verify = $rsa->verify($signed_data,$signature);
-
- if(! $verify) {
- logger('mod-diaspora: Message did not verify. Discarding.');
- receive_return(400);
- }
-
- logger('mod-diaspora: Message verified.');
-
- /* decrypt the sucker */
- /*
- // TODO
- */
-
- /*
- *
- * If we reached this point, the message is good. Now let's figure out if the author is allowed to send us stuff.
- *
- */
-
- $r = q("SELECT * FROM `contact` WHERE `network` = 'dspr' AND ( `url` = '%s' OR `alias` = '%s')
- AND `uid` = %d LIMIT 1",
- dbesc($author_link),
- dbesc($author_link),
- intval($importer['uid'])
- );
- if(! count($r)) {
- logger('mod-diaspora: Author unknown to us.');
- }
-
- // is this a follower? Or have we ignored the person?
- // If so we can not accept this post.
-
- if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == REL_VIP) || ($r[0]['blocked']))) {
- logger('mod-diaspora: Ignoring this author.');
- receive_return(202);
- // NOTREACHED
- }
-
- require_once('include/items.php');