查看APK的签名的方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wed110/article/details/38303637

1、查看 keystore  

$ keytool -list -keystore debug.keystore 

结果:

Keystore type: JKS

Keystore provider: SUN

Your keystore contains 1 entry

androiddebugkey, Mar 21, 2013, PrivateKeyEntry, 

Certificate fingerprint (MD5): E0:F4:90:EE:CD:77:17:0E:B8:C4:AC:64:B2:F6:FC:83

2、查看三方应用或是系统应用签名
用winrar打开待查看的apk,将其中META-INF文件夹解压出来,得到其中的CERT.RSA文件

$ keytool -printcert -file META-INF/CERT.RSA

结果:

Owner: CN=Android Debug, O=Android, C=US

Issuer: CN=Android Debug, O=Android, C=US

Serial number: 514ab2e1

Valid from: Thu Mar 21 15:12:33 CST 2013 until: Sat Mar 14 15:12:33 CST 2043

Certificate fingerprints:

MD5:  E0:F4:90:EE:CD:77:17:0E:B8:C4:AC:64:B2:F6:FC:83

SHA1: 7F:E5:11:D8:37:4F:DA:D7:75:EA:A5:8C:47:06:85:95:6D:1D:3F:2B

Signature algorithm name: SHA1withRSA

Version: 3


3、给空白包签名

jarsigner -verbose -keystore [keystorePath] -signedjar [apkOut] [apkIn] [alias]


jarsigner命令格式:-verbose输出详细信息 -keystore密钥库位置 -signedjar要生成的文件 要签名的文件 密钥库文件

keystorePath参数代表keyStore的绝对路径,如D:\keystore

apkOut参数代表签名后的apk路径,如D:\signed.apk

apkin参数代表在腾讯应用中心下载的未签名apk,默认名称为tap_unsign.apk

alias参数代表签名用的alias名称(创建keyStore时所填写),如timdong


$ jarsigner -verbose -keystore debug.keystore -signedjar test2.apk tap_unsign1.apk timdong

Enter Passphrase for keystore: 

   adding: META-INF/MANIFEST.MF

   adding: META-INF/ANDROIDD.SF

   adding: META-INF/ANDROIDD.RSA

  signing: res/drawable/ic_launcher.png

  signing: res/layout/main.xml

  signing: AndroidManifest.xml

  signing: resources.arsc

  signing: classes.dex


展开阅读全文

没有更多推荐了,返回首页