如何获取仅使用v2方案签名的APK的签名校验和? [英] How do I get the signature checksum of my APK that is signed with only the v2 scheme?
问题描述
我之前在此处发布了一个有关如何获取我的APK签名校验和的问题: 如何获取APK的签名校验和?
如果应用是使用v1签名方案或v1/v2组合签名方案签名的,则答案是完美的. (Jar和Full APK签名)
但是,由于我的应用只能在Android O或更高版本(它是特定于设备的应用)上运行,因此我将仅使用APK签名方案v2(v2方案)对其进行签名.
我将使用EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM.请参阅: https://developer.android.com/reference/android/app/admin/DevicePolicyManager.html 了解详情.
如何获取我的应用程序的APK(v2)签名校验和,我可以在键/值对中使用该校验和来进行NFC设置设备所有者应用程序?
以示例为基础 您所指的签名校验和"是APK签名证书的URL安全Base64编码的SHA-256摘要. I previously posted a question on how to get the signature checksum of my APK here:
How do I get the signature checksum of my APK? The answer is perfect if an app is signed with the v1 signature scheme or the combination v1/v2 signature schemes. (Jar and Full APK Signatures) However, since my app will only be running on Android O or greater (it is a device specific app), I will only be signing it with the APK signature scheme v2 (v2 scheme). I will be using EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM. See: https://developer.android.com/reference/android/app/admin/DevicePolicyManager.html for details. How do I get the APK (v2) signature checksum of my app that I can use in my key/value pair for NFC provisioning a device owner app? To build on the example How do I get the signature checksum of my APK? you mentioned: The "signature checksum" you're referring to is the URL-safe Base64 encoded SHA-256 digest of the APK's signing cert. 这篇关于如何获取仅使用v2方案签名的APK的签名校验和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!apksigner verify --print-certs
打印APK签名证书的各种摘要,而不管APK是否为JAR签名,APK签名方案v2签名或两者.
apksigner
是通过Android SDK生成工具24.0.3
和更高版本分发的(26.0.0
意外丢失了apksigner
). https://developer.android.com/studio/command-line/apksigner. html apksigner verify -print-certs [path to your apk] | grep -Po "(?<=SHA-256 digest:) .*" | xxd -r -p | openssl base64 | tr -d '=' | tr -- '+/=' '-_'
apksigner verify --print-certs
prints the various digests of the APK's signing certs, regardless of whether the APK is JAR signed, APK Signature Scheme v2-signed, or both.apksigner
is distributed via Android SDK Build Tools 24.0.3
and newer (except for 26.0.0
which is accidentally missing apksigner
). https://developer.android.com/studio/command-line/apksigner.html