70 :
Layer(data, dataLen, prevLayer, packet, WireGuard)
82 return (portSrc == 51820 || portDst == 51820);
173 #pragma pack(push, 1)
181 uint32_t senderIndex;
183 uint8_t initiatorEphemeral[32];
185 uint8_t encryptedInitiatorStatic[48];
187 uint8_t encryptedTimestamp[28];
192 } wg_handshake_initiation;
194 wg_handshake_initiation* getHandshakeInitiationHeader()
const
196 return reinterpret_cast<wg_handshake_initiation*
>(getBasicHeader());
221 const uint8_t encryptedInitiatorStatic[48],
222 const uint8_t encryptedTimestamp[28],
const uint8_t mac1[16],
223 const uint8_t mac2[16]);
278 void setMac1(
const std::array<uint8_t, 16>& mac1);
283 void setMac2(
const std::array<uint8_t, 16>& mac2);
303 #pragma pack(push, 1)
311 uint32_t senderIndex;
313 uint32_t receiverIndex;
315 uint8_t responderEphemeral[32];
317 uint8_t encryptedEmpty[16];
322 } wg_handshake_response;
325 wg_handshake_response* getHandshakeResponseHeader()
const
327 return reinterpret_cast<wg_handshake_response*
>(getBasicHeader());
352 const uint8_t responderEphemeral[32],
const uint8_t encryptedEmpty[16],
353 const uint8_t mac1[16],
const uint8_t mac2[16]);
408 void setMac1(
const std::array<uint8_t, 16>& mac1);
413 void setMac2(
const std::array<uint8_t, 16>& mac2);
433 #pragma pack(push, 1)
441 uint32_t receiverIndex;
445 uint8_t encryptedCookie[32];
449 wg_cookie_reply* getCookieReplyHeader()
const
451 return reinterpret_cast<wg_cookie_reply*
>(getBasicHeader());
497 void setNonce(
const std::array<uint8_t, 24>& nonce);
522 #pragma pack(push, 1)
530 uint32_t receiverIndex;
534 uint8_t encryptedData[0];
538 wg_transport_data* getTransportHeader()
const
540 return reinterpret_cast<wg_transport_data*
>(getBasicHeader());
563 size_t encryptedDataLen);
Definition: WireGuardLayer.h:431
std::array< uint8_t, 32 > getEncryptedCookie() const
std::array< uint8_t, 24 > getNonce() const
WireGuardMessageType getWireGuardMessageType() const override
Definition: WireGuardLayer.h:509
WireGuardCookieReplyLayer(uint32_t receiverIndex, const uint8_t nonce[24], const uint8_t encryptedCookie[32])
void setReceiverIndex(uint32_t receiverIndex)
void setNonce(const std::array< uint8_t, 24 > &nonce)
WireGuardCookieReplyLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: WireGuardLayer.h:462
uint32_t getReceiverIndex() const
void setEncryptedCookie(const std::array< uint8_t, 32 > &encryptedCookie)
Definition: WireGuardLayer.h:171
void setMac2(const std::array< uint8_t, 16 > &mac2)
WireGuardMessageType getWireGuardMessageType() const override
Definition: WireGuardLayer.h:290
void setMac1(const std::array< uint8_t, 16 > &mac1)
std::array< uint8_t, 48 > getEncryptedInitiatorStatic() const
std::array< uint8_t, 16 > getMac1() const
WireGuardHandshakeInitiationLayer(uint32_t senderIndex, const uint8_t initiatorEphemeral[32], const uint8_t encryptedInitiatorStatic[48], const uint8_t encryptedTimestamp[28], const uint8_t mac1[16], const uint8_t mac2[16])
uint32_t getSenderIndex() const
std::array< uint8_t, 16 > getMac2() const
std::array< uint8_t, 28 > getEncryptedTimestamp() const
void setEncryptedInitiatorStatic(const std::array< uint8_t, 48 > &encryptedInitiatorStatic)
WireGuardHandshakeInitiationLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: WireGuardLayer.h:207
void setEncryptedTimestamp(const std::array< uint8_t, 28 > &encryptedTimestamp)
std::array< uint8_t, 32 > getInitiatorEphemeral() const
void setInitiatorEphemeral(const std::array< uint8_t, 32 > &initiatorEphemeral)
void setSenderIndex(uint32_t senderIndex)
Definition: WireGuardLayer.h:301
uint32_t getSenderIndex() const
std::array< uint8_t, 16 > getMac1() const
WireGuardHandshakeResponseLayer(uint32_t senderIndex, uint32_t receiverIndex, const uint8_t responderEphemeral[32], const uint8_t encryptedEmpty[16], const uint8_t mac1[16], const uint8_t mac2[16])
void setResponderEphemeral(const std::array< uint8_t, 32 > &responderEphemeral)
uint32_t getReceiverIndex() const
void setMac2(const std::array< uint8_t, 16 > &mac2)
void setReceiverIndex(uint32_t receiverIndex)
WireGuardMessageType getWireGuardMessageType() const override
Definition: WireGuardLayer.h:420
void setEncryptedEmpty(const std::array< uint8_t, 16 > &encryptedEmpty)
WireGuardHandshakeResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: WireGuardLayer.h:338
void setMac1(const std::array< uint8_t, 16 > &mac1)
std::array< uint8_t, 16 > getMac2() const
void setSenderIndex(uint32_t senderIndex)
std::array< uint8_t, 32 > getResponderEphemeral() const
std::array< uint8_t, 16 > getEncryptedEmpty() const
Definition: WireGuardLayer.h:21
void setReserved(const std::array< uint8_t, 3 > &reserved)
OsiModelLayer getOsiModelLayer() const override
Definition: WireGuardLayer.h:152
size_t getHeaderLen() const override
static bool isWireGuardPorts(uint16_t portSrc, uint16_t portDst)
Definition: WireGuardLayer.h:80
virtual WireGuardMessageType getWireGuardMessageType() const
Definition: WireGuardLayer.h:160
WireGuardMessageType
Definition: WireGuardLayer.h:48
static bool isDataValid(const uint8_t *data, size_t dataLen)
std::string toString() const override
uint32_t getReserved() const
std::string getMessageTypeAsString() const
static WireGuardLayer * parseWireGuardLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
void parseNextLayer() override
Definition: WireGuardLayer.h:128
void computeCalculateFields() override
Definition: WireGuardLayer.h:139
WireGuardLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: WireGuardLayer.h:69
uint8_t getMessageType() const
Definition: WireGuardLayer.h:520
void setEncryptedData(const uint8_t *encryptedData, size_t encryptedDataLen)
void setCounter(uint64_t counter)
uint32_t getReceiverIndex() const
uint64_t getCounter() const
WireGuardTransportDataLayer(uint32_t receiverIndex, uint64_t counter, const uint8_t *encryptedData, size_t encryptedDataLen)
WireGuardTransportDataLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Definition: WireGuardLayer.h:551
const uint8_t * getEncryptedData() const
void setReceiverIndex(uint32_t receiverIndex)
WireGuardMessageType getWireGuardMessageType() const override
Definition: WireGuardLayer.h:601
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelNetworkLayer
Definition: ProtocolType.h:370