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:
anybody suggest me what i have to change and which function to use to generate MAC key correctly.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; }
Thank you.

Reply With Quote

