今天安装Openfire但是设置完毕后忘记密码了,然后查看资料,找到了解决方法
Openfire 的密码加密是由 org.jivesoftware.util.Blowfish 实现的,不过需要加密需要获取Openfire 的 passwordKey ,在安装的目录下面的openfire\embedded-db\openfire.script里面查找
- <span style="font-size:18px">INSERT INTO OFPROPERTY VALUES('passwordKey','xxxxxxxxxxxx') //<span style="font-family:Arial,Helvetica,sans-serif">passwordKey</span></span>
然后在相同的文件里面找到
- INSERT INTO OFUSER VALUES('admin',NULL,'63b8e73c0cbc612ec692196c6d8df0cf54da7c77f9c8752fc3bce938a4818a20','Administrator','jwzhangjie@163.com','001379898892206','0') //<span style="font-family:arial,helvetica,sans-serif; color:#333333; line-height:25px; background-color:rgb(219,238,243)">encryptedPassword</span>
然后用以下Java代码就可以解密:
1. <span style="font-size:18px">package openfire;
2.
3. import org.jivesoftware.util.Blowfish;
4.
5. public class Openfire {
6. static Blowfish blowfish = new Blowfish("xxxxxx");//<span style="font-family:Arial,Helvetica,sans-serif">passwordKey</span>
7. public static void main(String[] args) {
8. System.out.println(blowfish.decryptString("xxxxxxxxxxxxxxxxxxxx")); // encryptedPassword
9. }
10. }</span>