OpenFire Registration User Encryption Method resolution

Source: Internet
Author: User

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    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.