parent
36c0505115
commit
1771f2ce9f
@ -429,14 +429,14 @@ public class IndexV1Updater extends RepoUpdater {
|
|||||||
String certFromJar = Hasher.hex(rawCertFromJar);
|
String certFromJar = Hasher.hex(rawCertFromJar);
|
||||||
|
|
||||||
if (TextUtils.isEmpty(certFromJar)) {
|
if (TextUtils.isEmpty(certFromJar)) {
|
||||||
throw new SigningException(SIGNED_FILE_NAME + " must have an included signing certificate!");
|
throw new SigningException(repo, SIGNED_FILE_NAME + " must have an included signing certificate!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repo.signingCertificate == null) {
|
if (repo.signingCertificate == null) {
|
||||||
if (repo.fingerprint != null) {
|
if (repo.fingerprint != null) {
|
||||||
String fingerprintFromJar = Utils.calcFingerprint(rawCertFromJar);
|
String fingerprintFromJar = Utils.calcFingerprint(rawCertFromJar);
|
||||||
if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
|
if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
|
||||||
throw new SigningException("Supplied certificate fingerprint does not match!");
|
throw new SigningException(repo, "Supplied certificate fingerprint does not match!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Utils.debugLog(TAG, "Saving new signing certificate to database for " + repo.address);
|
Utils.debugLog(TAG, "Saving new signing certificate to database for " + repo.address);
|
||||||
@ -448,14 +448,14 @@ public class IndexV1Updater extends RepoUpdater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(repo.signingCertificate)) {
|
if (TextUtils.isEmpty(repo.signingCertificate)) {
|
||||||
throw new SigningException("A empty repo signing certificate is invalid!");
|
throw new SigningException(repo, "A empty repo signing certificate is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repo.signingCertificate.equals(certFromJar)) {
|
if (repo.signingCertificate.equals(certFromJar)) {
|
||||||
return; // we have a match!
|
return; // we have a match!
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new SigningException("Signing certificate does not match!");
|
throw new SigningException(repo, "Signing certificate does not match!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,6 +351,10 @@ public class RepoUpdater {
|
|||||||
public SigningException(String message) {
|
public SigningException(String message) {
|
||||||
super("Repository was not signed correctly: " + message);
|
super("Repository was not signed correctly: " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SigningException(Repo repo, String message) {
|
||||||
|
super((repo == null ? "Repository" : repo.name) + " was not signed correctly: " + message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -395,7 +399,7 @@ public class RepoUpdater {
|
|||||||
String fingerprintFromJar = Utils.calcFingerprint(rawCertFromJar);
|
String fingerprintFromJar = Utils.calcFingerprint(rawCertFromJar);
|
||||||
if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromIndexXml)
|
if (!repo.fingerprint.equalsIgnoreCase(fingerprintFromIndexXml)
|
||||||
|| !repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
|
|| !repo.fingerprint.equalsIgnoreCase(fingerprintFromJar)) {
|
||||||
throw new SigningException("Supplied certificate fingerprint does not match!");
|
throw new SigningException(repo, "Supplied certificate fingerprint does not match!");
|
||||||
}
|
}
|
||||||
} // else - no info to check things are valid, so just Trust On First Use
|
} // else - no info to check things are valid, so just Trust On First Use
|
||||||
|
|
||||||
@ -426,7 +430,7 @@ public class RepoUpdater {
|
|||||||
if (TextUtils.isEmpty(repo.signingCertificate)
|
if (TextUtils.isEmpty(repo.signingCertificate)
|
||||||
|| TextUtils.isEmpty(certFromJar)
|
|| TextUtils.isEmpty(certFromJar)
|
||||||
|| TextUtils.isEmpty(certFromIndexXml)) {
|
|| TextUtils.isEmpty(certFromIndexXml)) {
|
||||||
throw new SigningException("A empty repo or signing certificate is invalid!");
|
throw new SigningException(repo, "A empty repo or signing certificate is invalid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// though its called repo.signingCertificate, its actually a X509 certificate
|
// though its called repo.signingCertificate, its actually a X509 certificate
|
||||||
@ -435,7 +439,7 @@ public class RepoUpdater {
|
|||||||
&& certFromIndexXml.equals(certFromJar)) {
|
&& certFromIndexXml.equals(certFromJar)) {
|
||||||
return; // we have a match!
|
return; // we have a match!
|
||||||
}
|
}
|
||||||
throw new SigningException("Signing certificate does not match!");
|
throw new SigningException(repo, "Signing certificate does not match!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user