查看apk签名信息方法
程序员文章站
2023-12-03 14:20:28
用shell写了一个查看apk签名的脚本。代码很少也很简单 复制代码 代码如下: #!/bin/bash mkdir .temp_for_certificate cd .t...
用shell写了一个查看apk签名的脚本。代码很少也很简单
#!/bin/bash
mkdir .temp_for_certificate
cd .temp_for_certificate
count=0
while [ -n "$1" ]
do
count=$[$count+1]
echo "(#$count) "`basename "$1"`":"
echo ""
path=`jar tf "$1" | grep rsa` #查找apk中rsa文件
jar xf $1 $path #把rsa文件解压出来
keytool -printcert -file $path #查看指纹证书
rm -r $path #删除之前解压的文件
echo "--------------------------------------------"
shift
done
cd ..
rm -r .temp_for_certificate
(将其保存到文件,命名为getcertificate)
使用方法:
getcertificate superuser.apk skype3.0.apk
输出:
(#1) superuser.apk:
所有者:cn=adam shanks, ou=android, o=soupcoconut, l=fwb, st=florida, c=us
签发人:cn=adam shanks, ou=android, o=soupcoconut, l=fwb, st=florida, c=us
序列号:4c614057
有效期: tue aug 10 20:04:39 cst 2010 至sat dec 26 20:04:39 cst 2037
证书指纹:
md5:d2:42:30:aa:be:81:62:30:fe:b4:0e:f1:cf:11:b0:c0
sha1:5f:11:3f:c2:c2:0a:7c:9b:d9:28:19:22:6a:32:a1:90:4b:75:ef:8b
签名算法名称:sha1withrsa
版本: 3
--------------------------------------------
(#2) skype3.0.apk:
所有者:cn=skype, ou=mobile client, o=skype, l=london, c=gb
签发人:cn=skype, ou=mobile client, o=skype, l=london, c=gb
序列号:4c0e1962
有效期: tue jun 08 18:20:18 cst 2010 至fri jul 20 18:20:18 cst 2040
证书指纹:
md5:37:5f:1a:56:c5:2a:51:ff:35:f3:6c:c5:a6:69:54:ec
sha1:77:18:07:d1:b8:41:4d:69:89:e7:d8:ef:0b:97:97:24:3b:93:1f:95
签名算法名称:sha1withrsa
版本: 3
--------------------------------------------
查看签名也可以使用jarsigner
jarsigner -verify -verbose -certs superuser.apk
jarsigner详细用法详见帮助
复制代码 代码如下:
#!/bin/bash
mkdir .temp_for_certificate
cd .temp_for_certificate
count=0
while [ -n "$1" ]
do
count=$[$count+1]
echo "(#$count) "`basename "$1"`":"
echo ""
path=`jar tf "$1" | grep rsa` #查找apk中rsa文件
jar xf $1 $path #把rsa文件解压出来
keytool -printcert -file $path #查看指纹证书
rm -r $path #删除之前解压的文件
echo "--------------------------------------------"
shift
done
cd ..
rm -r .temp_for_certificate
(将其保存到文件,命名为getcertificate)
使用方法:
复制代码 代码如下:
getcertificate superuser.apk skype3.0.apk
输出:
复制代码 代码如下:
(#1) superuser.apk:
所有者:cn=adam shanks, ou=android, o=soupcoconut, l=fwb, st=florida, c=us
签发人:cn=adam shanks, ou=android, o=soupcoconut, l=fwb, st=florida, c=us
序列号:4c614057
有效期: tue aug 10 20:04:39 cst 2010 至sat dec 26 20:04:39 cst 2037
证书指纹:
md5:d2:42:30:aa:be:81:62:30:fe:b4:0e:f1:cf:11:b0:c0
sha1:5f:11:3f:c2:c2:0a:7c:9b:d9:28:19:22:6a:32:a1:90:4b:75:ef:8b
签名算法名称:sha1withrsa
版本: 3
--------------------------------------------
(#2) skype3.0.apk:
所有者:cn=skype, ou=mobile client, o=skype, l=london, c=gb
签发人:cn=skype, ou=mobile client, o=skype, l=london, c=gb
序列号:4c0e1962
有效期: tue jun 08 18:20:18 cst 2010 至fri jul 20 18:20:18 cst 2040
证书指纹:
md5:37:5f:1a:56:c5:2a:51:ff:35:f3:6c:c5:a6:69:54:ec
sha1:77:18:07:d1:b8:41:4d:69:89:e7:d8:ef:0b:97:97:24:3b:93:1f:95
签名算法名称:sha1withrsa
版本: 3
--------------------------------------------
查看签名也可以使用jarsigner
复制代码 代码如下:
jarsigner -verify -verbose -certs superuser.apk
jarsigner详细用法详见帮助