summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-27 00:23:34 +0000
committerZach Copley <zach@status.net>2010-02-27 00:23:34 +0000
commitdbb9957eea1887265532dbae000fb1fc30005988 (patch)
tree1edfd79e58792e661cb5242d6a5668b3ce1670ff /plugins
parentcd831dbc4cbdcb6afbcdc59cfee8d0df2558061c (diff)
parent94b61bca69c22b4fb2a6b7fa0e6aaa8aeeb6b48d (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/classes/Magicsig.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php
index 30da63c36..96900d876 100644
--- a/plugins/OStatus/classes/Magicsig.php
+++ b/plugins/OStatus/classes/Magicsig.php
@@ -181,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());
@@ -200,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());
@@ -213,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);
}