]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Catch a previously uncaught exception and add some additional debug logs for signatur...
authorJames Walker <walkah@walkah.net>
Thu, 4 Mar 2010 06:46:34 +0000 (01:46 -0500)
committerJames Walker <walkah@walkah.net>
Thu, 4 Mar 2010 06:46:34 +0000 (01:46 -0500)
plugins/OStatus/lib/magicenvelope.php

index 230d81ba1f0cf02cce340ad7284711e355c6ee80..fb8c57c7183e6340c0ad7c404f5484e91c1e37b7 100644 (file)
@@ -156,18 +156,32 @@ class MagicEnvelope
     public function verify($env)
     {
         if ($env['alg'] != 'RSA-SHA256') {
+            common_log(LOG_DEBUG, "Salmon error: bad algorithm");
             return false;
         }
 
         if ($env['encoding'] != MagicEnvelope::ENCODING) {
+            common_log(LOG_DEBUG, "Salmon error: bad encoding");
             return false;
         }
 
         $text = base64_decode($env['data']);
         $signer_uri = $this->getAuthor($text);
 
-        $verifier = Magicsig::fromString($this->getKeyPair($signer_uri));
+        try {
+            $keypair = $this->getKeyPair($signer_uri);
+        } catch (Exception $e) {
+            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']);
     }