Fail softly, notifying user of failure rather than crashing,
This commit is contained in:
parent
e6c6c28f5f
commit
7375e09d19
@ -24,6 +24,7 @@ import android.content.Context;
|
|||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.Signature;
|
import android.content.pm.Signature;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.spongycastle.util.encoders.Hex;
|
import org.spongycastle.util.encoders.Hex;
|
||||||
@ -51,6 +52,12 @@ class ApkSignatureVerifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFDroidSignature(File apkFile) {
|
public boolean hasFDroidSignature(File apkFile) {
|
||||||
|
if (!apkFile.exists()) {
|
||||||
|
Log.e(TAG, "Failed to verify that " + apkFile.getName() + " has F-Droid signature, " +
|
||||||
|
"because " + apkFile.getAbsolutePath() + " does not exist.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
byte[] apkSig = getApkSignature(apkFile);
|
byte[] apkSig = getApkSignature(apkFile);
|
||||||
byte[] fdroidSig = getFDroidSignature();
|
byte[] fdroidSig = getFDroidSignature();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user