I am trying to Sip Register and I get the challenge from the server.
So I need to use the MD5 algorithm on the nonce and then send that to the server to authenticate.
I have come across two examples of MD5 encryption and I have tried both and each one gives a different string back to me, so I was wondering which one is the correct one to use?
Thanks in advance
EDIT:
Ok thanks for the commons codecs.
I have edited it because I have to encode the nonce value I get back from the server with my username and password to send it back.
So it is a particuler type of encoding for SIP registration, can anyone point to a tutorial on how to do this? Or have any hints?
Both are incorrect. Your conversion from the byte array to a hexadecimal string is broken. I highly recommend using http://commons.apache.org/codec/ from the ASF which can do this for you:
But if you’re using commons-codec, you can also do this:
and you’re done. Neat, isn’t it? 🙂