includes/sessions.php
changeset 591 2529833a7731
parent 590 03a60844c7c5
child 592 27377179fe58
equal deleted inserted replaced
590:03a60844c7c5 591:2529833a7731
   134    */
   134    */
   135   
   135   
   136   var $unread_pms = 0;
   136   var $unread_pms = 0;
   137   
   137   
   138   /**
   138   /**
   139    * AES key used to encrypt passwords and session key info - irreversibly destroyed when disallow_password_grab() is called
   139    * AES key used to encrypt passwords and session key info.
   140    * @var string
   140    * @var string
   141    */
   141    * @access private
   142    
   142    */
   143   var $private_key;
   143    
       
   144   protected $private_key;
   144   
   145   
   145   /**
   146   /**
   146    * Regex that defines a valid username, minus the ^ and $, these are added later
   147    * Regex that defines a valid username, minus the ^ and $, these are added later
   147    * @var string
   148    * @var string
   148    */
   149    */
  2403       }
  2404       }
  2404     }
  2405     }
  2405     
  2406     
  2406     // Yay! We're done
  2407     // Yay! We're done
  2407     return 'success';
  2408     return 'success';
       
  2409   }
       
  2410   
       
  2411   /**
       
  2412    * Encrypts a string using the site's private key.
       
  2413    * @param string
       
  2414    * @param int Return type - one of ENC_BINARY, ENC_HEX, ENC_BASE64
       
  2415    * @return string
       
  2416    */
       
  2417   
       
  2418   function pk_encrypt($string, $return_type = ENC_HEX)
       
  2419   {
       
  2420     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
       
  2421     return $aes->encrypt($string, $this->private_key, $return_type);
       
  2422   }
       
  2423   
       
  2424   /**
       
  2425    * Encrypts a string using the site's private key.
       
  2426    * @param string
       
  2427    * @param int Input type - one of ENC_BINARY, ENC_HEX, ENC_BASE64
       
  2428    * @return string
       
  2429    */
       
  2430   
       
  2431   function pk_decrypt($string, $input_type = ENC_HEX)
       
  2432   {
       
  2433     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
       
  2434     return $aes->decrypt($string, $this->private_key, $input_type);
  2408   }
  2435   }
  2409   
  2436   
  2410   #
  2437   #
  2411   # USER RANKS
  2438   # USER RANKS
  2412   #
  2439   #