如何验证 Android apk 是否使用发布证书进行签名?
如何检查 Android apk 是否使用版本签名而不是调试证书?
How can I check that an Android apk is signed with a release and not debug cert?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
使用此命令,(在cmd提示符下转到java < jdk < bin路径)
如果您看到“CN=Android Debug”,这意味着.apk是使用Android SDK生成的调试密钥进行签名的
(意味着它是未签名的),否则你会发现CN的东西。
有关更多详细信息,请参阅:http://developer.android.com/guide/publishing/app-signing.html
Use this command, (go to java < jdk < bin path in cmd prompt)
If you see "CN=Android Debug", this means the .apk was signed with the debug key generated by the Android SDK
(means it is unsigned), otherwise you will find something for CN.
For more details see: http://developer.android.com/guide/publishing/app-signing.html
使用控制台命令:
apksigner verify --print-certs application-development-release.apk
您可以在../sdk/build-tools/24.0.3/apksigner.bat中找到apksigner。仅适用于构建工具 v. 24.0.3 及更高版本。
另请阅读谷歌文档: https://developer.android.com/studio/command-行/apksigner.html
Use console command:
apksigner verify --print-certs application-development-release.apk
You could find apksigner in ../sdk/build-tools/24.0.3/apksigner.bat. Only for build tools v. 24.0.3 and higher.
Also read google docs: https://developer.android.com/studio/command-line/apksigner.html
最简单的:
这使用 Java 内置 keytool 应用程序,不需要提取或安装任何构建工具。
The easiest of all:
This uses the Java built-in keytool app and does not require extraction or any build-tools installation.
使用此命令:(Jarsigner 位于您的 Java bin 文件夹中,在 cmd 提示符下转到 java->jdk->bin 路径)
如果 .apk 已正确签名,Jarsigner 会打印“jar verify”
Use this command : (Jarsigner is in your Java bin folder goto java->jdk->bin path in cmd prompt)
If the .apk is signed properly, Jarsigner prints "jar verified"
在终端中运行此命令 - 如果您有 Android Studio。
Run this command in Terminal - if you have Android Studio.
使用
keytool
或jarsigner
可能不适合您。您需要首先了解签名的工作原理。 请参阅此处。如果您的最小 API 低于 24,v1 签名将包含在 apk 中(在
META_INF
内)。正因为如此,这两个工具将“抛出”您的证书密钥。如果使用最低 API 24 或更高版本,则将排除 v1 签名(除非您在
build.gradle
中自行启用它)。在这种情况下,keytool
或jarsigner
不起作用。他们将输出Not asigned jar file
或jar is unsigned
。要验证 v2+ 签名,您应该使用apksigner
代替。Using
keytool
orjarsigner
may not work for you. You need to first understand how signing works. See here.If your min API is lower than 24, v1 signing will be included in apk (inside
META_INF
). And because of that, these two tools will "poop out" your cert keys.If using min API 24 or higher, v1 signing will be excluded (unless you enable it on your own in
build.gradle
). In this casekeytool
orjarsigner
don't work. They will outputNot a signed jar file
orjar is unsigned
. To verify v2+ signature, you should useapksigner
instead.keytool -printcert -file ANDROID_.RSA 或 keytool -list -printcert -jarfile app.apk
获取哈希 md5keytool -list -v -keystore clave-release.jks
https ://www.eovao.com/en/a/signature%20apk%20android/3/how-to-verify-signature-of-.apk-android-archive
keytool -printcert -file ANDROID_.RSA or keytool -list -printcert -jarfile app.apk
to obtain the hash md5keytool -list -v -keystore clave-release.jks
https://www.eovao.com/en/a/signature%20apk%20android/3/how-to-verify-signature-of-.apk-android-archive
对于 macOS 用户:
根据计算机上安装的内容更改构建工具版本。
For macOS users:
Change build-tools version based on what is installed on your machine.