Current time: 04-25-2024, 06:11 PM Hello There, Guest! (LoginRegister)


Post Reply 
transfer encrypted mailpass from RC7 to 1.0 on another server
Author Message
Catscrash Offline
Junior Member
*

Posts: 27
Joined: Oct 2008
Reputation: 0
Post: #1
transfer encrypted mailpass from RC7 to 1.0 on another server
Hi,
i'm moving from a server with RC7 (which has already encrypted emailpasswords for users) to a server with 1.0

I created the old mailboxes on the new server with a temporary password and tried then to copy the old encrypted passwords from ispcp.mail_users

Did the encryption change? Cause that doesn't work...

I can't Email a lot of users and say them, sry folks i just changed all ur passwords to "xyz" ;-)

Thanks for every help
03-06-2009 11:15 PM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #2
RE: transfer encrypted mailpass from RC7 to 1.0 on another server
Encryption depends on keys from ispcp-db-keys.* You need to decrypt password on old server, then reencrypt with keys from the new server. then it will work Wink
03-07-2009 01:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Catscrash Offline
Junior Member
*

Posts: 27
Joined: Oct 2008
Reputation: 0
Post: #3
RE: transfer encrypted mailpass from RC7 to 1.0 on another server
okay, that makes sense, how to decrypt the passwords on old server?

thx!
03-07-2009 02:26 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #4
RE: transfer encrypted mailpass from RC7 to 1.0 on another server
$db_pass is the encrypted/unencrypted password, and the other values can be found on the /var/www/ispcp/gui/include/ispcp-db-keys.php file of the corresponding server.
Code:
function decrypt_db_password ($db_pass, $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;

                // Intialize 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();
        }
}
Code:
function encrypt_db_password($db_pass, $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;

                for ($i=0; $i<$pads;$i++){
                        $db_pass.=" ";
                }
                // Intialize 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!");
        }
}
03-10-2009 02:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


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