throw new ServerException(sprintf('No public key found for profile (id==%d)', $profile->id));
}
- assert($magicsig->publicKey instanceof Crypt_RSA);
+ assert($magicsig->publicKey instanceof \phpseclib\Crypt\RSA);
return $magicsig;
}
* you'll only get the public key ;)
*
* The string will (hopefully) be formatted as described in Magicsig specification:
- * https://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-01.html#anchor13
+ * https://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-magicsig-01.html
*
* @return string formatted as Magicsig keypair
*/
}
if ($keypair === false) {
- // For debugging clarity. Keypair did not pass count()-check above.
+ // For debugging clarity. Keypair did not pass count()-check above.
// TRANS: Exception when public key was not properly formatted.
throw new Exception(_m('Incorrectly formatted public key element.'));
}
$magicsig = Magicsig::generate($this->actor->getUser());
}
assert($magicsig instanceof Magicsig);
- assert($magicsig->privateKey instanceof Crypt_RSA);
+ assert($magicsig->privateKey instanceof \phpseclib\Crypt\RSA);
// Prepare text and metadata for signing
$this->data = Magicsig::base64_url_encode($text);
{
$dom = new DOMDocument();
if (!$dom->loadXML(Magicsig::base64_url_decode($this->data))) {
- throw new ServerException('Malformed XML in Salmon payload');
+ throw new ClientException('Malformed XML in Salmon payload');
}
switch ($this->data_type) {
$prov->appendChild($alg);
$sig = $dom->createElementNS(self::NS, 'me:sig', $this->getSignature());
$prov->appendChild($sig);
-
+
$dom->documentElement->appendChild($prov);
break;
default:
- throw new ServerException('Unknown Salmon payload data type');
+ throw new ClientException('Unknown Salmon payload data type');
}
return $dom;
}
try {
$magicsig = $this->getKeyPair($profile, true); // Do discovery too if necessary
} catch (Exception $e) {
- common_log(LOG_DEBUG, "Salmon error: getKeyPair for profile id=='.$profile->getID().': ".$e->getMessage());
+ common_log(LOG_DEBUG, "Salmon error: getKeyPair for profile id=={$profile->getID()}: "._ve($e->getMessage()));
return false;
}