Hello Everyone
I am trying to authenticate HTTP connection request using java(j2me) Message Digest. The authentication is failing on nokia devices but it is working like a charm on bada. Any help would be great.
Regards,
Rahul
Hello Everyone
I am trying to authenticate HTTP connection request using java(j2me) Message Digest. The authentication is failing on nokia devices but it is working like a charm on bada. Any help would be great.
Regards,
Rahul
You are using the same J2me code on bada device and it is working ?
Yes
int MD_SIZE = 16;
byte[] strByte = strMessageDigest.getBytes("UTF-8");
byte[] messageDigest = new byte[MD_SIZE];
md5.update(strByte, 0, strByte.length);
md5.digest(messageDigest, 0, MD_SIZE);
String digestedPass = digest2HexString(messageDigest);
private static String digest2HexString(byte[] digest) {
String digestString = "";
int low, hi;
for (int i = 0; i < digest.length; i++) {
// System.out.println("Digest:"+digest[i]);
low = (digest[i] & 0x0f);
hi = ((digest[i] & 0xf0) >> 4);
digestString += Integer.toHexString(hi);
digestString += Integer.toHexString(low);
}
return digestString;
}
The code is also working on S60 phones. I have tested on E71, Nokia 5233, Nokia 5800 Express.
The code is not working on C2-01 and asha series.
Last edited by rahul.aeran; 2012-12-05 at 12:32. Reason: Add additional information.
Presumably the best way to test this would be to compare the outputs on both platforms, starting with the final value of digestString (for the same input). Then at least you'd know whether the problem was in this code or some other part.
How can I help?
Hamish Willee, Nokia Developer Community Manager, ext-hamish.willee@nokia.com
I recommend to get a Series 40 with WLAN. Then you shop for a WLAN access point which allows to capture its data traffic. Then you can trace what happens with Wireshark. This helped me a lot to understand the various bugs (mine, Nokia’s and Samsung’s) and saved me a lot of time.