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

Add support for libzip encryption functions #43

Open
3 tasks
grendello opened this issue Jan 13, 2020 · 4 comments
Open
3 tasks

Add support for libzip encryption functions #43

grendello opened this issue Jan 13, 2020 · 4 comments

Comments

@grendello
Copy link
Contributor

Originally libZipSharp had no use for libzip's encryption functions as Xamarin.Android doesn't use them, but now that the library is shipped in a nuget those functions may come useful. Implement the following:

  • Explicitly open an encrypted archive
  • Automatically detect if the archive is encrypted and, if yes, use a callback to ask user for password (libZipSharp must not do it on its own)
  • Create an encrypted archive with a provided password and a choice of encryption methods

Relevant upstream APIs:

@Fniz
Copy link
Contributor

Fniz commented Jan 8, 2021

Hi, I want to propose an implementation if it's still relevant. But my Unit tests basically don't pass because it does not find the libzip.dll (System.DllNotFoundException: 'Unable to load DLL 'libzip': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'

How do you run UnitTests ? (On Windows)

image

@grendello
Copy link
Contributor Author

@Fniz yes, it's still definitely relevant! We don't use it in Xamarin.Android, but if you need it and can provide an implementation we will happily accept a PR :)

Regarding running tests, I'll let @dellis1972 answer it since I don't use Windows and I don't know the answer

Thanks!

@dellis1972
Copy link
Contributor

@Fniz the unit tests should work on windows. This line https://github.com/xamarin/LibZipSharp/blob/master/LibZipSharp.UnitTest/LibZipSharp.UnitTest.csproj#L27 in the csproj should copy the libzip.dll from the Window build directory over to the unit test output directory.

On my Mac machine LibZipSharp.UnitTest/bin/Debug/net471 contains the libzip.dll. That should be the same on windows.
My guess is build\Windows\64\lib\libzip.dll does not exist so it is not being copied. Have you built the libzip.dll ? It does need to be done as a separate step.

Our current build system uses the following commands https://github.com/xamarin/LibZipSharp/blob/master/azure-pipelines.yml#L30 to build the dll. It makes use of the vcpkg project to handle dependencies and uses cmake to handle the build process. So I suspect you will either need to run all those commands to build the dll yourself, or the easier way just grab the native dll from the latest nuget package and place it in the correct location build\Windows\64\lib\libzip.dll. You can probably find the dll in your nuget package cache which is normally in a .nuget directory in you User AppData folder.

I should probably write a helper batch file which will do all those commands like we have to unix based systems to make this easier for contributors. Both @grendello and I work on unix based systems most of the time these days.

@dellis1972
Copy link
Contributor

@Fniz we merged that PR, hopefully you can build the native dll's on windows now.

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

No branches or pull requests

3 participants