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

Parse partial length headers correctly. #208

Merged

Conversation

J08nY
Copy link
Contributor

@J08nY J08nY commented Aug 4, 2017

This adds support for partial length headers, currently only parsing them, not emitting them. With this PR PGPy can decode a partial length packet of indefinite length, however when outputing said packet back to bytes, it will be a packet with the usual 1 / 2 / 5 octet length, which means that packets with contents larger than 4,294,968,295 (0xFFFFFFFF) octets will be output incorrectly.

However, currently PGPy will not even parse those packets, so I believe this is an improvement that covers a large part of the use-cases of PGP.

To get PGPy to output partial length packets for packets larger than the 5 octet length limit, significant changes to the __bytearray__ logic will be required, as then, the packet header will need to insert bytes into the packet data itself. The current inheritance model doesn't make it easy.

Copy link
Contributor

@Commod0re Commod0re left a comment

Choose a reason for hiding this comment

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

This looks exactly like what I had in mind for being able to accept partial body lengths. We can revisit producing them later 8)

@J08nY J08nY changed the title WIP: Parse partial length headers correctly. Parse partial length headers correctly. Aug 4, 2017
@Commod0re Commod0re merged commit 595e120 into SecurityInnovation:master Aug 4, 2017
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.

2 participants