OpenFire is an encryption implemented through Org.jivesoftware.util.Blowfish.java.
Use Blowfish's encryptstring (string password) and decryptstring (string encryptedstring) two methods to perform an encryption and decryption.
The new Blowfish (String Passwordkey) needs to be passwordkey and where to look.
Originally in the OpenFire database has the table Ofproperty, which has the Passwordkey value, this is OpenFire installs the automatic generation.
OpenFire This property is different every time the database is automatically generated, so if the database changes, the original user information import is useless.
You can use Org.jivesoftware.util.Blowfish.java to perform encryption and decryption operations independently.
Copy the Org.jivesoftware.util.Blowfish.java to your project, the sample code is as follows:
[Java] View plain copy public string getencrypwd (string noencrypwd) { string resultpwd = null; string passwordkey = null; //passwordkey, Read from the OpenFire database /* * The following is a query from the Ofproperty table to get the value of Passwordkey. OfProperty ofProperty = Ofpropertymapper.selectbyprimarykey ("Passwordkey"); if (ofproperty != null) { passwordkey = ofproperty.getpropvalue (); } */ blowfish blowfish = new blowfish (passwordkey); //initialize based on encryption key passwordkey = blowfish.encryptstring (NoEncryPWD); // Encryption return resultpwd; //Returns the results of the encryption