summaryrefslogtreecommitdiff
path: root/plugins/OStatus/classes
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r--plugins/OStatus/classes/HubSub.php2
-rw-r--r--plugins/OStatus/classes/Magicsig.php20
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php6
3 files changed, 19 insertions, 9 deletions
diff --git a/plugins/OStatus/classes/HubSub.php b/plugins/OStatus/classes/HubSub.php
index 1ac181fee..e599d83a9 100644
--- a/plugins/OStatus/classes/HubSub.php
+++ b/plugins/OStatus/classes/HubSub.php
@@ -99,7 +99,7 @@ class HubSub extends Memcached_DataObject
return array_keys($this->keyTypes());
}
- function sequenceKeys()
+ function sequenceKey()
{
return array(false, false, false);
}
diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php
index 751527c81..96900d876 100644
--- a/plugins/OStatus/classes/Magicsig.php
+++ b/plugins/OStatus/classes/Magicsig.php
@@ -50,7 +50,11 @@ class Magicsig extends Memcached_DataObject
public /*static*/ function staticGet($k, $v=null)
{
$obj = parent::staticGet(__CLASS__, $k, $v);
- return Magicsig::fromString($obj->keypair);
+ if (!empty($obj)) {
+ return Magicsig::fromString($obj->keypair);
+ }
+
+ return $obj;
}
@@ -84,6 +88,10 @@ class Magicsig extends Memcached_DataObject
return array('user_id' => 'K');
}
+ function sequenceKey() {
+ return array(false, false, false);
+ }
+
function insert()
{
$this->keypair = $this->toString();
@@ -173,14 +181,15 @@ class Magicsig extends Memcached_DataObject
switch ($this->alg) {
case 'RSA-SHA256':
- return 'sha256';
+ return 'magicsig_sha256';
}
}
public function sign($bytes)
{
- $sig = $this->_rsa->createSign($bytes, null, 'sha256');
+ $hash = $this->getHash();
+ $sig = $this->_rsa->createSign($bytes, null, $hash);
if ($this->_rsa->isError()) {
$error = $this->_rsa->getLastError();
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
@@ -192,7 +201,8 @@ class Magicsig extends Memcached_DataObject
public function verify($signed_bytes, $signature)
{
- $result = $this->_rsa->validateSign($signed_bytes, $signature, null, 'sha256');
+ $hash = $this->getHash();
+ $result = $this->_rsa->validateSign($signed_bytes, $signature, null, $hash);
if ($this->_rsa->isError()) {
$error = $this->keypair->getLastError();
common_log(LOG_DEBUG, 'RSA Error: '. $error->getMessage());
@@ -205,7 +215,7 @@ class Magicsig extends Memcached_DataObject
// Define a sha256 function for hashing
// (Crypt_RSA should really be updated to use hash() )
-function sha256($bytes)
+function magicsig_sha256($bytes)
{
return hash('sha256', $bytes);
}
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 35539bff7..7b1aec76b 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -1288,9 +1288,9 @@ class Ostatus_profile extends Memcached_DataObject
$disco = new Discovery();
- $result = $disco->lookup($addr);
-
- if (!$result) {
+ try {
+ $result = $disco->lookup($addr);
+ } catch (Exception $e) {
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
return null;
}