X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FDiaspora%2FDiasporaPlugin.php;h=c054d3b767658cfd32cd5629e428569bb402bb62;hb=4211206e3be06baa6c63af8c9fc819db3020d559;hp=1bb7f15ddcedc4c23bcb687888b1e6dbc01f171f;hpb=ed97b88b047a0994fc1102b5f859d94f94e754f9;p=quix0rs-gnu-social.git diff --git a/plugins/Diaspora/DiasporaPlugin.php b/plugins/Diaspora/DiasporaPlugin.php index 1bb7f15ddc..c054d3b767 100644 --- a/plugins/Diaspora/DiasporaPlugin.php +++ b/plugins/Diaspora/DiasporaPlugin.php @@ -79,7 +79,7 @@ class DiasporaPlugin extends Plugin public function onPluginVersion(array &$versions) { $versions[] = array('name' => 'Diaspora', - 'version' => '0.1', + 'version' => '0.2', 'author' => 'Mikael Nordfeldth', 'homepage' => 'https://gnu.io/social', // TRANS: Plugin description. @@ -150,7 +150,7 @@ class DiasporaPlugin extends Plugin * and “outer iv” (using the aes-256-cbc cipher). This encrypted * blob shall be referred to as “the ciphertext”. */ - $ciphertext = $outer_key->encrypt($decrypted_header); + $ciphertext = $outer_key->encrypt($decrypted_header, \phpseclib\Crypt\RSA::PADDING_PKCS1); /** * Construct the following JSON object, which shall be referred to @@ -171,7 +171,7 @@ class DiasporaPlugin extends Plugin common_debug('Diaspora creating "outer aes key bundle", will require magic-public-key'); $key_fetcher = new MagicEnvelope(); $remote_keys = $key_fetcher->getKeyPair($target, true); // actually just gets the public key - $enc_outer = $remote_keys->publicKey->encrypt($outer_bundle); + $enc_outer = $remote_keys->publicKey->encrypt($outer_bundle, \phpseclib\Crypt\RSA::PADDING_PKCS1); /** * Construct the following JSON object, which I shall refer to as @@ -201,7 +201,7 @@ class DiasporaPlugin extends Plugin * chose earlier. * 2. Base64-encode the encrypted payload message. */ - $payload = $inner_key->encrypt($magic_env->getData()); + $payload = $inner_key->encrypt($magic_env->getData(), \phpseclib\Crypt\RSA::PADDING_PKCS1); //FIXME: This means we don't actually put an in the payload, // since Diaspora has its own update method! Silly me. Read up on: // https://wiki.diasporafoundation.org/Federation_Message_Semantics @@ -225,7 +225,12 @@ class DiasporaPlugin extends Plugin public function onSalmonSlap($endpoint_uri, MagicEnvelope $magic_env, Profile $target=null) { - $envxml = $magic_env->toXML($target, 'diaspora'); + try { + $envxml = $magic_env->toXML($target, 'diaspora'); + } catch (Exception $e) { + common_log(LOG_ERR, sprintf('Could not generate Magic Envelope XML (diaspora flavour) for profile id=='.$target->getID().': '.$e->getMessage())); + return false; + } // Diaspora wants another POST format (base64url-encoded POST variable 'xml') $headers = array('Content-Type: application/x-www-form-urlencoded');