Openfire custom database integration and password encription

Hi,

i configured openfire to use with my oracle database, becouse i want have users and usergroups from my database. Everything works fine, but i have problem with passwords. In my database passwords are custom encrypted with my own algorithm. How can i authorize users? User is loging to openfire from spark and he insert his username and password. I have to take this password on serverside, encrypt it with my algorithm and compare with password from database, and authorize user or not.

Maybe is other way ?

Thanks for all help.