We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Unable to get certificates from a jar file

fxp007
fxp007 asked
on
Medium Priority
749 Views
Last Modified: 2012-05-11
I'm trying to get certificates from a apk file, but it always failed with
java.util.zip.ZipException: error in opening zip file
see the jar file in attachment.
JarFile jarFile=new JarFile(new File("1256_exc_1.apk"));
JarEntry je=jarFile.getEntry(AXMLFILE_EXT);
je.getCertificates();

Open in new window

Comment
Watch Question

Author

Commented:
File is here

Author

Commented:
...apk file is not allowed here...link:http://dl.dropbox.com/u/110582/1256_exc_1.apk
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>see the jar file in attachment.

Those are seldom attachable here - hence probably why you haven't posted it. Can you upload it somewhere?

Author

Commented:
CEHJ: uploaded. thanks
CERTIFIED EXPERT
Top Expert 2016

Commented:

Author

Commented:
it works. But I want to get certificates from jarentry.
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Do you mean I should get certificate directly from the certificate file (.rsa), instead of get it with jarentry.getCertificates()? I just want to know why it failed with java's ZipFile? It uses some zip algorithm java doesn't support?
CERTIFIED EXPERT
Top Expert 2016
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
No, the code above has passed thousand times, but failed with several strange apks. thanks anyway. I'll try to get certificates from the rsa file.

Author

Commented:
solved.
Change sun jre to harmony jre.

Author

Commented:
Solved problem by myself
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.