为什么jarsigner可以签署安卓apk?

时间:2016-02-29 18:20:35

标签: java android

根据我在Java方面的经验,jarsigner用于为JAVA ARchive(JAR)文件生成签名,并验证签名JAR文件的签名。

令我惊讶的是,Android也使用jarsignersign the Android application package(APK),这与JAR格式不同。

jarsigner是否不要求将二进制文件打包在JAR中?它是如何在引擎盖下工作的?

1 个答案:

答案 0 :(得分:4)

APK文件只是具有不同内容的zip文件。

Is there a difference between typical a ZIP file and an APK file?

来自http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jarsigner.html

The JAR feature enables the packaging of class files, images, sounds, and
other digital data in a single file for faster and easier distribution. A tool
named jar enables developers to produce JAR files. 

(Technically, any zip file can also be considered a JAR file, although when 
created by the jar command or processed by the jarsigner command, JAR files
also contain a META-INF/MANIFEST.MF file.)