示例#1
0
 /**
  * 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 ($obj instanceof Magicsig) {
         $obj->importKeys();
         // Loads Crypt_RSA objects etc.
         // Throw out a big fat warning for keys of less than 1024 bits. (
         // The only case these show up in would be imported or
         // legacy very-old-StatusNet generated keypairs.
         if (strlen($obj->publicKey->modulus->toBits()) < 1024) {
             common_log(LOG_WARNING, sprintf('Salmon key with <1024 bits (%d) belongs to profile with id==%d', strlen($obj->publicKey->modulus->toBits()), $obj->user_id));
         }
     }
     return $obj;
 }