summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Walker <walkah@walkah.net>2010-03-24 15:15:20 -0400
committerJames Walker <walkah@walkah.net>2010-03-24 15:15:20 -0400
commitc4273f0ef32f65267ddf43dc5dc6977659a0697e (patch)
tree66b17360f19e082867325c84d54c00df02ce6e30
parent10410907a0a6f1af9fb18cb3341db792baa49cf3 (diff)
Check for 0.9.0 bad keys from old Crypt_RSA library
-rw-r--r--plugins/OStatus/classes/Magicsig.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php
index 87c684c93..1a9541495 100644
--- a/plugins/OStatus/classes/Magicsig.php
+++ b/plugins/OStatus/classes/Magicsig.php
@@ -50,7 +50,15 @@ class Magicsig extends Memcached_DataObject
{
$obj = parent::staticGet(__CLASS__, $k, $v);
if (!empty($obj)) {
- return Magicsig::fromString($obj->keypair);
+ $obj = Magicsig::fromString($obj->keypair);
+
+ // Double check keys: Crypt_RSA did not
+ // consistently generate good keypairs.
+ // We've also moved to 1024 bit keys.
+ if (strlen($obj->publicKey->modulus->toBits()) != 1024) {
+ $obj->delete();
+ return false;
+ }
}
return $obj;