includes/sessions.php
changeset 292 b3cfaf0a505c
parent 289 2b60c89dc27f
child 304 e2cb5f1432c8
child 311 a007145a0ff6
equal deleted inserted replaced
291:a1d0846c4504 292:b3cfaf0a505c
   571     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   571     $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
   572     
   572     
   573     // Fetch our decryption key
   573     // Fetch our decryption key
   574     
   574     
   575     $aes_key = $this->fetch_public_key($aes_key_id);
   575     $aes_key = $this->fetch_public_key($aes_key_id);
   576     if(!$aes_key)
   576     if ( !$aes_key )
       
   577     {
       
   578       // It could be that our key cache is full. If it seems larger than 65KB, clear it
       
   579       if ( strlen(getConfig('login_key_cache')) > 65000 )
       
   580       {
       
   581         setConfig('login_key_cache', '');
       
   582         return 'It seems that the list of encryption keys used for login information has reached its maximum length, thus preventing new keys from being inserted. The list has been automatically cleared. Please try logging in again; if you are still unable to log in, please contact the site administration.';
       
   583       }
   577       return 'Couldn\'t look up public key "'.htmlspecialchars($aes_key_id).'" for decryption';
   584       return 'Couldn\'t look up public key "'.htmlspecialchars($aes_key_id).'" for decryption';
       
   585     }
   578     
   586     
   579     // Convert the key to a binary string
   587     // Convert the key to a binary string
   580     $bin_key = hexdecode($aes_key);
   588     $bin_key = hexdecode($aes_key);
   581     
   589     
   582     if(strlen($bin_key) != AES_BITS / 8)
   590     if(strlen($bin_key) != AES_BITS / 8)