Current time: 11-06-2024, 01:24 AM Hello There, Guest! (LoginRegister)


Post Reply 
Umsetzung Fremd auf ISPCP
Author Message
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #17
RE: Umsetzung Fremd auf ISPCP
Google translator is not quite good, but I understand that you need to know how passwords are encrypted / decrypted.

$ispcp_db_pass_key and $ispcp_db_pass_iv are generated on install and saved on ispcp/gui/include/ispcp-db-keys.php.

Code:
function decrypt_db_password ($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;

    if ($db_pass == '')
        return '';

    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $text = @base64_decode($db_pass . "\n");
        // Open the cipher
        $td = @mcrypt_module_open ('blowfish', '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        // Decrypt encrypted string
        $decrypted = @mdecrypt_generic ($td, $text);
        @mcrypt_module_close ($td);

        // Show string
        return trim($decrypted);
    } else {
        system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die();
    }
}

function encrypt_db_password($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;
    
    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $td = @mcrypt_module_open (MCRYPT_BLOWFISH, '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;
        
        //compatibility with used perl pads
        $block_size=@mcrypt_enc_get_block_size($td);
        $strlen=strlen($db_pass);

        $pads=$block_size-$strlen % $block_size;

        $db_pass .= str_repeat(' ', $pads);

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        //Encrypt string
        $encrypted = @mcrypt_generic ($td, $db_pass);
        @mcrypt_generic_deinit($td);
        @mcrypt_module_close($td);

        $text = @base64_encode("$encrypted");
        $text=trim($text);
        return $text;
    } else {
        //system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die("ERROR: The php-extension 'mcrypt' not loaded!");
    }
}
02-27-2009 06:31 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Umsetzung Fremd auf ISPCP - Uwe Driessen - 02-27-2009, 05:21 AM
RE: Umsetzung Fremd auf ISPCP - BeNe - 02-27-2009, 05:38 AM
RE: Umsetzung Fremd auf ISPCP - Lucan - 02-27-2009, 05:59 AM
RE: Umsetzung Fremd auf ISPCP - tango - 02-27-2009, 06:01 AM
RE: Umsetzung Fremd auf ISPCP - tango - 02-27-2009, 05:57 AM
RE: Umsetzung Fremd auf ISPCP - Lucan - 02-27-2009, 06:11 AM
RE: Umsetzung Fremd auf ISPCP - tango - 02-27-2009, 06:10 AM
RE: Umsetzung Fremd auf ISPCP - tango - 02-27-2009, 06:19 AM
RE: Umsetzung Fremd auf ISPCP - tango - 02-27-2009, 06:26 AM
RE: Umsetzung Fremd auf ISPCP - sci2tech - 02-27-2009 06:31 AM
RE: Umsetzung Fremd auf ISPCP - sci2tech - 02-28-2009, 08:47 PM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)