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

Experiment with using ITaggedData for AES extra data handling #470

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented May 30, 2020

This is an experiment to use the ITaggedData machinery for handling the AES extra data, too see how it might effect things, and to think if it might be useful for #443 (to have the extra data handling in a central place).

Notes:

  1. It changes the TagID property on ITaggedData from short to ushort to accomodate the 0x9901 value for the AES extra data. Some of the other apis use int rather than short so that might be more consistent, not sure if other places could be changed to keep it working with short though.

  2. Not sure if using ZipHelperStream to unpack the data instead of reading array values is more extra overhead than would be ideal, though i think the read functions in ZipExtraData might already do more size checks than they really need to, so perhaps it could be tuned in general?

  3. Similar on the GetData() side - building the fixed 7 byte array with a temporary stream and 7 calls to write byte is perhaps not the optimal approach there.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@piksel
Copy link
Member

piksel commented Jun 23, 2020

I am currently going through the ExtraFields/ITaggedData for ArchiveDiag and have added some extensions and an Enum with the known IDs. I'm thinking about doing some changes to the API to make it a bit more useful, but that should not affect this too much.

@Numpsy
Copy link
Contributor Author

Numpsy commented Jun 23, 2020

it was initially just to see if it's a reasonable approach to sharing the AES extra data code (rather than just having some other helper functions), rather than a concrete thing, so no problem.

(as far as the shape of the api goes, see my comment about possibly not being terribly efficient, though I don't know what the scope is for changing the interface vs. public API breaks)

@Numpsy Numpsy force-pushed the rw/zip/aes_extra_data branch from 44da647 to 9bd70bd Compare October 4, 2021 18:56
@codecov
Copy link

codecov bot commented Oct 4, 2021

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.40%. Comparing base (b5b1a92) to head (9bd70bd).
Report is 50 commits behind head on master.

Files with missing lines Patch % Lines
src/ICSharpCode.SharpZipLib/Zip/ZipExtraData.cs 92.85% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #470      +/-   ##
==========================================
+ Coverage   73.07%   73.40%   +0.33%     
==========================================
  Files          68       68              
  Lines        8305     8322      +17     
==========================================
+ Hits         6069     6109      +40     
+ Misses       2236     2213      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Numpsy
Copy link
Contributor Author

Numpsy commented Oct 6, 2021

Just trying to remember what state this was left in...

Any thoughts on the type of TagID, given the comments in the op and in #657 ?

@piksel
Copy link
Member

piksel commented Oct 6, 2021

I think it should definitely be ushort (or even byte[2], but that's a bit less convenient to use).

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