Skip to content Skip to sidebar Skip to footer

How To Calculate Proper Apkcertificatedigestsha256 Having Access To Certificate?

SafetyNet documentation (https://developer.android.com/training/safetynet/attestation) states that field returned in attestation token called apkCertificateDigestSha256 is Base-64

Solution 1:

As by Michael's suggestion in the comments the problem was I was using text representation of the fingerprint instead of binary data. By changing this one detail I managed to get the same results as Google returns.

Solution 2:

You can use this command to easily generate it OSX: keytool -printcert -jarfile ~/PATH_TO/YOURAPKFILE.apk | grep "SHA256: " | cut -d " " -f 3 | xxd -r -p | openssl base64

or if you already have a text representation of SHA256 signature the use this command echo "SHA256_TEXT_REPRESENTATION" | xxd -r -p | openssl base64

xxd does a hex dump of input, basically text to binary

Post a Comment for "How To Calculate Proper Apkcertificatedigestsha256 Having Access To Certificate?"