Intercepting login information

Hi… I am developing a flash client using XIFF to connect to openfire… As AS3 is really bad at secure socket… We are planning just to use blowfish encryption on a normal socket. So I think I need to able to intercept the request decrypt it then pass it on to openfire for a normal authemtication. I am thinking on the line of have a servlet plugin to do that. Is there a better way? I.e a interface I cam implment in the openfire API?

Thanks a million for any advice…