Fixed check for supported signatures

This commit is contained in:
Kornel committed 2018-09-16 11:19:15 +01:00
1 parent 623b7b6bda
commit d90529ccaa
1 file changed
+12 -13
+12 -13
View File
@@ -33,16 +33,14 @@ func makeAppcast(archivesSourceDir: URL, keys: PrivateKeys, verbose: Bool) throw
for update in allUpdates {
group.enter();
DispatchQueue.global().async {
if update.supportsDSA {
if let privateDSAKey = keys.privateDSAKey {
do {
update.dsaSignature = try dsaSignature(path: update.archivePath, privateDSAKey: privateDSAKey);
} catch {
print(update, error);
}
} else {
print("Note: did not sign with legacy DSA \(update.archivePath.path) because private DSA key file was not specified");
if let privateDSAKey = keys.privateDSAKey {
do {
update.dsaSignature = try dsaSignature(path: update.archivePath, privateDSAKey: privateDSAKey);
} catch {
print(update, error);
}
} else if update.supportsDSA {
print("Note: did not sign with legacy DSA \(update.archivePath.path) because private DSA key file was not specified");
}
if let publicEdKey = update.publicEdKey {
if let privateEdKey = keys.privateEdKey {
@@ -70,9 +68,6 @@ func makeAppcast(archivesSourceDir: URL, keys: PrivateKeys, verbose: Bool) throw
var latestUpdatePerOS:[String:ArchiveItem] = [:];
for update in updates {
if !update.supportsDSA && update.publicEdKey == nil {
continue;
}
// items are ordered starting latest first
let os = update.minimumSystemVersion;
if latestUpdatePerOS[os] == nil {
@@ -88,6 +83,10 @@ func makeAppcast(archivesSourceDir: URL, keys: PrivateKeys, verbose: Bool) throw
if .orderedAscending != comparator.compareVersion(item.version, toVersion: latestItem.version) {
continue;
}
// Old version will not be able to verify the new version
if !item.supportsDSA && item.publicEdKey == nil {
continue;
}
let deltaBaseName = appBaseName + latestItem.version + "-" + item.version;
let deltaPath = archivesSourceDir.appendingPathComponent(deltaBaseName).appendingPathExtension("delta");
@@ -113,7 +112,7 @@ func makeAppcast(archivesSourceDir: URL, keys: PrivateKeys, verbose: Bool) throw
group.enter();
DispatchQueue.global().async {
if latestItem.supportsDSA, let privateDSAKey = keys.privateDSAKey {
if item.supportsDSA, let privateDSAKey = keys.privateDSAKey {
do {
delta.dsaSignature = try dsaSignature(path: deltaPath, privateDSAKey: privateDSAKey);
} catch {