×

Discussion Board

Results 1 to 10 of 10

Threaded View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    12

    validation using HMac

    i am trying to validate the responce which i got from server. but i am not getting how to do?? i am referring this link but this's something different than the method used in server side MAC generation code.

    Java code:
    Code:
      public static byte[] generateMac(byte[] key, byte[] cipherText,int offset,int length, int mac_size_bits){
        	byte[] result = null;
        	KeyParameter keyParam = null;
        	try {
        		keyParam = new KeyParameter(key);
        		CBCBlockCipherMac blockCipherMac = new CBCBlockCipherMac(new AESEngine(),mac_size_bits);
        		result = new byte[blockCipherMac.getMacSize()];
        		blockCipherMac.init(keyParam);
        		blockCipherMac.update(cipherText, offset, length);
        		blockCipherMac.doFinal(result, 0);
        	} catch (Exception e) {
    //    		System.out.println(e);
        		return null;
        	}finally{
        		keyParam = null;
        	}
        	return result;
        }
    anybody suggest me what i have to change and which function to use to generate MAC key correctly.
    Thank you.
    Last edited by priya_ps; 2012-09-03 at 12:51.

Similar Threads

  1. Replies: 3
    Last Post: 2008-07-22, 06:34
  2. How to Implement HMAC
    By naresh99 in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-01-31, 11:06
  3. How to Implement HMAC
    By naresh99 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-01-31, 09:57
  4. HMAC Problems
    By Neo` in forum Smart Messaging
    Replies: 0
    Last Post: 2004-09-28, 10:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×