Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 4715) +++ t3lib/class.t3lib_div.php (working copy) @@ -1368,6 +1368,37 @@ return chr(10).htmlspecialchars($content); } + /** + * Returns a string of highly randomized bytes (over the full 8-bit range). + * + * @copyright Drupal CMS + * @license GNU General Public License version 2 + * @param integer Number of characters (bytes) to return + * @return string Random Bytes + */ + public static function generateRandomBytes($count) { + $output = ''; + // /dev/urandom is available on many *nix systems and is considered + // the best commonly available pseudo-random source. + if (TYPO3_OS != 'WIN' && ($fh = @fopen('/dev/urandom', 'rb'))) { + $output = fread($fh, $count); + fclose($fh); + } + + // fallback if /dev/urandom is not available + if (!isset($output{$count - 1})) { + // We initialize with the somewhat random. + $randomState = $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] + . microtime() . getmypid(); + while (!isset($output{$count - 1})) { + $randomState = md5(microtime() . mt_rand() . $randomState); + $output .= md5(mt_rand() . $randomState, true); + } + $output = substr($output, strlen($output) - $count, $count); + } + return $output; + } + Index: typo3/sysext/install/ext_localconf.php =================================================================== --- typo3/sysext/install/ext_localconf.php (revision 4715) +++ typo3/sysext/install/ext_localconf.php (working copy) @@ -2,6 +2,7 @@ if (!defined ('TYPO3_MODE')) die ('Access denied.'); require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_compatversion.php'); +$TYPO3_CONF_VARS['FE']['eID_include']['tx_install_eid'] = 'EXT:install/mod/class.tx_install_eid.php'; $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['changeCompatibilityVersion'] = 'tx_coreupdates_compatversion'; // not used yet Index: typo3/sysext/install/mod/class.tx_install_eid.php =================================================================== --- typo3/sysext/install/mod/class.tx_install_eid.php (revision 0) +++ typo3/sysext/install/mod/class.tx_install_eid.php (revision 0) @@ -0,0 +1,126 @@ + + */ +class tx_install_eid { + + + /** + * Keeps content to be printed. + * + * @var string + */ + var $content; + + + /** + * Main function which creates the ecryption key for the install tool and displays it in a (popup) window. + * Accumulates the content in $this->content + * + * @return void + */ + function main() { + // Create HTML output: + $this->content=''; + $this->content.=' + + + + + Encryption key generation + + + +


Copy following string and paste it into the according input field of the install tool:

'; + + $this->content .= '' . $this->createEncryptionKey() . ''; + $this->content .= '

+ + '; + } + + /** + * Outputs the content from $this->content + * + * @return void + */ + function printContent() { + echo $this->content; + } + + /** + * Returns a newly created TYPO3 encryption key with a given length. + * + * @param integer $keyLength desired key length + * @return string + */ + function createEncryptionKey($keyLength = 96) { + + $bytes = t3lib_div::generateRandomBytes($keyLength); + return substr(bin2hex($bytes), -96); + } +} + +// Make instance: +$SOBE = t3lib_div::makeInstance('tx_install_eid'); +$SOBE->main(); +$SOBE->printContent(); + +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/sysext/install/mod/class.tx_install_eid.php']) { + include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/sysext/install/mod/class.tx_install_eid.php']); +} + +?> \ No newline at end of file Index: typo3/sysext/install/mod/class.tx_install.php =================================================================== --- typo3/sysext/install/mod/class.tx_install.php (revision 4715) +++ typo3/sysext/install/mod/class.tx_install.php (working copy) @@ -2036,8 +2036,7 @@ if ($this->mode!='123') { $out.=$this->wrapInCells('Site name:', ''); $out.=$this->wrapInCells('', '
'); - $out.=''; - $out.=$this->wrapInCells('Encryption key:', '
'); + $out.=$this->wrapInCells('Encryption key:', '
'); $out.=$this->wrapInCells('', '
'); // Other