Openfire registration user Encryption Method Analysis

Source: Internet
Author: User

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}

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.