Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User rahul.aeran's Avatar
    Join Date
    Dec 2012
    Posts
    4
    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

  2. #2
    Nokia Developer Champion im2amit's Avatar
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    2,917
    You are using the same J2me code on bada device and it is working ?
    thanks,
    ~Amitabh
    (Poster of the Month -Dec'12)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Registered User rahul.aeran's Avatar
    Join Date
    Dec 2012
    Posts
    4
    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.

  4. #4
    Nokia Developer Administrator hamishwillee's Avatar
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    1,901
    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

  5. #5
    Nokia Developer Champion traud's Avatar
    Join Date
    Mar 2003
    Posts
    3,934
    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.

Similar Threads

  1. How to done digest access authentication in j2me?
    By sajidshaikhi in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2011-10-06, 06:38
  2. Replies: 0
    Last Post: 2011-04-03, 17:08
  3. http digest authentication
    By fongtoby in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2010-07-20, 04:39
  4. Http Digest Authentication in S60 2rd edition
    By lengyuecau in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-11-16, 10:04
  5. Why I can't pass the digest authentication?
    By ericfengjieming2007 in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-11-14, 09:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved