如何生成apk的签名key文件 1 2 3 4 5 6 7 # 建key方法: sub='/C=CN/ST=ShangHai/L=ShangHai/O=example/OU=CM/CN=example/emailAddress=test@example.com' for key in platform shared media testkey;do ./development/tools/make_key $key "$sub" done
怎么给某个apk重签名 命令如下:
1 java -Xmx2048m -jar signapk.jar xxx.x509.pem xxx.pk8 unsigned.apk signed.apk
pem和pk8文件 ,对于是userdebug、eng 这些使用的 是代码里面的key文件。可以在build/target/product/security这个路径下面得到。
如何获取签名key的sha1值 解压apk文件得到RSA文件
APK以zip文件方式打开,在\META-INF\目录中存在一个.RSA后缀的文件,一般名为CERT.RSA
使用keytool命令获取证书信息(包括MD5)
运行如下keytool命令即可: keytool -printcert -file CERT.RSA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 keytool -printcert -file CERT.RSA Owner: EMAILADDRESS=test@example.com, CN=example, OU=CM, O=example, L=ShangHai, ST=ShangHai, C=CN Issuer: EMAILADDRESS=test@example.com, CN=example, OU=CM, O=example, L=ShangHai, ST=ShangHai, C=CN Serial number: f03839c4296d10e2 Valid from: Tue Nov 22 14:21:36 CST 2016 until: Sat Apr 09 14:21:36 CST 2044 Certificate fingerprints: MD5: B5:A2:01:A5:8D:54:CF:BE:ED:85:20:B6:5D:81:37:B0 SHA1: 44:1C:6D:43:17:06:FC:95:17:6E:B8:39:CF:A7:B7:E7:5E:C4:C1:AC SHA256: 97:12:E0:92:B0:23:CE:F9:82:E4:92:EA:08:E8:7E:42:D0:90:75:D4:B1:34:FD:41:A3:63:03:DA:AE:EB:74:DA Signature algorithm name: SHA1withRSA Version: 3 Extensions: #1: ObjectId: 2.5.29.35 Criticality=false AuthorityKeyIdentifier [ KeyIdentifier [ 0000: 08 79 56 A2 9D B2 49 28 36 01 47 E5 1C 6C 3F 9E .yV...I(6.G..l?. 0010: 12 40 9B 38 .@.8 ] ] #2: ObjectId: 2.5.29.19 Criticality=false BasicConstraints:[ CA:true PathLen:2147483647 ] #3: ObjectId: 2.5.29.14 Criticality=false SubjectKeyIdentifier [ KeyIdentifier [ 0000: 08 79 56 A2 9D B2 49 28 36 01 47 E5 1C 6C 3F 9E .yV...I(6.G..l?. 0010: 12 40 9B 38 .@.8 ] ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 openssl x509 -noout -fingerprint -sha1 -inform pem -in releasekey.x509.pem skywalker_key/media.x509.pem SHA1 Fingerprint=CA:F2:2F:6D:6D:73:78:88:79:73:53:AC:C7:09:A5:52:2A:E8:72:BB skywalker_key/platform.x509.pem SHA1 Fingerprint=10:DA:2B:17:F2:24:11:73:0D:81:8D:30:CC:6B:FA:84:91:14:C5:02 skywalker_key/releasekey.x509.pem SHA1 Fingerprint=02:E5:16:F0:4C:23:44:48:69:7C:CE:FE:E9:DE:56:B5:52:22:05:FD skywalker_key/shared.x509.pem SHA1 Fingerprint=6F:BA:6E:57:7A:6B:27:A7:44:FD:52:6A:49:3B:8F:53:DB:89:3E:C2 skywalker_key/testkey.x509.pem SHA1 Fingerprint=63:DA:82:5E:54:1D:82:ED:6D:68:7F:64:66:33:C8:A6:48:15:13:6C 你们可以自己解压 ota包的./META-INF/com/android/otacert文件出来 验证看看. 执行命令 keytool --printcert -file ./META-INF/com/android/otacert |grep SHA1
怎么制作ota差分包 ota全包升级方法:
把全包ota的zip文件 adb push 到手机的/sdcard/ 下面 然后改名为update.zip. adb reboot recovery,手机会进入到一个界面,点击升级按钮就可以了。
怎么做差分包
基本命令如下:
1 python Bins/releasetools/ota_from_target_files -v -p Bins/linux-x86 -k releasekey -i old.zip new.zip update.zip
-p Bins/linux-x86 这里的-p参数指定了一下imgdiff,bsdiff 工具的路径的,这个没有的话在做差分包时候会报错的。
制作差分包需要很多工具和so文件,这些都可以在android源码编译环境下面获取到,一般在out 下 host 下面有。linux系统就选择 linux-x86那个目录。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 # 这个是和制作ota差分包相关的一些文件,没有这些文件是无法成功做差分包的 src:build/tools/releasetools/blockimgdiff.py: src:build/tools/releasetools/build_image.py: src:build/tools/releasetools/rangelib.py: src:build/tools/releasetools/sparse_img.py: src:build/tools/releasetools/ota_from_target_files: src:build/tools/releasetools/add_img_to_target_files.py: src:build/tools/releasetools/edify_generator.py: src:build/tools/releasetools/common.py: out:../../../host/linux-x86/bin/bsdiff: out:../../../host/linux-x86/bin/imgdiff: out:../../../host/linux-x86/bin/simg2img: out:../../../host/linux-x86/bin/make_ext4fs: out:../../../host/linux-x86/bin/mkuserimg.sh: out:../../../host/linux-x86/bin/e2fsck: out:../../../host/linux-x86/bin/brillo_update_payload: out:../../../host/linux-x86/bin/delta_generator: out:../../../host/linux-x86/bin/lib/shflags/shflags: out:../../../host/linux-x86/framework/signapk.jar: out:../../../host/linux-x86/lib64/libc++.so: out:../../../host/linux-x86/lib64/libconscrypt_openjdk_jni.so: out:../../../host/linux-x86/lib64/libdivsufsort64.so: out:../../../host/linux-x86/lib64/libdivsufsort.so: out:../../../host/linux-x86/lib64/libcutils.so: out:../../../host/linux-x86/lib64/libselinux.so: out:../../../host/linux-x86/lib64/liblog.so: out:../../../host/linux-x86/lib64/libext2fs-host.so: out:../../../host/linux-x86/lib64/libext2_blkid-host.so: out:../../../host/linux-x86/lib64/libext2_uuid-host.so: out:../../../host/linux-x86/lib64/libext2_profile-host.so: out:../../../host/linux-x86/lib64/libext2_quota-host.so: out:../../../host/linux-x86/lib64/libext2_com_err-host.so: out:../../../host/linux-x86/lib64/libext2_e2p-host.so: out:../../../host/linux-x86/lib64/libbase.so: out:../../../host/linux-x86/lib64/libbrillo.so: out:../../../host/linux-x86/lib64/libbrillo-stream.so: out:../../../host/linux-x86/lib64/libchrome.so: out:../../../host/linux-x86/lib64/libcrypto-host.so: out:../../../host/linux-x86/lib64/libevent-host.so: out:../../../host/linux-x86/lib64/libprotobuf-cpp-lite.so: out:../../../host/linux-x86/lib64/libselinux.so: out:../../../host/linux-x86/lib64/libsparse-host.so: out:../../../host/linux-x86/lib64/libssl-host.so: out:../../../host/linux-x86/lib64/libz-host.so: