openvpn protocol
Posted: Tue Feb 24, 2015 1:52 pm
Hey guys, I am trying to write a C# implementation of an openvpn client.
And I am confused about the format of the openvpn packages. Looking at the implementation is really hard, I can't find the exact place where everything is serialized into a flat byte array. So I wanted to ask you guys for some advice.
I am connecting with a secure socket so I already have everything encrypted, but I can't figure out the proper format of the first packet I am supposed to send. It is a P_CONTROL_HARD_RESET_CLIENT_V2 packet.
Looking into http://openvpn.net/index.php/open-sourc ... rview.html and http://wiki.wireshark.org/OpenVPN I figured that the first package I have to send looks like this:
16bit packet length
8 bit opcode = P_CONTROL_HARD_RESET_CLIENT_V2
32 bit session id = random()
20 bit HMAC = ?
32 bit packet-id = 1
32 bit epoch = current unix time of the machine
8bit message packet-id array length = 0
32 bit message packet-id = 0
I understand what HMAC is, but I don't understand what algorithm openvpn uses. Is it somehow negotiated or always static?
I tried to capture with wireshark what openvpn is sending, but everything is encrypted and I was kinda unable to set up an openvn server of my own.
And I am confused about the format of the openvpn packages. Looking at the implementation is really hard, I can't find the exact place where everything is serialized into a flat byte array. So I wanted to ask you guys for some advice.
I am connecting with a secure socket so I already have everything encrypted, but I can't figure out the proper format of the first packet I am supposed to send. It is a P_CONTROL_HARD_RESET_CLIENT_V2 packet.
Looking into http://openvpn.net/index.php/open-sourc ... rview.html and http://wiki.wireshark.org/OpenVPN I figured that the first package I have to send looks like this:
16bit packet length
8 bit opcode = P_CONTROL_HARD_RESET_CLIENT_V2
32 bit session id = random()
20 bit HMAC = ?
32 bit packet-id = 1
32 bit epoch = current unix time of the machine
8bit message packet-id array length = 0
32 bit message packet-id = 0
I understand what HMAC is, but I don't understand what algorithm openvpn uses. Is it somehow negotiated or always static?
I tried to capture with wireshark what openvpn is sending, but everything is encrypted and I was kinda unable to set up an openvn server of my own.