From d90529ccaa65d68e142db66b24ff6572330402ae Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 16 Sep 2018 11:19:15 +0100 Subject: [PATCH] Fixed check for supported signatures --- generate_appcast/Appcast.swift | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/generate_appcast/Appcast.swift b/generate_appcast/Appcast.swift index 09087f02..b6e9d107 100644 --- a/generate_appcast/Appcast.swift +++ b/generate_appcast/Appcast.swift @@ -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 {