Openfire is implemented through org. jivesoftware. util. Blowfish. java.
Use the encryptstring (string) of blowfish
Password) and decryptstring (string encryptedstring) encryption and decryption.
New blowfish (string passwordkey) requires passwordkey. Where can I find it?
Originally, there was a table ofproperty in the openfire database, with the passwordkey value, which was automatically generated when openfire was installed.
Each time openfire automatically generates a database, this attribute is different. Therefore, if the database changes, it is useless to import the original user information.
You can use org. jivesoftware. util. Blowfish. Java to perform encryption and decryption independently.
Copy org. jivesoftware. util. Blowfish. Java to your project. The sample code is as follows:
Public String getencrypwd (string noencrypwd) {string resultpwd = NULL; string passwordkey = NULL; // passwordkey, read/** from the openfire database. The following section describes how to obtain the passwordkey value from the ofproperty table. Ofproperty = ofpropertymapper. selectbyprimarykey ("passwordkey"); If (ofproperty! = NULL) {passwordkey = ofproperty. getpropvalue ();} */blowfish = new blowfish (passwordkey); // initialize passwordkey = blowfish Based on the encryption key. encryptstring (noencrypwd); // encrypt return resultpwd; // return the encrypted result}