I would like to understand the cryptography behind Wpa2. As far as I know, there are 4 messages on the 4-way handshake and three of them are values concatenated with hashes. First, I am trying to understand how the PTK is generated. I believe that it is:
H(an||stn||amac||stmac||PSK)
Where "h" function is sha1, "an" is the ap nonce, "stn" is the client nonce, "amac" is ap's mac address, "stmac" is client's Mac address and PSK is the shared key, But I might be totally wrong. Second, the second message on the handshake is
Stn || H(an || KCK)
Right? My question is if it is the way I wrote or it is different.
Thanks in advance