Code: Select all
...
Zeros = { 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00}
SecretKeySpec desSK = new SecretKeySpec(KeySession,0, 8,"DES");
Cipher DesCipher = Cipher.getInstance("DES/CBC/NoPadding", "SunJCE");
Spec = new IvParameterSpec(Zeros);
DesCipher.init(Cipher.ENCRYPT_MODE, desSK,Spec);
byte ForLastBlock[] = DesCipher.doFinal(data, 0, 8);
cipher = Cipher.getInstance("DESede/CBC/NoPadding", "SunJCE");
Spec = new IvParameterSpec(ForLastBlock);
cipher.init(Cipher.ENCRYPT_MODE, getKeySpec(KeySession), Spec);
byte cMac[] = cipher.doFinal(data, 8, 8);
...
Hope someone help me out.