1

I am implementing digest-md5 in J2ME.In the computation of the client response, the following steps are given:

  1. Create a string of the form "username:realm:password". Call this string X.
  2. Compute the 16 octet MD5 hash of X. Call the result Y.
  3. Create a string of the form "Y:nonce:cnonce:authzid". Call this string A1.
  4. Create a string of the form "AUTHENTICATE:digest-uri". Call this string A2.
  5. Compute the 32 hex digit MD5 hash of A1. Call the result HA1.
  6. Compute the 32 hex digit MD5 hash of A2. Call the result HA2.
  7. Create a string of the form "HA1:nonce:nc:cnonce:qop:HA2". Call this string KD.
  8. Compute the 32 hex digit MD5 hash of KD. Call the result Z.

Does anyone here know how to implement step 2? I have a md5 function that returns a 32 hex digit but i don't know how to compute a 16 octet md5 hash?

I just would like to reiterate that I am using J2ME. In that case I can not simply use MessageDigest.

Thank you in advance. :)

Kenneth
  • 11
  • 2
  • Hi Kenneth, On server side uses a digest authentication and i m trying to connect url but i cant because authentication is there so can you please tell me how to digest authentication in j2me with httpconection. – Mr. Sajid Shaikh Sep 23 '11 at 11:05

1 Answers1

0

see this

use MD-5 instead SHA 256

Nirmal- thInk beYond
  • 11,847
  • 8
  • 35
  • 46
  • thanks for the answer! :) however, MessageDigest does not work for Java J2ME. – Kenneth Jun 29 '11 at 05:13
  • Also, I have already solved my problem!Thanks to this blog: http://deusty.blogspot.com/2007/09/example-please.html – Kenneth Jun 29 '11 at 05:14
  • @Kenneth I know this is a very old question but I am facing a similar problem. I am using the XMPP library made by the guy who wrote the post that solved your problem. However, this library is not creating the response in the way defined by XMPP (the steps posted in your question). My question is: after implementing like in that blogspot post, were you able to login to a XMPP server? I am unable to do so with that guy library... – momo Aug 26 '15 at 03:34