git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 7e4718a4 authored by mmn's avatar mmn

IMPORTANT - fixed Magicsig to properly overload getKV (prev. staticGet)

In commit e95f77d3 Magicsig lost the 'staticGet' function (later renamed to getKV in 2a4dc77a ), which was important to properly initialize the Magicsig object (fromString)
parent 3ce5631b
......@@ -81,6 +81,31 @@ class Magicsig extends Managed_DataObject
$this->alg = $alg;
}
/**
* Fetch a Magicsig object from the cache or database on a field match.
*
* @param string $k
* @param mixed $v
* @return Magicsig
*/
static function getKV($k, $v=null)
{
$obj = parent::getKV($k, $v);
if (!empty($obj)) {
$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;
}
public static function schemaDef()
{
return array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment