How do I get the signature checksum of my APK?
I would like to use the signature checksum instead of the batch checksum when setting up a device with a device owner app. The application will be downloaded from the http server.
This post is great for using EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM: Checksum error while configuring Android Lollipop
But I would like to use EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM. See: https://developer.android.com/reference/android/app/admin/DevicePolicyManager.htm
Provisioning app and device owner app will run on Android O.
How do I get the signature checksum of my app that I can use on my NFC key / value pair?
+1
source to share
1 answer
try it
keytool -list -printcert -jarfile [path_to_your_apk] | grep -Po "(?<=SHA256:) .*" | xxd -r -p | openssl base64 | tr -d '=' | tr -- '+/=' '-_'
More details:
-
keytool -list -printcert -jarfile [path_to_your_apk]
retrieves information about the APK certificate, -
grep -Po "(?<=SHA256:) .*" | xxd -r -p
takes a SHA256 hash and converts it to binary, -
openssl base64
encodes it using base64, -
tr -d '=' | tr -- '+/=' '-_'
makes it URL safe (+
encoded as-
,/
encoded as_
, and whitespace=
removed).
+3
source to share