自检APK的签名 [英] Self-checking an APK's signature
本文介绍了自检APK的签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在运行时以编程方式检查 APK 的签名.我在我的开发工作站上拥有一个密钥库,所以我可以知道(不知道如何)我用来签署 APK 的公钥.
I would like to programmatically perform a check on the APK's signature at runtime. I own a keystore on my development workstation, so I could know (dunno how) the public key I'm signing an APK with.
一旦知道标牌后的公钥是什么,我想放入源代码并检查当前运行的应用程序是否与密钥匹配.
Once I know what the public key will be after signage, I would like to put in the source code and check if the currently running application matches the key.
有可能吗?如果是这样,我如何从 Eclipse 生成的密钥库中获取公钥?
Is it possible? If so, how do I obtain the public key from an Eclipse-generated keystore?
谢谢.
推荐答案
你可以试试这个,应该可以
You could try this, it should work
Signature[] sigs = getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES).signatures;
for (Signature sig : sigs)
{
// log the sig here
}
这篇关于自检APK的签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文