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

Wrong Local header signature: 0xFF8 #20

Open
siddharthashw opened this issue Sep 14, 2018 · 7 comments
Open

Wrong Local header signature: 0xFF8 #20

siddharthashw opened this issue Sep 14, 2018 · 7 comments

Comments

@siddharthashw
Copy link

I have just follow this page.

And while at run-time, I am getting this error. Wrong Local header signature: 0xFF8

My basic aim is to read basic information(like version, logo, name) of .apk file.

Need help ASAP

@forlayo
Copy link

forlayo commented Nov 13, 2018

Same here

@forlayo
Copy link

forlayo commented Nov 16, 2018

I found a solution, while iterating through the elements of the ZIP, instead of getting the stream in current way then do this for iterate:
foreach (ZipEntry entry in zip)

And this to access the stream:
zipInput.GetInputStream(entry);

I think while iterating through stream this is failing as Android v2 signature scheme is adding "APK Signing Block" just before of "Central Directory" part of the zip. And I think zip library can't manage this.

In fact, don't try to modify the original zip file and create a new copy of it. As the "Central Directory" management gets crazy and few files are lost.

I hope this would help someone.

@GabeBigBoxVR
Copy link

Worked for me as well, thx.

@FransHk
Copy link

FransHk commented Aug 20, 2020

For anyone interested, here's a snippet of code that fixed my issue (thanks @forlayo for the solution)

foreach(ICSharpCode.SharpZipLib.Zip.ZipEntry entry in zipfile)
                        {
                            if(entry != null)
                            {
                                if(entry.Name.ToLower() == "androidmanifest.xml")
                                {
                                    manifestData = new byte[50 * 1024];
                                    Stream strm = zipfile.GetInputStream(entry);
                                    strm.Read(manifestData, 0, manifestData.Length);
                                }
                                if(entry.Name.ToLower() == "resources.arsc")
                                {
                                    Stream strm = zipfile.GetInputStream(entry);
                                    using (BinaryReader s = new BinaryReader(strm))
                                    {
                                        resourcesData = s.ReadBytes((int)entry.Size);
                                    }
                                }
                            }
                        }

@GoodTimeGGB
Copy link

If the APK package name contains Chinese, the program will become very slow.

@wz172
Copy link

wz172 commented Oct 29, 2022

good !
Although it can handle reads without errors, it is not successful when parsing xml

manifestXml = manifest.ReadManifestFileIntoXml(manifest_xml);

@OneFreeCoder
Copy link

good,Worked for me as well, thx.

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

No branches or pull requests

7 participants