**this method will work for External Database (i.e. Mysql). **
I was using openfire with external Mysql database and forgot the admin password
**then I followed these steps to successfully reset my passwrod: **
- used OpenFire Blowfish Class for password encryption (also attaching the code below)
- go to your openfire mysql database (in phpmyadmin)
- in Db go to “ofProperty” table and look for passwordKey->value (copy past this key for later use
- also updated “admin.authorizedJIDs” with **admin@vps.server.com (i.e: username@domain) in “ofProperty” **table
- **recover now with OpenFire Blowfish Class:
**
======================OpenFire Blowfish.php===========================
<?php
/**
* Emulate OpenFire Blowfish Class
*/
class OpenFireBlowfish
{
-
private $key;*
-
private $cipher;*
-
public $enckey = “acE1v7A2L0MdjuS”; //Hidden Encryption Key of Openfire BlowFish*
-
public $enciv = ‘’;*
-
function __construct($pass)*
-
{*
-
$this->cipher = mcrypt_module_open('blowfish','','cbc','');*
-
$ks = mcrypt_enc_get_key_size($this->cipher);*
_ $this->key = pack(‘H*’,sha1($pass));_
-
}*
-
function encryptString($plaintext, $iv = ‘’)*
-
{*
-
if ($iv == '') {*
-
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this->cipher));*
-
}*
-
else {*
_ $iv = pack(“H*”, $iv);_
-
}*
-
mcrypt_generic_init($this->cipher, $this->key, $iv);*
-
$bs = mcrypt_enc_get_block_size($this->cipher); // get block size*
-
$plaintext = mb_convert_encoding($plaintext,'UTF-16BE'); // set to 2 byte, network order*
-
$pkcs = $bs - (strlen($plaintext) % $bs); // get pkcs5 pad length*
-
$pkcs = str_repeat(chr($pkcs), $pkcs); // create padding string*
-
$plaintext = $plaintext.$pkcs; // append pkcs5 padding to the data*
-
$result = mcrypt_generic($this->cipher, $plaintext);*
-
mcrypt_generic_deinit($this->cipher);*
-
return $iv.$result;*
-
}*
-
function decryptString($ciphertext)*
-
{*
-
$bs = mcrypt_enc_get_block_size($this->cipher); // get block size*
-
$iv_size = mcrypt_enc_get_iv_size($this->cipher);*
-
if ((strlen($ciphertext) % $bs) != 0) { // check string is proper size*
-
exit(1);*
-
}*
-
$iv = substr($ciphertext, 0, $iv_size); // retrieve IV*
-
$ciphertext = substr($ciphertext, $iv_size);*
-
mcrypt_generic_init($this->cipher, $this->key, $iv);*
-
$result = mdecrypt_generic($this->cipher, $ciphertext); // decrypt*
_ //echo var_dump(unpack(‘c*’,$iv))."\n";_
_ $result = substr($result,0,$padding * -1); // and remove it_
}
// Test OpenFire Blowfish Class
$enckey = “paste your openfire passwordKey”; //paste your openfire Db passwordKey copied in poin# 3
*$enciv = ‘’; *
$a = new OpenFireBlowfish($enckey);
*$encstring = bin2hex($a->encryptString(‘password’,$enciv)); //enter your password string to encrypt it *
echo “Encrypted Password string:”.$encstring . “
”;
echo “Original Password string:”.$a->decryptString(pack(“H*”, $encstring)) . “
”;
?>
=========================================================
-
now run this file on your local webserver and copy the encryptedPassword string
-
now go to “ofUser” table in **openfire database **and replace the encryptedPassword string in your “ofUser” Table against your admin username.
Note:
-
restart your server that can be done from WHM (forcerestart/graceful restart)
-
after restarting server refresh your openfire page (http://xxx.xxx.xxx.xxx:9090/ or http://domain.com:9090 ) and login using username and password that you used for encryption
**this method will work for External Database Mysql.
**