Utils.calcFingerprint() should always return null if given null

#334 https://gitlab.com/fdroid/fdroidclient/issues/334
This commit is contained in:
Hans-Christoph Steiner 2015-08-26 22:42:12 +02:00
parent ee85533aa4
commit 9e939131b7
2 changed files with 4 additions and 4 deletions

View File

@ -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!");

View File

@ -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);
/*