由于分析破解需要获取使用testkey签名的apk的sha1,很多网上的教程都是从keystore来获取,虽然可以从pk8.pem转成keystore,但是比较麻烦,后来找到一个这样的方法可以实现:
把apk用zip打开,把META-INF目录下的rsa后缀名的文件解压出来,命名为cert.rsa,这个文件其实就是签名的公钥,执行如下命令
keytool -printcert -file CERT.RSA
会输出如下信息,里面包含了sha1:
所有者: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
发布者: [email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
序列号: 936eacbe07f201df
有效期开始日期: Fri Feb 29 09:33:46 CST 2008, 截止日期: Tue Jul 17 09:33:46 CST 2035证书指纹:
MD5: E8:9B:15:8E:4B:CF:98:8E:BD:09:EB:83:F5:37:8E:87
SHA1: 61:ED:37:7E:85:D3:86:A8:DF:EE:6B:86:4B:D8:5B:0B:FA:A5:AF:81
SHA256: A4:0D:A8:0A:59:D1:70:CA:A9:50:CF:15:C1:8C:45:4D:47:A3:9B:26:98:9D:8B:64:0E:CD:74:5B:A7:1B:F5:DC
签名算法名称: SHA1withRSA
版本: 3
扩展:
#1: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 48 59 00 56 3D 27 2C 46 AE 11 86 05 A4 74 19 AC HY.V=',F.....t..
0010: 09 CA 8C 11 ....
]
[[email protected], CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US]
SerialNumber: [ 936eacbe 07f201df]
]
#2: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
CA:true
PathLen:2147483647
]
#3: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 48 59 00 56 3D 27 2C 46 AE 11 86 05 A4 74 19 AC HY.V=',F.....t..
0010: 09 CA 8C 11 ....
]
]