Given that we have an APK file, accessible on an Android device on the filesystem, how can we, from another Android app:
Confirm that the APK file has not been tampered with (that its digital signature matches its contents)?
Get the public key information (specifically, the same sort of SHA256 hash that
keytool -list -printcert -jarfile test.apk
would emit on a development machine)?
Note that this APK has not been installed at this point, so we cannot use PackageManager
to retrieve the "signatures" of the installed app, nor can we rely on Android having validated the APK signature for us.