diff options
author | Siebrand Mazeland <s.mazeland@xs4all.nl> | 2010-09-03 01:35:04 +0200 |
---|---|---|
committer | Siebrand Mazeland <s.mazeland@xs4all.nl> | 2010-09-03 01:35:04 +0200 |
commit | 1bfbe9badfbe3e79f82e7216d1401f05a2750677 (patch) | |
tree | bba78cb3dc884c27558c005e101da196afbc1245 /plugins/OStatus/lib/magicenvelope.php | |
parent | e365e709c5bab7d593ee1cde26c8bcfdddcc6780 (diff) |
* i18n/L10n updates and FIXMEs added
* whitespace fixes
Diffstat (limited to 'plugins/OStatus/lib/magicenvelope.php')
-rw-r--r-- | plugins/OStatus/lib/magicenvelope.php | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/plugins/OStatus/lib/magicenvelope.php b/plugins/OStatus/lib/magicenvelope.php index 967e5f6d1..bbd4ce17a 100644 --- a/plugins/OStatus/lib/magicenvelope.php +++ b/plugins/OStatus/lib/magicenvelope.php @@ -32,7 +32,7 @@ class MagicEnvelope const ENCODING = 'base64url'; const NS = 'http://salmon-protocol.org/ns/magic-env'; - + private function normalizeUser($user_id) { if (substr($user_id, 0, 5) == 'http:' || @@ -70,13 +70,13 @@ class MagicEnvelope $keypair = $parts[1]; } } - + if ($keypair) { return $keypair; } } } - throw new Exception('Unable to locate signer public key'); + throw new Exception('Unable to locate signer public key.'); } @@ -92,8 +92,7 @@ class MagicEnvelope 'sig' => $signature_alg->sign($armored_text), 'alg' => $signature_alg->getName() ); - - + } public function toXML($env) { @@ -105,13 +104,13 @@ class MagicEnvelope $xs->element('me:alg', null, $env['alg']); $xs->element('me:sig', null, $env['sig']); $xs->elementEnd('me:env'); - + $string = $xs->getString(); common_debug($string); return $string; } - + public function unfold($env) { $dom = new DOMDocument(); @@ -137,7 +136,7 @@ class MagicEnvelope return $dom->saveXML(); } - + public function getAuthor($text) { $doc = new DOMDocument(); if (!$doc->loadXML($text)) { @@ -154,12 +153,12 @@ class MagicEnvelope } } } - + public function checkAuthor($text, $signer_uri) { return ($this->getAuthor($text) == $signer_uri); } - + public function verify($env) { if ($env['alg'] != 'RSA-SHA256') { @@ -181,14 +180,14 @@ class MagicEnvelope common_log(LOG_DEBUG, "Salmon error: ".$e->getMessage()); return false; } - + $verifier = Magicsig::fromString($keypair); if (!$verifier) { common_log(LOG_DEBUG, "Salmon error: unable to parse keypair"); return false; } - + return $verifier->verify($env['data'], $env['sig']); } |