1

I'm trying to generate users and password dynamically using PHP

I've seen

creating encrypted passwords in openfire MySQL via PHP

But the post is 3 years old and doesn't give any indication of where to get the various variables

eg enckey, enciv and javastring

Please could someone help

Thanks James

Community
  • 1
  • 1
TheBritishAreComing
  • 1,667
  • 2
  • 19
  • 38

1 Answers1

0

The answer from the question you mentioned has everything you need.

The variables you don't know where to get from are just examples to show how the decryption works.

Use the class like this:

$a = new OpenFireBlowfish('YourPassword');

if you don't provide an IV, the class will generate one.

$encstring = bin2hex($a->encryptString('stackoverflow'));

It might be worth to extend the class by a getIv() / setIv() method.

Note that you need mcrypt PHP mod installed to use those functions.

Daniel W.
  • 31,164
  • 13
  • 93
  • 151
  • Hi there, when we use this methodology we get gibberish back (which can't be insterted into the database because of unusual / odd encoding) for example ä¥>mÏ„å’yy1¡sW—`édÆÆm – TheBritishAreComing Feb 25 '14 at 13:57
  • @James This is binary data. Either you use `bin2hex` or you change your column to `BINARY` instead of `VARCHAR`. – Daniel W. Feb 25 '14 at 14:39
  • @DanFromGermany, How do you check which IV the server is using, to get a matching encrypted value as the server? – Pacerier Dec 02 '14 at 00:02