Unable to get certificates from a jar file

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

fxp007Asked:
Who is Participating?
 
CEHJCommented:
Which one is a certificate here?
META-INF/MANIFEST.MF
META-INF/NQCM.SF
META-INF/NQCM.RSA
lib/armeabi/libNqCrypto.so
lib/armeabi/libSMSFilter.so
res/color/small_text_color.xml
res/color/tab_indicator_text.xml
res/drawable/btn_back.png
res/drawable/btn_check_off.png
res/drawable/btn_check_on.png
res/drawable/btn_flicker_minus.png
res/drawable/btn_flicker_plus.png
res/drawable/btn_next.png
res/drawable/call.png
res/drawable/circle_white.png
res/drawable/clearall.png
res/drawable/cmcc_calllog_callin.png
res/drawable/cmcc_calllog_misscall.png
res/drawable/cmcc_calllog_outgoing.png
res/drawable/contact_add.png
res/drawable/contact_network_guide.xml
res/drawable/create_account.png
res/drawable/delete.png
res/drawable/divider.png
res/drawable/divider_vertical_bright.png
res/drawable/exit_private.png
res/drawable/ic_dialog_time.png
res/drawable/ic_menu_add.png
res/drawable/ic_sms_delivered.png
res/drawable/ic_sms_not_delivered.png
res/drawable/ic_sms_unread_msg_indicator.png
res/drawable/icon.png
res/drawable/im_logo.png
res/drawable/import_select.png
res/drawable/line_horz.png
res/drawable/list_divider.png
res/drawable/list_selector_background.xml
res/drawable/list_selector_background_disabled.9.png
res/drawable/list_selector_background_focus.9.png
res/drawable/list_selector_background_longpress.9.png
res/drawable/list_selector_background_pressed.9.png
res/drawable/list_selector_background_transition.xml
res/drawable/main_background.png
res/drawable/main_background_color.xml
res/drawable/main_list_blackwhite.png
res/drawable/main_list_call.png
res/drawable/main_list_divider.png
res/drawable/main_list_group.png
res/drawable/main_list_ip.png
res/drawable/main_list_query.png
res/drawable/main_list_scene.png
res/drawable/main_list_sms.png
res/drawable/main_list_synchronize_contact.png
res/drawable/menu_about.png
res/drawable/menu_account.png
res/drawable/menu_help.png
res/drawable/menu_ok.png
res/drawable/menu_policy_update.png
res/drawable/menu_private.png
res/drawable/menu_recommend.png
res/drawable/menu_restore.png
res/drawable/menu_right.png
res/drawable/menu_software_update.png
res/drawable/my_manager_infor.9.png
res/drawable/netqinlogo.png
res/drawable/netqintext.png
res/drawable/orange_background.xml
res/drawable/private_space.png
res/drawable/restore_sms.png
res/drawable/selectall.png
res/drawable/separator_green.png
res/drawable/shape.xml
res/drawable/sym_action_call.png
res/drawable/sym_action_sms.png
res/drawable/tab_black.png
res/drawable/tab_black_unselect.png
res/drawable/tab_blacklist.png
res/drawable/tab_blacklist_unselect.png
res/drawable/tab_bottom_left.xml
res/drawable/tab_bottom_right.xml
res/drawable/tab_focus.9.png
res/drawable/tab_focus_bar_left.9.png
res/drawable/tab_focus_bar_right.9.png
res/drawable/tab_indicator.xml
res/drawable/tab_my_netqin.png
res/drawable/tab_my_netqin_unselect.png
res/drawable/tab_mymanager.png
res/drawable/tab_mymanager_unselect.png
res/drawable/tab_press.9.png
res/drawable/tab_press_bar_left.9.png
res/drawable/tab_press_bar_right.9.png
res/drawable/tab_private_call.png
res/drawable/tab_private_call_unselect.png
res/drawable/tab_private_sms.png
res/drawable/tab_private_sms_unselect.png
res/drawable/tab_selected.9.png
res/drawable/tab_selected_bar_left.9.png
res/drawable/tab_selected_bar_right.9.png
res/drawable/tab_set.png
res/drawable/tab_set_unselect.png
res/drawable/tab_unselected.9.png
res/drawable/tab_white.png
res/drawable/tab_white_unselect.png
res/drawable/timepicker_down_normal.9.png
res/drawable/timepicker_input_normal.9.png
res/drawable/timepicker_up_normal.9.png
res/drawable/titlebar.png
res/drawable/tixingback.png
res/drawable/toast.png
res/drawable/toast_frame.9.png
res/drawable/top_status_background.png
res/layout/add_contact.xml
res/layout/antivirus_splash.xml
res/layout/checktextview.xml
res/layout/contact_account_change.xml
res/layout/contact_account_complete.xml
res/layout/contact_account_login.xml
res/layout/contact_account_switch.xml
res/layout/contact_backup_network_guide.xml
res/layout/contact_first_guide.xml
res/layout/contact_list_with_button.xml
res/layout/contact_network_create.xml
res/layout/contact_network_guide.xml
res/layout/contact_network_user.xml
res/layout/contact_network_usrex.xml
res/layout/contactlist.xml
res/layout/contactlist_item.xml
res/layout/custom_title_1.xml
res/layout/dialog_activity.xml
res/layout/dialog_scroll.xml
res/layout/disclaimer.xml
res/layout/driving_mode_checkbox_item.xml
res/layout/driving_mode_textview_item.xml
res/layout/friend_recommend.xml
res/layout/import_sms_item.xml
res/layout/list_and_text.xml
res/layout/list_item.xml
res/layout/list_item_double_line.xml
res/layout/list_item_withicon.xml
res/layout/list_item_withicon_check.xml
res/layout/list_with_double_button_at_bottom.xml
res/layout/list_with_triple_button_at_bottom.xml
res/layout/listview_with_text_add.xml
res/layout/log.xml
res/layout/main_list_item.xml
res/layout/main_tab.xml
res/layout/modify_name.xml
res/layout/multi_choice_preference.xml
res/layout/my_edit.xml
res/layout/my_manager.xml
res/layout/my_manager_driving_mode_item.xml
res/layout/new_ip_prefix.xml
res/layout/number_edit.xml
res/layout/owner_citycode_query.xml
res/layout/owner_main_list.xml
res/layout/owner_query_list.xml
res/layout/owner_query_list_item.xml
res/layout/owner_toast.xml
res/layout/password_modify.xml
res/layout/preference.xml
res/layout/preference_category.xml
res/layout/private_contact_listitem.xml
res/layout/private_password.xml
res/layout/progress_text.xml
res/layout/recommend_item.xml
res/layout/scene_list_item.xml
res/layout/select_time.xml
res/layout/setting_item.xml
res/layout/settings.xml
res/layout/simple_list_item_1.xml
res/layout/single_textview.xml
res/layout/sms_item.xml
res/layout/sms_reply.xml
res/layout/sms_reply_item.xml
res/layout/tab_indicator.xml
res/layout/top_double_button.xml
res/layout/two_line.xml
res/layout/update_progress.xml
res/layout/user_type.xml
res/raw/dirty.dat
res/raw/exception.dat
res/raw/general.dat
res/raw/init.dat
res/raw/lowpri.dat
res/raw/nqcm.htm
res/raw/privacy_protect_statement.htm
res/raw/pub.txt
res/raw/regins.db
res/raw/special.dat
AndroidManifest.xml
classes.dex
resources.arsc

Open in new window

0
 
fxp007Author Commented:
File is here
0
 
fxp007Author Commented:
...apk file is not allowed here...link:http://dl.dropbox.com/u/110582/1256_exc_1.apk
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
CEHJCommented:
>>see the jar file in attachment.

Those are seldom attachable here - hence probably why you haven't posted it. Can you upload it somewhere?
0
 
fxp007Author Commented:
CEHJ: uploaded. thanks
0
 
CEHJCommented:
0
 
fxp007Author Commented:
it works. But I want to get certificates from jarentry.
0
 
fxp007Author 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?
0
 
CEHJCommented:
I'd guess the apk file is a zip file, but not a jar file
0
 
fxp007Author 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.
0
 
fxp007Author Commented:
solved.
Change sun jre to harmony jre.
0
 
fxp007Author Commented:
Solved problem by myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.