Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to decode ESP frames #155

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jgaulon
Copy link
Contributor

@jgaulon jgaulon commented Oct 20, 2021

assuming Null Ciphering and 96 bits Integrity algorithm

@jgaulon
Copy link
Contributor Author

jgaulon commented Oct 22, 2021

@PhyxionNL any comment on my PR? Thanks

Copy link
Collaborator

@PhyxionNL PhyxionNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things.

Comment on lines 141 to 154
public ProtocolType NextHeader { get; set; }

/// <summary>Pad length</summary>
public int PadLength { get; private set; }

/// <summary>
/// Gets or sets the Authentication Data
/// </summary>
public byte[] AuthenticationData { get; set; }

/// <summary>
/// Gets or sets the Pad
/// </summary>
public byte[] Pad { get; private set; }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get and sets should be implemented for all of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I don't actually really know how to do this. The packet type is "Encapsulated Security Payload" and as the name says it, this is encapsulated. So that the "NextHeader", "Pad" and its length and finally the integrity signature are placed after the encrypted payload (even in case of Null Ciphering case, so no encryption). The Packet and ByteArraySegment classes are designed that all fields are stored in the Header which is here not the case, as this is a Suffix.
For decoding, I managed to find a way and use the simple setter/getter only. For encoding, this can't be done without the payload and the corresponding integrity algorithm and its key.
Any suggestion?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the header briefly, I think a set would be possible after reading the length of payload/segment? The code right now is also a bit strange as the data would become invalid once you change the payload. For the set, it could alternatively be changed into a method to pass in the required details. DHCP packet is doing something similar with Options, https://github.com/chmorgan/packetnet/blob/master/PacketDotNet/DhcpV4Packet.cs#L299

@jgaulon
Copy link
Contributor Author

jgaulon commented Oct 22, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants