1
From my previous posts part 1, part 2, part 3 and part 4 I believe I have calculated/decrypted everything correctly and ready to attempt to decrypt the client encrypted handshake message. I'm stuck on the next step once I have all the keys. I've been reading and researching this for a couple days and just plain stuck.
Following the guidelines from my previous posts I have come up with
20 bytes for a client MAC key: 64666eafe1cbd51f2e2b50799b40f6007c3dc56f
20 bytes for a server MAC key: e0aac1312d35b5e8b6bf9af6ecf07e1dff27c784
32 bytes client encryption key:
4bf20108190203c4210ff9df6c4eb6e907ddd1f49646ab4b243c80a6ae9b4808
32 bytes for a server encryption key:
ca94445e3d771d3e06b71ee0deb4c1879986c4c6a4b78bf1c3c1083a6ddce9ff
My encrypted client handshake message:
Hex. FILE SIZE: 40
ADDRESS 000 001 002 003 004 005 006 007 ASCII
===============================================================================
00000000 09A 01B 0F3 06B 078 06C 03B 059 ~Z ^[ -s k x l ; Y
00000008 085 061 07C 076 0AF 0D9 085 0D6 ~E a | v -/ -Y ~E -V
00000010 08F 0FD 0AF 06D 09F 01A 025 0EF ~O -} -/ m ~_ ^Z % -o
00000018 040 015 097 002 0B5 0AD 0EF 040 @ ^U ~W ^B -5 -- -o @
00000020 02B 0DB 051 096 0CE 076 0A9 03F + -[ Q ~V -N v -) ?
00000028 0D7 030 049 03A 0CC 0F9 029 044 -W 0 I : -L -y ) D
00000030 07F 0A9 0C6 0F1 017 02D 06B 040 ^? -) -F -q ^W - k @
00000038 035 0F5 057 08E 0BF 0E9 05C 06D 5 -u W ~N -? -i \ m
00000040
I believe I need to use a variation of openssl end -d -K but stumbling around here between the RFC and google to find a solution/example that clearly explains it. Does anyone know how/if I can do this at the command line in openssl? Thanks
Update. I am not sure why/how I overlooked in the RFC 7.4.9 PRF(master_secret, finished_label, Hash(handshake_messages))
I do have logged all the handshake messages can someone explain how I can simulate this with just openssl command line with the data I have captured/decrypted to this point.?
It looks like the hash of the handshake messages is what I need to perform prior to this RFC section 5 I am assuming that I am going to use the master_secret I generated I am not sure what the seed for this should be using the openssl the way I have been previously using it. I don't see that for this hash there is a label concatenated so do I just use all the handshake messages to this point concatenated together? There are many steps I am getting lost where I am at. Thanks
openssl dgst -sha256 -mac hmac -macopt hexkey:$key <seed -binary >a1
Dave, Thanks... since I am not sure what step in my shell script may be wrong deriving the key. I posted my first step here. Can you take a look and see if I've perhaps not captured my client encrypted premaster correctly. That is the only thing I can think of I may have done wrong. Comparing what I see In wireshark and the file I created byte for byte they are exact so I don't think my first ste is wrong. here is the data including my private key.
– David B – 2018-08-08T13:26:15.503p.s. I followed your outline to a "t" first using the data you gave in the example for $key and $lbsd to make sure I got exactly the same outcome and I did. My shell script is based on most of that with the exception of a couple of things. Then expand that to the keys. – David B – 2018-08-08T18:06:36.603