How do I get the signature checksum of my APK signed with only v2 schema?

I previously asked a question on how to get the signature checksum of my APK here: How to get the signature checksum of my APK?

The answer is fine if the application is signed with v1 signature scheme or v1 / v2 combinational schemes. (Jar and Full APK Signatures)

However, since my application will only run on Android O or higher (this is a device specific application), I will only sign it using the APK v2 signature scheme (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 NFC key / value pair providing the device owner app?

+3


source to share


1 answer


To build an example How do I get the signature checksum of my APK? , you mentioned:

apksigner verify -print-certs [path to your apk] | grep -Po "(?<=SHA-256 digest:) .*" | xxd -r -p | openssl base64 | tr -d '=' | tr -- '+/=' '-_'`

      



The "signature checksum" you link to is the database-safe SHA-256 encoded Base64 of the APK certification certificate. apksigner verify --print-certs

prints various digests of APK signing certificates, whether the APK is JAR signed, the APK v2 signed subscription scheme, or both.

apksigner

distributed via Android SDK Build Tools 24.0.3

and newer (except 26.0.0

which is accidentally missing apksigner

). https://developer.android.com/studio/command-line/apksigner.html

+3


source







All Articles