Parse partial length headers correctly. #208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.