# Create MAC and IV given known IV and MAC for previous message

I've been given a AES-CBC-MAC, a message and the IV. I don't know the key. Given a second message I am supposed to derive the IV and create a valid MAC.

I believe I've successfully created the second IV, (Message1 XOR IV1) XOR Message2. However I'm not able to create a valid MAC - but this is where I'm unsure if I have misunderstood something: Given the same key for both messages, shouldn't MAC1 and MAC2 match given how I've created IV2?

And yes, as you've certainly guessed, this is a homework question. I've been driving myself crazy trying to figure this out, but I've come to the realisation that my understanding of AES-CBC-MAC is lacking.

• How do you know you're not generating a valid MAC? If the length of Message1 and Message2 are the same, and both at most 16 bytes, that should work... – poncho May 7 '17 at 14:45
• Hmm, yeah - as I thought then. I was successfully able to create a matching MAC using another students set (IV and MAC), so maybe my set was created incorrectly. – Index May 8 '17 at 2:00