我正在尝试计算CMAC
byte[] key={0x09,0x11,0x12,0x34,0x56,0x78,0x00,0x01,0x01,0x13,0x14,0x36,0x58,0x7A,0x02,0x03};
AES mAES=new AES();
mAES.AesInit(key);
byte[] response = mAES.calcCMAC(challenge);
Swift我正在使用lib CryptoSwift
let key = [0x09,0x11,0x12,0x34,0x56,0x78,0x00,0x01,0x01,0x13,0x14,0x36,0x58,0x7A,0x02,0x03] as [UInt8]
let message:NSData = NSData.fromHexString("DA55C255")
let mac = Authenticator.Poly1305(key: key).authenticate(message.arrayOfBytes())
但它没有按预期工作。
预期结果是
挑战是DA55C255
回复是ED7CA01A