Utils.calcFingerprint() should always return null if given null
#334 https://gitlab.com/fdroid/fdroidclient/issues/334
This commit is contained in:
parent
ee85533aa4
commit
9e939131b7
@ -339,6 +339,8 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static String calcFingerprint(Certificate cert) {
|
||||
if (cert == null)
|
||||
return null;
|
||||
try {
|
||||
return calcFingerprint(cert.getEncoded());
|
||||
} catch (CertificateEncodingException e) {
|
||||
@ -347,6 +349,8 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static String calcFingerprint(byte[] key) {
|
||||
if (key == null)
|
||||
return null;
|
||||
String ret = null;
|
||||
if (key.length < 256) {
|
||||
Log.e(TAG, "key was shorter than 256 bytes (" + key.length + "), cannot be valid!");
|
||||
|
@ -123,10 +123,6 @@ public class WifiStateChangeService extends Service {
|
||||
// the fingerprint for the local repo's signing key
|
||||
LocalRepoKeyStore localRepoKeyStore = LocalRepoKeyStore.get(context);
|
||||
Certificate localCert = localRepoKeyStore.getCertificate();
|
||||
// We were not able to generate/get a certificate
|
||||
if (localCert == null) {
|
||||
return null;
|
||||
}
|
||||
FDroidApp.repo.fingerprint = Utils.calcFingerprint(localCert);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user