I tried to calculate the MIC for a WPA Handshake packet, but unfortunatelly it fails. To be more precise, I took the 802.1x packet (like the specification says).
MIC = HMAC_MD5(MIC Key, 16, 802.1x data)
This is the relevant Code:
mic = hmac.new(ptk[0:16],data)
print "mic: " + mic.hexdigest() + "\n"
Where hmac.new is taken from the hmac lib:
import hmac,hashlib,binascii
The key for the encryption consists obviously of the first 16 bytes of the Pairwise Transcient Key (the so called Key Confirmation Key). The PTK is confirmed by a program called cowPatty. So I can exclude these two factors to be wrong. This is my 802.1x data, which is introduced by the hex values 0103:
01030077fe010a001000000000000000
01ae11df37f5fb100665ce0c849f5950
c0e7901da3224ddfc9e9434babad5512
73000000000000000000000000000000
00000000000000000000000000000000
00e8b4b90bfc3fd97b657afeb66262ae
940018dd160050f20101000050f20201
000050f20401000050f202
The MIC that Wireshark calculates is:
e8b4b90bfc3fd97b657afeb66262ae94
The MIC that I calculate is:
5492624bb538b52d6aa6261c692bd595
Unfortunatelly it doesn't matter what I do, I am never be able to compute the same MIC. Maybe some expert has valuable input, that really would be appreciated!
Best regards!
data
here. Is it EAPOL Raw data? – Somewise