Compare commits

...
Author SHA1 Message Date
Kornel 1ff1577108 Bump 2019-02-11 14:15:20 +00:00
Kornel 74f2ea540e Merge pull request #1358 from barijaona/smallimages
Losslessly reduced the size of PNG
2019-02-05 02:00:32 +00:00
Barijaona Ramaholimihaso 2652be32f7 Losslessly reduced the size of PNG
By use of OxiPNG, PNGOUT and zopflipng.
Initially submitted by Sveinbjorn Thordarson (@sveinbjornt) at
ViennaRSS/vienna-rss#1237.
2019-02-05 04:46:18 +03:00
Kornel 5118f2b27f Merge pull request #1353 from core-code/master
fix #1352
2019-01-30 15:41:34 +00:00
Julian Mayer b97b60b611 fix 2019-01-30 15:02:13 +01:00
Julian Mayer 3c793482c8 #1352 2019-01-30 13:31:07 +01:00
Kornel 89b4bcde61 Merge pull request #1351 from Wevah/master
Use contentsOfDirectory(at:...) instead of atPath:....
2019-01-26 20:48:12 +00:00
Nate Weaver 3690dd028a Use contentsOfDirectory(at:...) instead of atPath:..., and rename apps to bundles. 2019-01-26 10:59:19 -06:00
Kornel 52e2ef88eb Merge pull request #1350 from Wevah/generate-appcast-bundle-check
Check for all bundles instead of just apps.
2019-01-25 15:41:08 +00:00
Nate Weaver d81633a7d3 Check for all bundles instead of just apps. 2019-01-24 11:49:24 -06:00
Kornel a9e20c7d0a Merge pull request #1347 from pNre/master
Check that effectiveAppearance is being observed before calling removeObserver
2019-01-18 15:21:37 +00:00
Kornel 03a9f57704 Check that effectiveAppearance is being observed before calling removeObserver 2019-01-18 15:58:43 +01:00
Kornel 2f8df626d7 Merge pull request #1340 from kant/patch-1
Semantic issue on #151. Fix typo on paragraph #149
2019-01-12 13:32:52 +00:00
Kornel f5cb6988ed Merge pull request #1341 from kant/patch-2
Fixed typo on string #021
2019-01-12 13:32:20 +00:00
Darío Hereñú 2bfab80998 Fixed typo on string #021 2019-01-12 08:41:46 -03:00
Darío Hereñú 4fa2a37798 Semantic issue on #151. Fix typo on paragraph #149 2019-01-12 08:37:30 -03:00
Kornel 888a7f48a6 Formatting 2018-12-23 11:53:21 +00:00
Kornel 82726c4386 Make it clear that quarantine error is only a warning 2018-12-23 11:53:13 +00:00
Kornel a5b23cdbee Bump 2018-12-18 21:59:38 +00:00
Kornel b19120f5cd Allow EdDSA for delta updates, too 2018-12-16 03:03:23 +00:00
Kornel 4b0a037685 Merge pull request #1331 from ProsoftEngineering/fix-xcode-10-warnings
Fix xcode 10 warnings
2018-12-13 21:05:20 +00:00
Brian Bergstrand 8dadd0003e Fix DEBUG -Wundef warning 2018-12-13 14:39:24 -06:00
Brian Bergstrand 457319f217 Suppress 'direct-ivar-access' warning for property ivar 2018-12-13 14:36:28 -06:00
Kornel 0480b9bb25 Merge pull request #1329 from Bi11/master
Fix release note web view's contextual menu
2018-12-13 19:23:21 +00:00
Bi11 4390eb9eb2 Fix release note web view's contextual menu
Code added in 8ff6c147f2 does not take effect nowadays due to missing assignment of UIDelegate.
2018-12-14 03:05:41 +08:00
Kornel f5c8314c88 Merge pull request #1328 from Bi11/dark-mode
Fix release note WebView's appearance in dark mode
2018-12-13 13:51:25 +00:00
Bi11 1b209e6726 Add a test link in test app 2018-12-13 17:35:49 +08:00
Bi11 a4373e4e0f Fix release note WebView's appearance in dark mode
Referenced commits:
502378553e (PR #1280)
7e351b52c7 (PR #1288)
2018-12-13 17:35:49 +08:00
Kornel d430c33bf4 Merge pull request #1325 from Bi11/master
Fix compile of TestApplication
2018-12-11 02:07:32 +00:00
Bi11 7ef4635d8c Fix compile of TestApplication 2018-12-11 04:16:10 +08:00
Kornel deb4be7a1b Bump 2018-12-10 12:48:46 +00:00
Kornel 5f1bc6b612 Sign appcast tools 2018-12-10 12:47:28 +00:00
Kornel 1cde8110df Explain error 25308 2018-12-10 12:45:40 +00:00
Kornel 1926b7bfa6 1.21.0 2018-11-25 16:01:20 +00:00
Kornel f80907fa2c Check if public key is configured correctly 2018-11-25 15:54:14 +00:00
Kornel 091a86f672 Merge pull request #1317 from HofiOne/2-tiny-issues
2 tiny fixes
2018-11-20 12:50:04 +00:00
Hofi 208b0dc49a 2 tiny fixes
- bogus debug build warning fixed
- fixed docs build warning message to prevent execution of  embedded shell script line
2018-11-20 05:55:17 +01:00
Kornel 5acf3989d2 Make legacy script use a smaller DSA key that macOS still supports
Sizes below 2048 get SHA-1.
2018-11-13 13:36:35 +00:00
Kornel Lesiński 5529a3610d Troubleshooting help 2018-11-12 19:38:17 +00:00
milotype 920ff7f83f Croatian localization added 2018-11-10 18:07:07 +00:00
Kornel 5ff1488f0c Bump 2018-10-31 01:00:16 +00:00
Kornel c0c1c51d8d Ignore symlink permissions in binary deltas
Fixes #1301
2018-10-31 01:00:16 +00:00
Kornel 5139179487 Refactored signature check logic 2018-10-31 01:00:16 +00:00
Kornel f50cbce0e8 Add EdDSA files to tests 2018-10-31 01:00:16 +00:00
Kornel 14f1d3520a Update signing self-check to look for EdDSA 2018-10-31 01:00:16 +00:00
Kornel 9c4729ed4a Use EdDSA keys in test app 2018-10-31 01:00:16 +00:00
Kornel f04a61e159 Sparkle version in logs 2018-10-31 00:50:41 +00:00
Kornel 80d8758fc2 Merge pull request #1302 from elgatosf/master
SPUDownloaderSession leaked because the NSURLSession wasn’t invalidated
2018-10-30 02:38:34 +00:00
Michael Ehrmann 081301d590 SPUDownloaderSession leaked because the NSURLSession wasn’t invalidated 2018-10-29 17:52:48 +01:00
Kornel 397370297b Update README.markdown 2018-09-30 01:01:16 +09:00
Kornel b30dcd979f EdDSA spelling 2018-09-17 13:44:05 +01:00
Kornel ee123edd74 Changelog 2018-09-16 21:12:11 +01:00
Kornel 984625cc7e Build new scripts 2018-09-16 20:55:32 +01:00
Kornel 7b6e7957c6 sign_update tool 2018-09-16 20:55:32 +01:00
Kornel 2815514c23 Bump 2018-09-16 20:55:32 +01:00
Kornel 49eaa4c5cc Objc bugs 2018-09-16 15:57:19 +01:00
Kornel 09bcee7280 Don't re-create unnecessary delta files 2018-09-16 15:19:43 +01:00
Kornel 49ea08b284 Sort project file 2018-09-16 15:07:53 +01:00
Kornel f9dc70ade2 Use proper Caches directory 2018-09-16 15:07:46 +01:00
Kornel 6fb3eee91b Constants for element names 2018-09-16 11:23:27 +01:00
Kornel 19be83b15f Emit edSignature in the appcast 2018-09-16 11:19:28 +01:00
Kornel d90529ccaa Fixed check for supported signatures 2018-09-16 11:19:15 +01:00
Kornel 623b7b6bda ed25519 keys in generate_* tools 2018-09-16 00:40:42 +01:00
Kornel 65bcb3815e Deprecate old DSA scripts 2018-09-16 00:40:42 +01:00
Kornel d5cd95e0ef ed25519 signature verification 2018-09-16 00:40:42 +01:00
Kornel b9150d2938 Rename method 2018-09-16 00:40:42 +01:00
Kornel 1006326157 Make SecKeyRef as needed 2018-09-16 00:40:42 +01:00
Kornel 68856e074b Ed25519 public key in Info.plist 2018-09-16 00:40:42 +01:00
Kornel a86bdb2fa8 ed25519 submodule 2018-09-16 00:40:42 +01:00
Kornel 92e00baafb Don't perform heavy work in constructor 2018-09-15 17:04:05 +01:00
Kornel 98ea3e3d57 Rename 2018-09-15 17:04:05 +01:00
Kornel c094a38231 Wrapper for public keys 2018-09-15 15:54:08 +01:00
Kornel 6df898f9b7 Use signatures object 2018-09-15 15:54:08 +01:00
Kornel 7f51a4e344 Read ed25519 signature from appcast 2018-09-15 15:54:08 +01:00
Kornel 8ad1f57672 SUSignatures 2018-09-15 15:54:08 +01:00
Kornel 8b88183c7d Merge pull request #1278 from tempelmann/master-origin
Make "sign_update" work on pre-10.13 system
2018-08-19 14:45:43 +01:00
Thomas Tempelmann d036d3e3ae Make "sign_update" work on pre-10.13 system by checking the OpenSSL version, using the older "-dss1" digest option again in that case. See ticket 1227 and commit 0cb0b2f 2018-08-19 15:28:03 +02:00
Kornel 8b13eb5dcf Merge pull request #1270 from shayr1/patch-1
Fixed some typos
2018-07-18 18:55:20 +01:00
Shay ba5b7341fa Fixed some typos
Fixed typos in the following keys:
"An error occurred during installation. Please try again later."
"An error occurred in retrieving update information. Please try again later."
Added missing key that fell back to English:
"Cancel Update" = "בטל עדכון"; (Inside alert when using a button to let user check for updates)
2018-07-18 19:16:05 +03:00
76 changed files with 2212 additions and 528 deletions

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
[submodule "ed25519"]
path = ed25519
url = https://github.com/orlp/ed25519
+29
View File
@@ -1,3 +1,32 @@
# 1.21.3
* Losslessly reduced the size of PNG (Barijaona Ramaholimihaso)
* Catch exceptions from subcommands (Julian Mayer)
* `generate_appcast` can sign any bundles instead of just apps (Nate Weaver)
* Check that effectiveAppearance is being observed before calling removeObserver (Pierluigi)
# 1.21.2
* Allow EdDSA for delta updates, too (Kornel)
* Warning fixes (Brian Bergstrand)
* Improvements to release notes view context menu and dark mode (Bi11)
# 1.21.0
* Added support EdDSA (ed25519) signatures (Kornel)
* DSA signatures are considered outdated, and Apple's `Security.framework` only supports weaker SHA-1-based DSA.
* Both old DSA and new EdDSA are still supported (and one app can use both), but new applications should use EdDSA only, and we recommend migrating away from DSA signatures.
* `generate_keys` is now a Swift tool that stores EdDSA private keys in the Keychain
* Existing apps can continue using their old DSA keys, but we've dropped support for generation of old DSA keys
* `sign_update` is now a Swift tool that signs using EdDSA from private keys in the Keychain
* The old DSA-based signing script has been moved to `bin/old_dsa_scripts`
* The old DSA-based signing script has been fixed to work on pre-10.13 systems (Thomas Tempelmann)
* `generate_appcast` has been updated to support EdDSA signatures
* It can sign both DSA (if `dsa_priv.pem` file is specified) and EdDSA (from Keychain)
* The tool now uses Caches directory and doesn't generate unnecessary delta files
* Fixed verification of delta updates on filesystems that change permissions of symlinks
* Fixed `NSURLSession` leak (Michael Ehrmann)
# 1.20.0
* `generate_appcast` option to read private key directly from the keychain (Tamás Lustyik)
+2 -2
View File
@@ -16,8 +16,8 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
SPARKLE_VERSION_MAJOR = 1
SPARKLE_VERSION_MINOR = 20
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION_MINOR = 21
SPARKLE_VERSION_PATCH = 3
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
@@ -0,0 +1,7 @@
// Generate Appcast only
#include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = generate_keys/Bridging-Header.h
MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = generate_keys
@@ -0,0 +1,4 @@
// Generate Appcast Debug
#include "ConfigGenerateKeys.xcconfig"
#include "ConfigSwiftDebug.xcconfig"
@@ -0,0 +1,4 @@
// Generate Appcast Release
#include "ConfigGenerateKeys.xcconfig"
#include "ConfigSwiftRelease.xcconfig"
+4
View File
@@ -19,6 +19,8 @@ if [ "$ACTION" = "" ] ; then
cp -R "$SRCROOT/bin" "$CONFIGURATION_BUILD_DIR/staging"
cp "$CONFIGURATION_BUILD_DIR/BinaryDelta" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/generate_appcast" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
@@ -27,6 +29,8 @@ if [ "$ACTION" = "" ] ; then
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging"
fi
+1 -1
View File
@@ -5,7 +5,7 @@ if [ "$ACTION" = "" ] ; then
doxygen Documentation/Doxyfile
else
echo "warning: Doxygen not found in PATH"
echo "open Terminal and type this command `brew install doxygen` then click `enter/return` key. finally build this target again"
echo "open Terminal and type this command 'brew install doxygen' then click 'enter/return' key. finally build this target again"
fi
elif [ "$ACTION" = "clean" ] ; then
rm -rf "$SRCROOT/Documentation/html"
+16 -5
View File
@@ -7,7 +7,7 @@ Secure and reliable software update framework for Cocoa developers.
## Features
* Seamless. There's no mention of Sparkle; your icons and app name are used.
* Secure. Updates are verified using DSA signatures and Apple Code Signing.
* Secure. Updates are verified using EdDSA signatures and Apple Code Signing.
* Fast. Supports delta updates which only patch files that have changed.
* Easy to install. Sparkle requires no code in your app, and only needs static files on a web server.
* Supports bundles, preference panes, plugins, and other non-.app software. Can install .pkg files for more complicated products.
@@ -18,9 +18,9 @@ Secure and reliable software update framework for Cocoa developers.
## Changes since 1.5b
* Compatibilty with macOS Sierra.
* Up-to-date with 10.12 SDK and Xcode 8 (supports macOS 10.7+).
* Important security fixes.
* Compatibility with macOS Sierra (and all newer versions).
* Up-to-date with 10.14 SDK and Xcode 10 (supports macOS 10.7+).
* Important security fixes and more secure signature algorithm.
* Cleaned up and modernized code, using ARC and Autolayout.
* Truly automatic background updates (no UI at all) when user agreed to "Automatically download and install updates in the future."
* Upgraded and more reliable binary delta and code signing verification.
@@ -30,8 +30,9 @@ Secure and reliable software update framework for Cocoa developers.
## Requirements
* Runtime: macOS 10.7 or greater
* Build: Xcode 7 and 10.11 SDK or greater
* Build: Xcode 8 and 10.11 SDK or greater
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
* No sandboxing. Sparkle 1.x can't update sandboxed apps. Sparkle 2.0 (alpha) can.
## Usage
@@ -39,6 +40,16 @@ See [getting started guide](https://sparkle-project.org/documentation/). No code
## Development
### Troubleshooting
* Please check **Console.app**. Sparkle prints detailed information there about all problems it encounters. It often also suggests solutions to the problems, so please read Sparkle's log messages carefully.
* Use the `generate_appcast` tool which creates appcast files, correct signatures, and delta updates automatically.
* Make sure the URL specified in [`SUFeedURL`](https://sparkle-project.org/documentation/customization/) is valid (typos/404s are a common error!), and that it uses modern TLS ([test it](https://www.ssllabs.com/ssltest/)).
* Delete your app's preferences (in `~/Library/Preferences/<your bundle id>`) if you've set another feed URL programmatically via Sparkle's Objective-C interface.
### API symbols
Sparkle is built with `-fvisibility=hidden -fvisibility-inlines-hidden` which means no symbols are exported by default.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

After

Width:  |  Height:  |  Size: 176 KiB

+3
View File
@@ -10,6 +10,7 @@
http://you.com/app/2.0.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:dsaSignature="BAFJW4B6B1K1JyW30nbkBwainOzrN6EQuAh" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
</item>
@@ -20,6 +21,7 @@
http://you.com/app/1.5.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
</item>
@@ -31,6 +33,7 @@
http://you.com/app/1.4.html
</sparkle:releaseNotesLink>
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream" />
<sparkle:minimumSystemVersion>10.7</sparkle:minimumSystemVersion>
</item>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 100 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "1.20.0"
s.version = "1.21.3"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
s.homepage = "http://sparkle-project.org"
File diff suppressed because it is too large. Load diff
+9
View File
@@ -0,0 +1,9 @@
html {
color: #FFFFFFD8;
}
:link {
color: #419CFF;
}
:link:active {
color: #FF1919;
}
+1
View File
@@ -150,6 +150,7 @@
-(void)cleanup
{
[self.download cancel];
[self.downloadSession invalidateAndCancel];
self.download = nil;
self.downloadSession = nil;
[super cleanup];
+2 -1
View File
@@ -15,13 +15,14 @@
#import <Foundation/Foundation.h>
#endif
#import "SUExport.h"
@class SUSignatures;
SU_EXPORT @interface SUAppcastItem : NSObject
@property (copy, readonly) NSString *title;
@property (copy, readonly) NSString *dateString;
@property (copy, readonly) NSString *itemDescription;
@property (strong, readonly) NSURL *releaseNotesURL;
@property (copy, readonly) NSString *DSASignature;
@property (strong, readonly) SUSignatures *signatures;
@property (copy, readonly) NSString *minimumSystemVersion;
@property (copy, readonly) NSString *maximumSystemVersion;
@property (strong, readonly) NSURL *fileURL;
+5 -5
View File
@@ -9,7 +9,7 @@
#import "SUAppcastItem.h"
#import "SULog.h"
#import "SUConstants.h"
#import "SUSignatures.h"
#include "AppKitPrevention.h"
@@ -18,7 +18,7 @@
@property (copy, readwrite) NSString *dateString;
@property (copy, readwrite) NSString *itemDescription;
@property (strong, readwrite) NSURL *releaseNotesURL;
@property (copy, readwrite) NSString *DSASignature;
@property (strong, readwrite) SUSignatures *signatures;
@property (copy, readwrite) NSString *minimumSystemVersion;
@property (copy, readwrite) NSString *maximumSystemVersion;
@property (strong, readwrite) NSURL *fileURL;
@@ -34,7 +34,7 @@
@synthesize dateString;
@synthesize deltaUpdates;
@synthesize displayVersionString;
@synthesize DSASignature;
@synthesize signatures;
@synthesize fileURL;
@synthesize contentLength = _contentLength;
@synthesize infoURL;
@@ -156,10 +156,10 @@
self.fileURL = [NSURL URLWithString:fileURLString];
}
if (enclosure) {
self.DSASignature = [enclosure objectForKey:SUAppcastAttributeDSASignature];
self.signatures = [[SUSignatures alloc] initWithDsa:[enclosure objectForKey:SUAppcastAttributeDSASignature] ed:[enclosure objectForKey:SUAppcastAttributeEDSignature]];
self.osString = [enclosure objectForKey:SUAppcastAttributeOsType];
}
self.versionString = newVersion;
self.minimumSystemVersion = [dict objectForKey:SUAppcastElementMinimumSystemVersion];
self.maximumSystemVersion = [dict objectForKey:SUAppcastElementMaximumSystemVersion];
+37 -35
View File
@@ -82,7 +82,7 @@
{
id<SUVersionComparison> comparator = nil;
id<SUUpdaterPrivate> updater = self.updater;
// Give the delegate a chance to provide a custom version comparator
if ([[updater delegate] respondsToSelector:@selector(versionComparatorForUpdater:)]) {
comparator = [[updater delegate] versionComparatorForUpdater:self.updater];
@@ -106,14 +106,14 @@
}
}
}
if (item && deltaItem) {
SUAppcastItem *deltaUpdateItem = [[item deltaUpdates] objectForKey:hostVersion];
if (deltaUpdateItem && [[self class] hostSupportsItem:deltaUpdateItem]) {
*deltaItem = deltaUpdateItem;
}
}
return item;
}
@@ -175,7 +175,7 @@
{
item = [[updater delegate] bestValidUpdateInAppcast:ac forUpdater:self.updater];
}
if (item != nil) // Does the delegate want to handle it?
{
if ([item isDeltaUpdate]) {
@@ -187,7 +187,7 @@
// Find the best supported update
SUAppcastItem *deltaUpdateItem = nil;
item = [[self class] bestItemFromAppcastItems:ac.items getDeltaItem:&deltaUpdateItem withHostVersion:self.host.version comparator:[self versionComparator]];
if (item && deltaUpdateItem) {
self.nonDeltaUpdateItem = item;
item = deltaUpdateItem;
@@ -206,7 +206,7 @@
- (void)didFindValidUpdate
{
assert(self.updateItem);
id<SUUpdaterPrivate> updater = self.updater;
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)]) {
@@ -222,7 +222,7 @@
- (void)didNotFindUpdate
{
id<SUUpdaterPrivate> updater = self.updater;
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) {
[[updater delegate] updaterDidNotFindUpdate:self.updater];
}
@@ -247,12 +247,12 @@
SULog(SULogLevelError, @"Failed to find user's cache directory! Using system default");
cachePath = NSTemporaryDirectory();
}
NSString *name = [self.host.bundle bundleIdentifier];
if (!name) {
name = [self.host name];
}
cachePath = [cachePath stringByAppendingPathComponent:name];
cachePath = [cachePath stringByAppendingPathComponent:@SPARKLE_BUNDLE_IDENTIFIER];
return cachePath;
@@ -262,7 +262,7 @@
{
NSString *bundleIdentifier = self.host.bundle.bundleIdentifier;
assert(bundleIdentifier != nil);
// Clear cache directory so that downloads can't possibly accumulate inside
NSString *appCachePath = [self appCachePath];
if ([[NSFileManager defaultManager] fileExistsAtPath:appCachePath]) {
@@ -282,7 +282,7 @@
willDownloadUpdate:self.updateItem
withRequest:request];
}
if ([SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 9, 0}]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
@@ -322,7 +322,7 @@
if ([[updater delegate] respondsToSelector:@selector(updater:didDownloadUpdate:)]) {
[[updater delegate] updater:self.updater didDownloadUpdate:self.updateItem];
}
[self extractUpdate];
}
@@ -332,15 +332,15 @@
if (!failingUrl) {
failingUrl = [self.updateItem fileURL];
}
id<SUUpdaterPrivate> updater = self.updater;
if ([[updater delegate] respondsToSelector:@selector(updater:failedToDownloadUpdate:error:)]) {
[[updater delegate] updater:self.updater
failedToDownloadUpdate:self.updateItem
error:error];
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil),
NSUnderlyingErrorKey: error,
@@ -348,7 +348,7 @@
if (failingUrl) {
[userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey];
}
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:userInfo]];
}
@@ -356,21 +356,23 @@
{
id<SUUpdaterPrivate> updater = self.updater;
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:self.downloadPath updatingHostBundlePath:self.host.bundlePath decryptionPassword:updater.decryptionPassword];
BOOL success;
BOOL success = NO;
if (!unarchiver) {
SULog(SULogLevelError, @"Error: No valid unarchiver for %@!", self.downloadPath);
success = NO;
} else {
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:self.downloadPath signatures:self.updateItem.signatures host:self.host];
// Currently unsafe archives are the only case where we can prevalidate before extraction, but that could change in the future
BOOL needsPrevalidation = [[unarchiver class] unsafeIfArchiveIsNotValidated];
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:self.downloadPath dsaSignature:self.updateItem.DSASignature host:self.host performingPrevalidation:needsPrevalidation];
success = self.updateValidator.canValidate;
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction];
if (needsPrevalidation) {
success = [self.updateValidator validateDownloadPath];
} else {
success = YES;
}
}
if (!success) {
NSError *reason = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{NSLocalizedDescriptionKey: @"Failed to extract update."}];
[self unarchiverDidFailWithError:reason];
@@ -378,7 +380,7 @@
if ([[updater delegate] respondsToSelector:@selector(updater:willExtractUpdate:)]) {
[[updater delegate] updater:self.updater willExtractUpdate:self.updateItem];
}
[unarchiver unarchiveWithCompletionBlock:^(NSError *err){
if (err) {
[self unarchiverDidFailWithError:err];
@@ -387,7 +389,7 @@
if ([[updater delegate] respondsToSelector:@selector(updater:didExtractUpdate:)]) {
[[updater delegate] updater:self.updater didExtractUpdate:self.updateItem];
}
[self performSelectorOnMainThread:@selector(unarchiverDidFinish:) withObject:nil waitUntilDone:NO];
} progressBlock:^(double progress) {
[self unarchiver:nil extractedProgress:progress];
@@ -413,7 +415,7 @@
- (void)unarchiverDidFinish:(id)__unused ua
{
assert(self.updateItem);
[self installWithToolAndRelaunch:YES];
}
@@ -421,12 +423,12 @@
{
// No longer needed
self.updateValidator = nil;
if ([self.updateItem isDeltaUpdate]) {
[self failedToApplyDeltaUpdate];
return;
}
[self abortUpdateWithError:err];
}
@@ -471,7 +473,7 @@
{
assert(self.updateItem);
assert(self.updateValidator);
BOOL validationCheckSuccess = [self.updateValidator validateWithUpdateDirectory:self.tempDir];
if (!validationCheckSuccess) {
NSDictionary *userInfo = @{
@@ -555,7 +557,7 @@
// Perhaps in a sandboxed environment this matters more. Note that this may not be a fatal error.
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:relaunchCopyTargetURL error:&quarantineError]) {
SULog(SULogLevelError, @"Failed to release quarantine on %@ with error %@", relaunchCopyTargetPath, quarantineError);
SULog(SULogLevelDefault, @"Warning: could not remove quarantine metadata from %@: %@. This may not be a problem, the update process will continue.", relaunchCopyTargetPath, quarantineError);
}
}
}
@@ -591,10 +593,10 @@
pathToRelaunch = delegateRelaunchPath;
}
}
//Set relaunching flag.
[self.host setBool:YES forUserDefaultsKey:SUUpdateRelaunchingMarkerKey];
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
pathToRelaunch,
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
+5
View File
@@ -190,6 +190,11 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
uint16_t mode = ent->fts_statp->st_mode;
// permission of symlinks is irrelevant and can't be changed.
// hardcoding a value helps avoid differences between filesystems.
if (ent->fts_info == FTS_SL) {
mode = 0755;
}
uint16_t type = ent->fts_info;
uint16_t permissions = mode & PERMISSION_FLAGS;
+1 -1
View File
@@ -33,7 +33,7 @@
return [[path pathExtension] isEqualToString:@"delta"];
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return YES;
}
+3
View File
@@ -41,6 +41,8 @@ extern NSString *const SUSkippedVersionKey;
extern NSString *const SUScheduledCheckIntervalKey;
extern NSString *const SULastCheckTimeKey;
extern NSString *const SUExpectsDSASignatureKey;
extern NSString *const SUExpectsEDSignatureKey;
extern NSString *const SUPublicEDKeyKey;
extern NSString *const SUPublicDSAKeyKey;
extern NSString *const SUPublicDSAKeyFileKey;
extern NSString *const SUAutomaticallyUpdateKey;
@@ -64,6 +66,7 @@ extern NSString *const SURelaunchToolNameKey __attribute__((deprecated("This key
extern NSString *const SUAppcastAttributeDeltaFrom;
extern NSString *const SUAppcastAttributeDSASignature;
extern NSString *const SUAppcastAttributeEDSignature;
extern NSString *const SUAppcastAttributeShortVersionString;
extern NSString *const SUAppcastAttributeVersion;
extern NSString *const SUAppcastAttributeOsType;
+3
View File
@@ -33,6 +33,8 @@ NSString *const SUSkippedVersionKey = @"SUSkippedVersion";
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
NSString *const SUExpectsEDSignatureKey = @"SUExpectsEDSignatureKey";
NSString *const SUPublicEDKeyKey = @"SUPublicEDKey";
NSString *const SUPublicDSAKeyKey = @"SUPublicDSAKey";
NSString *const SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
@@ -54,6 +56,7 @@ NSString *const SURelaunchToolNameKey = @"SURelaunchToolName";
NSString *const SUAppcastAttributeDeltaFrom = @"sparkle:deltaFrom";
NSString *const SUAppcastAttributeDSASignature = @"sparkle:dsaSignature";
NSString *const SUAppcastAttributeEDSignature = @"sparkle:edSignature";
NSString *const SUAppcastAttributeShortVersionString = @"sparkle:shortVersionString";
NSString *const SUAppcastAttributeVersion = @"sparkle:version";
NSString *const SUAppcastAttributeOsType = @"sparkle:os";
-37
View File
@@ -1,37 +0,0 @@
//
// SUDSAVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#ifndef SUDSAVERIFIER_H
#define SUDSAVERIFIER_H
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1090
@interface NSData (SUDSAVerifier)
- (id)initWithBase64Encoding:(NSString *)base64String;
@end
#endif
@interface SUDSAVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
- (instancetype)initWithPublicKeyData:(NSData *)data;
- (BOOL)verifyFileAtPath:(NSString *)path signature:(NSData *)signature;
- (BOOL)verifyStream:(NSInputStream *)stream signature:(NSData *)signature;
@end
#endif
+1 -1
View File
@@ -30,7 +30,7 @@
return [[path pathExtension] isEqualToString:@"dmg"];
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
+4 -1
View File
@@ -7,6 +7,8 @@
#import <Foundation/Foundation.h>
@class SUPublicKeys;
@interface SUHost : NSObject
@property (strong, readonly) NSBundle *bundle;
@@ -16,8 +18,9 @@
@property (readonly, copy) NSString *name;
@property (readonly, copy) NSString *version;
@property (readonly, copy) NSString *displayVersion;
@property (readonly) SUPublicKeys *publicKeys;
@property (getter=isRunningOnReadOnlyVolume, readonly) BOOL runningOnReadOnlyVolume;
@property (readonly, copy) NSString *publicDSAKey;
@property (readonly, nonatomic, copy) NSString *publicDSAKeyFileKey;
- (id)objectForInfoDictionaryKey:(NSString *)key;
+12 -1
View File
@@ -10,7 +10,7 @@
#import "SUConstants.h"
#include <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
#import "SULog.h"
#import "SUSignatures.h"
#include "AppKitPrevention.h"
@@ -26,6 +26,7 @@
@property (nonatomic, readonly) BOOL isMainBundle;
@property (copy) NSString *defaultsDomain;
@property (assign) BOOL usesStandardUserDefaults;
@property (readonly, copy) NSString *publicDSAKey;
@end
@@ -109,6 +110,11 @@
return (statfs_info.f_flags & MNT_RDONLY) != 0;
}
- (NSString *__nullable)publicEDKey
{
return [self objectForInfoDictionaryKey:SUPublicEDKeyKey];
}
- (NSString *__nullable)publicDSAKey
{
// Maybe the key is just a string in the Info.plist.
@@ -135,6 +141,11 @@
return key;
}
- (SUPublicKeys *)publicKeys
{
return [[SUPublicKeys alloc] initWithDsa:[self publicDSAKey] ed:[self publicEDKey]];
}
- (NSString * __nullable)publicDSAKeyFileKey
{
return [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
+1 -1
View File
@@ -63,7 +63,7 @@ void SULog(SULogLevel level, NSString *format, ...)
}
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
client = asl_open([displayName stringByAppendingString:@" [Sparkle " TO_STRING(SPARKLE_VERSION) "]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
}
});
+35 -29
View File
@@ -58,7 +58,7 @@
return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
}
+ (BOOL)unsafeIfArchiveIsNotValidated
+ (BOOL)mustValidateBeforeExtraction
{
return NO;
}
@@ -105,43 +105,49 @@
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSTask *task = [[NSTask alloc] init];
[task setStandardInput:[pipe fileHandleForReading]];
[task setStandardError:[NSFileHandle fileHandleWithStandardError]];
[task setStandardOutput:[NSFileHandle fileHandleWithStandardOutput]];
[task setLaunchPath:command];
[task setArguments:[args arrayByAddingObject:destination]];
[task launch];
NSUInteger bytesRead = 0;
do {
NSData *data = [archiveInput readDataOfLength:256*1024];
NSUInteger len = [data length];
if (!len) {
break;
}
bytesRead += len;
[archiveOutput writeData:data];
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
@try {
[task launch];
}
@catch (NSException *e) {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
}
while(bytesRead < expectedLength);
[archiveOutput closeFile];
[task waitUntilExit];
if ([task terminationStatus] == 0) {
if (bytesRead == expectedLength) {
[notifier notifySuccess];
return;
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
if (!error) {
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSUInteger bytesRead = 0;
do {
NSData *data = [archiveInput readDataOfLength:256*1024];
NSUInteger len = [data length];
if (!len) {
break;
}
bytesRead += len;
[archiveOutput writeData:data];
[notifier notifyProgress:(double)bytesRead / (double)expectedLength];
}
while(bytesRead < expectedLength);
[archiveOutput closeFile];
[task waitUntilExit];
if ([task terminationStatus] == 0) {
if (bytesRead == expectedLength) {
[notifier notifySuccess];
return;
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' got only %ld of %ld bytes", command, (long)bytesRead, (long)expectedLength]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, command '%@' returned %d", command, [task terminationStatus]]}];
}
} else {
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
+32
View File
@@ -0,0 +1,32 @@
//
// SUDSAVerifier.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
// Includes code by Zach Waldowski on 10/18/13.
// Copyright 2014 Big Nerd Ranch. Licensed under MIT.
//
// Includes code from Plop by Mark Hamlin.
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#ifndef SUDSAVERIFIER_H
#define SUDSAVERIFIER_H
#import <Foundation/Foundation.h>
@class SUSignatures;
@class SUPublicKeys;
@interface SUSignatureVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys;
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pkeys;
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures;
@end
#endif
+85 -36
View File
@@ -12,43 +12,46 @@
// Copyright 2011 Mark Hamlin. Licensed under BSD.
//
#import "SUDSAVerifier.h"
#import "SUSignatureVerifier.h"
#import "SULog.h"
#import "SUSignatures.h"
#include <CommonCrypto/CommonDigest.h>
#import "../ed25519/src/ed25519.h" // run `git submodule update --init` if you get an erorr here
#include "AppKitPrevention.h"
@implementation SUDSAVerifier {
SecKeyRef _secKey;
@interface SUSignatureVerifier ()
@property (readonly) SUPublicKeys *pubKeys;
@end
@implementation SUSignatureVerifier {
}
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString
@synthesize pubKeys = _pubKeys;
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys
{
if (!encodedSignature) {
SULog(SULogLevelError, @"There is no DSA signature to check");
return NO;
}
if (!path) {
return NO;
}
SUDSAVerifier *verifier = [(SUDSAVerifier *)[self alloc] initWithPublicKeyData:[pkeyString dataUsingEncoding:NSUTF8StringEncoding]];
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
if (!verifier) {
return NO;
}
NSString *strippedSignature = [encodedSignature stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
NSData *signature = [[NSData alloc] initWithBase64Encoding:strippedSignature];
return [verifier verifyFileAtPath:path signature:signature];
return [verifier verifyFileAtPath:path signatures:signatures];
}
- (instancetype)initWithPublicKeyData:(NSData *)data
- (instancetype)initWithPublicKeys:(SUPublicKeys *)pubkeys
{
self = [super init];
_pubKeys = pubkeys;
return self;
}
- (SecKeyRef)dsaSecKeyRef {
NSData *data = [self.pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
if (!self || !data.length) {
SULog(SULogLevelError, @"Could not read public DSA key");
return nil;
@@ -67,40 +70,85 @@
return nil;
}
SecKeyRef dsaPubKeySecKey = nil;
if (format == kSecFormatOpenSSL && itemType == kSecItemTypePublicKey && CFArrayGetCount(items) == 1) {
// Seems silly, but we can't quiet the warning about dropping CFTypeRef's const qualifier through
// any manner of casting I've tried, including interim explicit cast to void*. The -Wcast-qual
// warning is on by default with -Weverything and apparently became more noisy as of Xcode 7.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
_secKey = (SecKeyRef)CFRetain(CFArrayGetValueAtIndex(items, 0));
dsaPubKeySecKey = (SecKeyRef)CFRetain(CFArrayGetValueAtIndex(items, 0));
#pragma clang diagnostic pop
}
CFRelease(items);
return self;
return dsaPubKeySecKey;
}
- (void)dealloc
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures
{
if (_secKey) {
CFRelease(_secKey);
}
}
- (BOOL)verifyFileAtPath:(NSString *)path signature:(NSData *)signature
{
if (!path.length) {
if (!path || !path.length) {
return NO;
}
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
return [self verifyStream:dataInputStream signature:signature];
if (!signatures) {
SULog(SULogLevelDefault, @"No signatures given to verifyFileAtPath");
return NO;
}
NSData *dsaSignature = signatures.dsaSignature;
NSString *dsaPubKey = self.pubKeys.dsaPubKey;
const unsigned char *edSignature = signatures.ed25519Signature;
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
if (edPubKey && !edSignature) {
SULog(SULogLevelDefault, @"There is no EdDSA signature in the update, but the app is capable of verifying them");
} if (!edPubKey && edSignature) {
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
} else if (edPubKey && edSignature) {
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:path options:NSDataReadingMappedAlways error:&error];
if (!data || !data.length) {
SULog(SULogLevelError, @"Failed to load file %@: %@", path, error);
return NO;
}
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
if (!dsaPubKey) {
return YES;
} else {
SULog(SULogLevelDefault, @"This app has a DSA public key, so a DSA signature is required too");
}
} else {
SULog(SULogLevelError, @"EdDSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
if (dsaSignature) {
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
}
return NO;
}
}
if (!dsaSignature) {
SULog(SULogLevelError, @"There is no DSA signature in the update");
} else if (!dsaPubKey) {
SULog(SULogLevelDefault, @"The update has a DSA signature, but it can't be used, because the old app doesn't have a DSA public key");
} else {
NSInputStream *dataInputStream = [NSInputStream inputStreamWithFileAtPath:path];
return [self verifyDSASignatureOfStream:dataInputStream dsaSignature:dsaSignature];
}
return NO;
}
- (BOOL)verifyStream:(NSInputStream *)stream signature:(NSData *)signature
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature
{
if (!stream || !signature) {
if (!stream || !dsaSignature) {
SULog(SULogLevelError, @"Invalid arguments to verifyStream");
return NO;
}
SecKeyRef dsaPubKeySecKey = [self dsaSecKeyRef];
if (!dsaPubKeySecKey) {
return NO;
}
@@ -116,6 +164,7 @@
if (dataDigestTransform) CFRelease(dataDigestTransform);
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
if (error) CFRelease(error);
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
return NO;
};
@@ -132,10 +181,10 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dataVerifyTransform = SecVerifyTransformCreate(_secKey, (__bridge CFDataRef)signature, &error);
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform || error) {
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, signature);
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
return cleanup();
}
+40
View File
@@ -0,0 +1,40 @@
//
// SUSignatures.h
// Sparkle
//
// Created by Kornel on 15/09/2018.
// Copyright © 2018 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1090
@interface NSData (SUDSAVerifier)
- (id)initWithBase64Encoding:(NSString *)base64String;
@end
#endif
NS_ASSUME_NONNULL_BEGIN
@interface SUSignatures : NSObject {
unsigned char ed25519_signature[64];
}
@property (strong, readonly, nullable) NSData *dsaSignature;
@property (readonly, nullable, nonatomic) const unsigned char *ed25519Signature;
- (instancetype)initWithDsa:(NSString * _Nullable)dsa ed:(NSString * _Nullable)ed;
@end
@interface SUPublicKeys : NSObject {
unsigned char ed25519_public_key[32];
}
@property (strong, readonly, nullable) NSString *dsaPubKey;
@property (readonly, nullable, nonatomic) const unsigned char *ed25519PubKey;
- (instancetype)initWithDsa:(NSString * _Nullable)dsa ed:(NSString * _Nullable)ed;
- (BOOL) isEqualToKey:(SUPublicKeys *)key;
@end
NS_ASSUME_NONNULL_END
+96
View File
@@ -0,0 +1,96 @@
//
// SUSignatures.m
// Sparkle
//
// Created by Kornel on 15/09/2018.
// Copyright © 2018 Sparkle Project. All rights reserved.
//
#import "SUSignatures.h"
#import <assert.h>
#import "SULog.h"
@implementation SUSignatures
@synthesize dsaSignature = _dsaSignature;
static NSData *decode(NSString *str) {
if (str == nil) {
return nil;
}
NSString *stripped = [str stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
return [[NSData alloc] initWithBase64Encoding:stripped];
}
- (instancetype)initWithDsa:(NSString * _Nullable)maybeDsa ed:(NSString * _Nullable)maybeEd25519
{
self = [super init];
if (self) {
if (maybeDsa != nil) {
_dsaSignature = decode(maybeDsa);
}
if (maybeEd25519 != nil) {
NSData *data = decode(maybeEd25519);
assert(64 == sizeof(self->ed25519_signature));
[data getBytes:self->ed25519_signature length:sizeof(self->ed25519_signature)];
}
}
return self;
}
- (const unsigned char *)ed25519Signature {
// Xcode may enable this in pedantic mode
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
for(size_t i=0; i < sizeof(self->ed25519_signature); i++) {
if (self->ed25519_signature[i] != 0) {
return self->ed25519_signature;
}
}
return NULL;
#pragma clang diagnostic pop
}
@end
@implementation SUPublicKeys
@synthesize dsaPubKey = _dsaPubKey;
- (instancetype)initWithDsa:(NSString * _Nullable)maybeDsa ed:(NSString * _Nullable)maybeEd25519
{
self = [super init];
if (self) {
_dsaPubKey = maybeDsa;
if (maybeEd25519 != nil) {
NSData *ed = decode(maybeEd25519);
assert(32 == sizeof(self->ed25519_public_key));
[ed getBytes:self->ed25519_public_key length:sizeof(self->ed25519_public_key)];
}
}
return self;
}
- (BOOL) isEqualToKey:(SUPublicKeys *)key {
NSString *thisKey = self.dsaPubKey;
NSString *thatKey = key.dsaPubKey;
if (thisKey == nil || thatKey == nil) {
return NO;
}
return NO;
}
- (const unsigned char *)ed25519PubKey {
// Xcode may enable this in pedantic mode
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
for(size_t i=0; i < sizeof(self->ed25519_public_key); i++) {
if (self->ed25519_public_key[i] != 0) {
return self->ed25519_public_key;
}
}
return NULL;
#pragma clang diagnostic pop
}
@end
+1 -1
View File
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)canUnarchivePath:(NSString *)path;
+ (BOOL)unsafeIfArchiveIsNotValidated;
+ (BOOL)mustValidateBeforeExtraction;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
+57 -3
View File
@@ -33,9 +33,11 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
@end
@protocol WebPolicyDelegate <NSObject>
@end
@protocol WebUIDelegate <NSObject>
@end
#endif
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate, NSTouchBarDelegate>
@interface SUUpdateAlert () <WebFrameLoadDelegate, WebPolicyDelegate, WebUIDelegate, NSTouchBarDelegate>
@property (strong) SUAppcastItem *updateItem;
@property (strong) SUHost *host;
@@ -43,6 +45,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
@property (strong) NSProgressIndicator *releaseNotesSpinner;
@property (assign) BOOL webViewFinishedLoading;
@property (assign) BOOL observingAppearance;
@property (weak) IBOutlet WebView *releaseNotesView;
@property (weak) IBOutlet NSView *releaseNotesContainerView;
@@ -64,6 +67,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
@synthesize releaseNotesSpinner;
@synthesize webViewFinishedLoading;
@synthesize observingAppearance;
@synthesize releaseNotesView;
@synthesize releaseNotesContainerView;
@@ -91,6 +95,23 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
return self;
}
- (void)dealloc {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
if (self.observingAppearance) {
[self.window removeObserver:self forKeyPath:@"effectiveAppearance"];
self.observingAppearance = NO;
}
}
#endif
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(__attribute__((unused)) NSDictionary<NSKeyValueChangeKey,id> *)change context:(__attribute__((unused)) void *)context {
if (object == self.window && [keyPath isEqualToString:@"effectiveAppearance"]) {
[self adaptReleaseNotesAppearance];
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; }
- (void)disableKeyboardShortcutForInstallButton {
@@ -100,8 +121,9 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
- (void)endWithSelection:(SUUpdateAlertChoice)choice
{
[self.releaseNotesView stopLoading:self];
[self.releaseNotesView setFrameLoadDelegate:nil];
[self.releaseNotesView setPolicyDelegate:nil];
self.releaseNotesView.frameLoadDelegate = nil;
self.releaseNotesView.policyDelegate = nil;
self.releaseNotesView.UIDelegate = nil;
[self.releaseNotesView removeFromSuperview]; // Otherwise it gets sent Esc presses (why?!) and gets very confused.
[self close];
self.completionBlock(choice);
@@ -137,12 +159,32 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
prefs.javaScriptEnabled = [self.host boolForInfoDictionaryKey:SUEnableJavaScriptKey];
self.releaseNotesView.frameLoadDelegate = self;
self.releaseNotesView.policyDelegate = self;
self.releaseNotesView.UIDelegate = self;
// Set the default font
// "-apple-system-font" is a reference to the system UI font. "-apple-system" is the new recommended token, but for backward compatibility we can't use it.
prefs.standardFontFamily = @"-apple-system-font";
prefs.defaultFontSize = (int)[NSFont systemFontSize];
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *))
{
NSBox *darkBackgroundView = [[NSBox alloc] initWithFrame:self.releaseNotesView.frame];
darkBackgroundView.boxType = NSBoxCustom;
darkBackgroundView.fillColor = [NSColor textBackgroundColor];
darkBackgroundView.borderColor = [NSColor clearColor];
// Using auto-resizing mask instead of contraints works well enough
darkBackgroundView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
[self.releaseNotesView.superview addSubview:darkBackgroundView positioned:NSWindowBelow relativeTo:self.releaseNotesView];
self.releaseNotesView.drawsBackground = NO;
prefs.userStyleSheetLocation = [[NSBundle bundleForClass:[self class]] URLForResource:@"DarkAqua" withExtension:@"css"];
if (!self.observingAppearance) {
[self.window addObserver:self forKeyPath:@"effectiveAppearance" options:NSKeyValueObservingOptionInitial context:nil];
self.observingAppearance = YES;
}
}
#endif
// Stick a nice big spinner in the middle of the web view until the page is loaded.
NSRect frame = [[self.releaseNotesView superview] frame];
self.releaseNotesSpinner = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(NSMidX(frame) - 16, NSMidY(frame) - 16, 32, 32)];
@@ -263,6 +305,18 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
return finalString;
}
- (void)adaptReleaseNotesAppearance
{
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *))
{
NSAppearanceName bestAppearance = [self.window.effectiveAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
BOOL isDarkAqua = ([bestAppearance isEqualToString:NSAppearanceNameDarkAqua]);
self.releaseNotesView.preferences.userStyleSheetEnabled = isDarkAqua;
}
#endif
}
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
{
if ([frame parentFrame] == nil) {
+4 -5
View File
@@ -9,16 +9,15 @@
#import <Foundation/Foundation.h>
@class SUHost;
@class SUSignatures;
@interface SUUpdateValidator : NSObject
// Pass YES to performingPrevalidation if archive validation must be done immediately, before extraction
- (instancetype)initWithDownloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature host:(SUHost *)host performingPrevalidation:(BOOL)performingPrevalidation;
- (instancetype)initWithDownloadPath:(NSString *)downloadPath signatures:(SUSignatures *)signatures host:(SUHost *)host;
// Indicates whether we can perform (post) validation later
@property (nonatomic, readonly) BOOL canValidate;
// This is "pre" validation, before the archive has been extracted
- (BOOL)validateDownloadPath;
// precondition: validation must be possible (see -canValidate)
// This is "post" validation, after an archive has been extracted
- (BOOL)validateWithUpdateDirectory:(NSString *)updateDirectory;
+97 -77
View File
@@ -7,20 +7,21 @@
//
#import "SUUpdateValidator.h"
#import "SUDSAVerifier.h"
#import "SUSignatureVerifier.h"
#import "SUCodeSigningVerifier.h"
#import "SUInstaller.h"
#import "SUHost.h"
#import "SULog.h"
#import "SUSignatures.h"
#include "AppKitPrevention.h"
@interface SUUpdateValidator ()
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, readonly) BOOL prevalidatedDsaSignature;
@property (nonatomic, readonly) NSString *dsaSignature;
@property (nonatomic) BOOL prevalidatedSignature;
@property (nonatomic) BOOL downloadPrevalidationFailed;
@property (strong, nonatomic, readonly) SUSignatures *signatures;
@property (nonatomic, readonly) NSString *downloadPath;
@end
@@ -28,59 +29,50 @@
@implementation SUUpdateValidator
@synthesize host = _host;
@synthesize canValidate = _canValidate;
@synthesize prevalidatedDsaSignature = _prevalidatedDsaSignature;
@synthesize dsaSignature = _dsaSignature;
@synthesize prevalidatedSignature = _prevalidatedSignature;
@synthesize signatures = _signatures;
@synthesize downloadPrevalidationFailed = _downloadPrevalidationFailed;
@synthesize downloadPath = _downloadPath;
- (instancetype)initWithDownloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature host:(SUHost *)host performingPrevalidation:(BOOL)performingPrevalidation
- (instancetype)initWithDownloadPath:(NSString *)downloadPath signatures:(SUSignatures *)signatures host:(SUHost *)host
{
self = [super init];
if (self != nil) {
BOOL canValidate;
BOOL prevalidatedDsaSignature;
if (performingPrevalidation) {
NSString *publicDSAKey = host.publicDSAKey;
if (publicDSAKey == nil) {
prevalidatedDsaSignature = NO;
SULog(SULogLevelError, @"Failed to validate update before unarchiving because no DSA key was found");
} else if (dsaSignature == nil) {
prevalidatedDsaSignature = NO;
SULog(SULogLevelError, @"Failed to validate update before unarchiving because no DSA signature was found");
} else {
prevalidatedDsaSignature = [SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:dsaSignature withPublicDSAKey:publicDSAKey];
if (!prevalidatedDsaSignature) {
SULog(SULogLevelError, @"DSA signature validation before unarchiving failed for update %@", downloadPath);
}
}
canValidate = prevalidatedDsaSignature;
} else {
prevalidatedDsaSignature = NO;
canValidate = YES;
}
_canValidate = canValidate;
_prevalidatedDsaSignature = prevalidatedDsaSignature;
_downloadPath = [downloadPath copy];
_dsaSignature = [dsaSignature copy];
_signatures = signatures;
_host = host;
}
return self;
}
- (BOOL)validateDownloadPath {
SUPublicKeys *publicKeys = self.host.publicKeys;
SUSignatures *signatures = self.signatures;
if (publicKeys.dsaPubKey == nil && publicKeys.ed25519PubKey == nil) {
SULog(SULogLevelError, @"Failed to validate update before unarchiving because no (Ed)DSA public key was found in the old app");
} else {
if ([SUSignatureVerifier validatePath:self.downloadPath withSignatures:signatures withPublicKeys:publicKeys]) {
self.prevalidatedSignature = YES;
return YES;
}
SULog(SULogLevelError, @"(Ed)DSA signature validation before unarchiving failed for update %@", self.downloadPath);
}
self.downloadPrevalidationFailed = YES;
return NO;
}
- (BOOL)validateWithUpdateDirectory:(NSString *)updateDirectory
{
assert(self.canValidate);
if (self.downloadPrevalidationFailed) {
return NO;
}
NSString *DSASignature = self.dsaSignature;
NSString *publicDSAKey = self.host.publicDSAKey;
SUSignatures *signatures = self.signatures;
SUPublicKeys *publicKeys = self.host.publicKeys;
NSString *downloadPath = self.downloadPath;
SUHost *host = self.host;
BOOL prevalidatedDsaSignature = self.prevalidatedDsaSignature;
BOOL isPackage = NO;
// install source could point to a new bundle or a package
@@ -92,18 +84,18 @@
NSURL *installSourceURL = [NSURL fileURLWithPath:installSource];
if (!prevalidatedDsaSignature) {
if (!self.prevalidatedSignature) {
// Check to see if we have a package or bundle to validate
if (isPackage) {
// For package type updates, all we do is check if the DSA signature is valid
BOOL validationCheckSuccess = [SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
BOOL validationCheckSuccess = [SUSignatureVerifier validatePath:downloadPath withSignatures:signatures withPublicKeys:publicKeys];
if (!validationCheckSuccess) {
SULog(SULogLevelError, @"DSA signature validation of the package failed. The update contains an installer package, and valid DSA signatures are mandatory for all installer packages. The update will be rejected. Sign the installer with a valid DSA key or use an .app bundle update instead.");
}
return validationCheckSuccess;
} else {
// For application bundle updates, we check both the DSA and Apple code signing signatures
return [self validateUpdateForHost:host downloadedToPath:downloadPath newBundleURL:installSourceURL DSASignature:DSASignature];
return [self validateUpdateForHost:host downloadedToPath:downloadPath newBundleURL:installSourceURL signatures:signatures];
}
} else if (isPackage) {
// We shouldn't get here because we don't validate packages before extracting them currently
@@ -131,7 +123,7 @@
* * old and new Code Signing identity are the same and valid
*
*/
- (BOOL)validateUpdateForHost:(SUHost *)host downloadedToPath:(NSString *)downloadedPath newBundleURL:(NSURL *)newBundleURL DSASignature:(NSString *)DSASignature
- (BOOL)validateUpdateForHost:(SUHost *)host downloadedToPath:(NSString *)downloadedPath newBundleURL:(NSURL *)newBundleURL signatures:(SUSignatures *)signatures
{
NSBundle *newBundle = [NSBundle bundleWithURL:newBundleURL];
if (newBundle == nil) {
@@ -139,55 +131,83 @@
return NO;
}
NSString *publicDSAKey = host.publicDSAKey;
SUPublicKeys *publicKeys = host.publicKeys;
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
NSString *newPublicDSAKey = newHost.publicDSAKey;
SUPublicKeys *newPublicKeys = newHost.publicKeys;
BOOL oldHasLegacyDSAKey = publicKeys.dsaPubKey != nil;
BOOL oldHasEdDSAKey = publicKeys.ed25519PubKey != nil;
BOOL oldHasAnyDSAKey = oldHasLegacyDSAKey || oldHasEdDSAKey;
BOOL newHasLegacyDSAKey = newPublicKeys.dsaPubKey != nil;
BOOL newHasEdDSAKey = newPublicKeys.ed25519PubKey != nil;
BOOL newHasAnyDSAKey = newHasLegacyDSAKey || newHasEdDSAKey;
BOOL migratesDSAKeys = oldHasLegacyDSAKey && !oldHasEdDSAKey && newHasEdDSAKey && !newHasLegacyDSAKey;
BOOL updateIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:newHost.bundle.bundleURL];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:host.bundle.bundleURL];
// Downgrade in DSA security should not be possible
if (publicDSAKey != nil && newPublicDSAKey == nil) {
SULog(SULogLevelError, @"A public DSA key is found in the old bundle but no public DSA key is found in the new update. For security reasons, the update will be rejected.");
// This is not essential for security, only a policy
if (oldHasAnyDSAKey && !newHasAnyDSAKey) {
SULog(SULogLevelError, @"A public (Ed)DSA key was found in the old bundle but no public (Ed)DSA key was found in the new update. Sparkle only supports rotation, but not removal of (Ed)DSA keys. Please add an EdDSA key to the new app.");
return NO;
}
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
// Security-critical part starts here
BOOL passedDSACheck = NO;
BOOL passedCodeSigning = NO;
if (oldHasAnyDSAKey) {
// it's critical to check against the old public key, rather than the new key
passedDSACheck = [SUSignatureVerifier validatePath:downloadedPath withSignatures:signatures withPublicKeys:publicKeys];
}
if (hostIsCodeSigned) {
NSError *error = nil;
passedCodeSigning = [SUCodeSigningVerifier codeSignatureAtBundleURL:host.bundle.bundleURL matchesSignatureAtBundleURL:newHost.bundle.bundleURL error:&error];
}
// End of security-critical part
// If the new DSA key differs from the old, then this check is not a security measure, because the new key is not trusted.
// In that case, the check ensures that the app author has correctly used DSA keys, so that the app will be updateable in the next version.
// However if the new and old DSA keys are the same, then this is a security measure.
if (newPublicDSAKey != nil) {
if (![SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:newPublicDSAKey]) {
SULog(SULogLevelError, @"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.",
dsaKeysMatch ? @"public key" : @"new public key shipped with the update");
if (!passedDSACheck && newHasAnyDSAKey) {
if (![SUSignatureVerifier validatePath:downloadedPath withSignatures:signatures withPublicKeys:newPublicKeys]) {
SULog(SULogLevelError, @"The update has a public (Ed)DSA key, but the public key shipped with the update doesn't match the signature. To prevent future problems, the update will be rejected.");
return NO;
}
}
BOOL updateIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:newHost.bundle.bundleURL];
if (dsaKeysMatch) {
NSError *error = nil;
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL error:&error]) {
SULog(SULogLevelError, @"The update archive has a valid DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
return NO;
}
NSError *error = nil;
if (passedDSACheck && updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL error:&error]) {
SULog(SULogLevelError, @"The update archive has a valid (Ed)DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
return NO;
}
// Either DSA must be valid, or Apple Code Signing must be valid.
// We allow failure of one of them, because this allows key rotation without breaking chain of trust.
if (passedDSACheck || passedCodeSigning) {
return YES;
}
// Now this just explains the failure
NSString *dsaStatus;
if (migratesDSAKeys) {
dsaStatus = @"migrates to new EdDSA keys without keeping the old DSA key for transition";
} else if (newHasAnyDSAKey) {
dsaStatus = @"has a new (Ed)DSA key that doesn't match the previous one";
} else if (oldHasAnyDSAKey) {
dsaStatus = @"removes the (Ed)DSA key";
} else {
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:host.bundle.bundleURL];
NSString *dsaStatus = newPublicDSAKey ? @"has a new DSA key that doesn't match the previous one" : (publicDSAKey ? @"removes the DSA key" : @"isn't signed with a DSA key");
if (!hostIsCodeSigned || !updateIsCodeSigned) {
NSString *acsStatus = !hostIsCodeSigned ? @"old app hasn't been signed with app Code Signing" : @"new app isn't signed with app Code Signing";
SULog(SULogLevelError, @"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
return NO;
}
NSError *error = nil;
if (![SUCodeSigningVerifier codeSignatureAtBundleURL:host.bundle.bundleURL matchesSignatureAtBundleURL:newHost.bundle.bundleURL error:&error]) {
SULog(SULogLevelError, @"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
return NO;
}
dsaStatus = @"isn't signed with an EdDSA key";
}
return YES;
if (!hostIsCodeSigned || !updateIsCodeSigned) {
NSString *acsStatus = !hostIsCodeSigned ? @"old app hasn't been signed with app Code Signing" : @"new app isn't signed with app Code Signing";
SULog(SULogLevelError, @"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
} else {
SULog(SULogLevelError, @"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
}
return NO;
}
@end
+14 -19
View File
@@ -25,6 +25,7 @@
#include <SystemConfiguration/SystemConfiguration.h>
#import "SUSystemProfiler.h"
#import "SUSystemUpdateInfo.h"
#import "SUSignatures.h"
NSString *const SUUpdaterDidFinishLoadingAppCastNotification = @"SUUpdaterDidFinishLoadingAppCastNotification";
NSString *const SUUpdaterDidFindValidUpdateNotification = @"SUUpdaterDidFindValidUpdateNotification";
@@ -68,7 +69,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
static NSMutableDictionary *sharedUpdaters = nil;
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
#ifdef DEBUG
// Debug is not defined in released builds and pedantic mode can enable -Wundef
#if defined(DEBUG) && DEBUG
+ (void)load
{
// Debug builds have different configurations for update check intervals
@@ -138,30 +140,23 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
}
-(void)checkIfConfiguredProperly {
BOOL hasPublicDSAKey = [self.host publicDSAKey] != nil;
BOOL hasPublicKey = self.host.publicKeys.dsaPubKey != nil || self.host.publicKeys.ed25519PubKey != nil;
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:self.host.bundle.bundleURL];
NSURL *feedURL = [self feedURL];
BOOL servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
if (!hasPublicDSAKey) {
// If we failed to retrieve a DSA key but the bundle specifies a path to one, we should consider this a configuration failure
NSString *publicDSAKeyFileKey = [self.host publicDSAKeyFileKey];
if (publicDSAKeyFileKey != nil) {
[self showAlertText:SULocalizedString(@"Insecure update error!", nil)
informativeText:[NSString stringWithFormat:SULocalizedString(@"For security reasons, the file (%@) indicated by the '%@' key needs to exist in the bundle's Resources.", nil), publicDSAKeyFileKey, SUPublicDSAKeyFileKey]];
if (!hasPublicKey) {
if (!isMainBundle) {
[self showAlertText:SULocalizedString(@"Auto-update not configured", nil)
informativeText:SULocalizedString(@"For security reasons, you need to sign your updates with a EdDSA key. See Sparkle's documentation for more information.", nil)];
} else {
if (!isMainBundle) {
[self showAlertText:SULocalizedString(@"Insecure update error!", nil)
informativeText:SULocalizedString(@"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", nil)];
} else {
if (!hostIsCodeSigned) {
[self showAlertText:SULocalizedString(@"Insecure update error!", nil)
informativeText:SULocalizedString(@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)];
} else if (!servingOverHttps) {
[self showAlertText:SULocalizedString(@"Insecure update error!", nil)
informativeText:SULocalizedString(@"For security reasons, you need to serve your updates over HTTPS and/or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)];
}
if (!hostIsCodeSigned) {
[self showAlertText:SULocalizedString(@"Auto-update not configured", nil)
informativeText:SULocalizedString(@"For security reasons, you need to code sign your application or sign your updates with a EdDSA key. See https://sparkle-project.org/documentation/ for more information.", nil)];
} else if (!servingOverHttps) {
[self showAlertText:SULocalizedString(@"Auto-update not configured", nil)
informativeText:SULocalizedString(@"For security reasons, you need to serve your updates over HTTPS and/or sign your updates with a EdDSA key. See https://sparkle-project.org/documentation/ for more information.", nil)];
}
}
}
+2 -2
View File
@@ -146,9 +146,9 @@ Gw
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="183">
<font key="font" metaFont="smallSystem"/>
<string key="title">La información de perfil de sistema anónimo se usa para ayudarnos a planear el trabajo de desarrollo futuro. Por favor, póngase en cantacto con nosotros si tiene preguntas sobre esto.
<string key="title">La información de perfil de sistema anónimo se usa para ayudarnos a planear el trabajo de desarrollo futuro. Por favor, póngase en contacto con nosotros si tiene preguntas sobre esto.
Esta es la información que se nos enviaría:</string>
Esta es la información que nos enviaría:</string>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
+5 -3
View File
@@ -16,11 +16,13 @@
"A new version of %@ is available!" = "גרסה חדשה של %@ זמינה!";
"An error occurred during installation. Please try again later." = "שגיאה בהתקנה. אנא נסה שנית במועד מרוחר יותר.";
"Cancel Update" = "בטל עדכון";
"An error occurred in retrieving update information. Please try again later." = "שגיאה בקבלת מידע על עדכונים. אנא נסה שנית במועד מרוחר יותר.";
"An error occurred during installation. Please try again later." = "שגיאה בהתקנה. אנא נסה שנית במועד מאוחר יותר.";
"An error occurred while extracting the archive. Please try again later." = "שגיאה בפתיחת הקובת המקווץ. אנא נסה שנית במועד מרוחר יותר.";
"An error occurred in retrieving update information. Please try again later." = "שגיאה בקבלת מידע על עדכונים. אנא נסה שנית במועד מאוחר יותר.";
"An error occurred while extracting the archive. Please try again later." = "שגיאה בפתיחת הקובת המקווץ. אנא נסה שנית במועד מאוחר יותר.";
"An error occurred while trying to download the file. Please try again later." = "שגיאה בהורדת הקובץ. אנא נסה שנית במועד מאוחר יותר.";
+119
View File
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G22010" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUAutomaticUpdateAlert">
<connections>
<outlet property="installButton" destination="15" id="VHi-SZ-6td"/>
<outlet property="laterButton" destination="16" id="AZg-1M-E8w"/>
<outlet property="skipButton" destination="30" id="LpO-Ax-F1B"/>
<outlet property="window" destination="5" id="22"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUAutomaticUpdateAlert" animationBehavior="default" id="5" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="114" y="521" width="616" height="152"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
<value key="minSize" type="size" width="511" height="152"/>
<view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="616" height="152"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView id="7">
<rect key="frame" x="23" y="73" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="38"/>
<connections>
<binding destination="-2" name="value" keyPath="applicationIcon" id="10"/>
</connections>
</imageView>
<textField verticalHuggingPriority="750" id="8">
<rect key="frame" x="105" y="120" width="497" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="39">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="titleText" id="11"/>
</connections>
</textField>
<textField verticalHuggingPriority="750" id="9">
<rect key="frame" x="105" y="81" width="497" height="31"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="40">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="descriptionText" id="14"/>
</connections>
</textField>
<button verticalHuggingPriority="750" misplaced="YES" id="15">
<rect key="frame" x="407" y="12" width="195" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<buttonCell key="cell" type="push" title="Instaliraj i ponovo pokreni" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="41">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="installNow:" target="-2" id="33"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="30">
<rect key="frame" x="102" y="12" width="116" height="32"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="push" title="Ne instaliraj" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="44">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="doNotInstall:" target="-2" id="35"/>
</connections>
</button>
<button id="17">
<rect key="frame" x="105" y="58" width="619" height="18"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="check" title="Ubuduće preuzmi i instaliraj nadogradnje automatski" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="43">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="18" name="value" keyPath="values.SUAutomaticallyUpdate" id="19"/>
</connections>
</button>
<button verticalHuggingPriority="750" misplaced="YES" id="16">
<rect key="frame" x="261" y="12" width="143" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<buttonCell key="cell" type="push" title="Instaliraj i zatvori" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="42">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
</buttonCell>
<connections>
<action selector="installLater:" target="-2" id="34"/>
</connections>
</button>
</subviews>
</view>
</window>
<userDefaultsController representsSharedInstance="YES" id="18" userLabel="Shared Defaults"/>
</objects>
<resources>
<image name="NSApplicationIcon" width="128" height="128"/>
</resources>
</document>
+248
View File
@@ -0,0 +1,248 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G22010" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="11762"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdateAlert">
<connections>
<outlet property="automaticallyInstallUpdatesButton" destination="117" id="o2H-xw-Qv8"/>
<outlet property="descriptionField" destination="101" id="9oA-2S-eXN"/>
<outlet property="installButton" destination="76" id="176"/>
<outlet property="laterButton" destination="22" id="177"/>
<outlet property="releaseNotesContainerView" destination="fKC-QA-GZa" id="BYw-MA-Z5h"/>
<outlet property="releaseNotesView" destination="18" id="32"/>
<outlet property="skipButton" destination="23" id="178"/>
<outlet property="window" destination="5" id="69"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window identifier="SUUpdateAlert" title="Aktualiziranje programskog paketa" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUUpdateAlert" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="746" y="229" width="620" height="370"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<value key="minSize" type="size" width="550" height="150"/>
<value key="maxSize" type="size" width="700" height="600"/>
<view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="620" height="370"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="7" userLabel="Program icon">
<rect key="frame" x="22" y="286" width="64" height="64"/>
<constraints>
<constraint firstAttribute="width" secondItem="7" secondAttribute="height" multiplier="1:1" id="7pS-Kw-VGo"/>
<constraint firstAttribute="width" priority="800" constant="64" id="QhW-E9-8Br"/>
<constraint firstAttribute="height" priority="800" constant="64" id="aXh-vN-k5u"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="168"/>
<connections>
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
</connections>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="10" userLabel="Version text field">
<rect key="frame" x="106" y="338" width="494" height="17"/>
<constraints>
<constraint firstAttribute="height" priority="777" constant="17" id="n8w-DR-XEM"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" usesSingleLineMode="YES" id="169">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="titleText" id="11"/>
</connections>
</textField>
<textField horizontalHuggingPriority="350" verticalHuggingPriority="999" horizontalCompressionResistancePriority="100" verticalCompressionResistancePriority="1000" preferredMaxLayoutWidth="490" translatesAutoresizingMaskIntoConstraints="NO" id="101" userLabel="Question text field">
<rect key="frame" x="106" y="316" width="494" height="14"/>
<constraints>
<constraint firstAttribute="height" relation="lessThanOrEqual" priority="300" constant="28" id="H6E-te-Fog"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="KUO-Dw-g6s"/>
</constraints>
<textFieldCell key="cell" allowsUndo="NO" sendsActionOnEndEditing="YES" id="174">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="descriptionText" id="103"/>
</connections>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="fKC-QA-GZa" userLabel="Container to hide release notes">
<rect key="frame" x="108" y="74" width="492" height="234"/>
<subviews>
<box boxType="oldStyle" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="89">
<rect key="frame" x="0.0" y="0.0" width="492" height="214"/>
<view key="contentView" id="hbB-V1-Bf6">
<rect key="frame" x="1" y="1" width="490" height="212"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView maintainsBackForwardList="NO" translatesAutoresizingMaskIntoConstraints="NO" id="18">
<rect key="frame" x="0.0" y="-2" width="492" height="214"/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" minimumFontSize="7" plugInsEnabled="NO" javaEnabled="NO" javaScriptCanOpenWindowsAutomatically="NO">
<nil key="identifier"/>
</webPreferences>
<connections>
<binding destination="-2" name="hidden" keyPath="showsReleaseNotes" id="161">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</webView>
</subviews>
</view>
<constraints>
<constraint firstItem="18" firstAttribute="top" secondItem="89" secondAttribute="top" constant="1" id="3ps-Yo-uZA"/>
<constraint firstAttribute="trailing" secondItem="18" secondAttribute="trailing" constant="-1" id="5W0-Eb-Snn"/>
<constraint firstAttribute="bottom" secondItem="18" secondAttribute="bottom" constant="-1" id="NOY-VJ-z4I"/>
<constraint firstItem="18" firstAttribute="leading" secondItem="89" secondAttribute="leading" constant="1" id="kSE-Xj-CRB"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="100" id="pvn-8k-9Ev"/>
</constraints>
<font key="titleFont" size="11" name="LucidaGrande"/>
<connections>
<binding destination="-2" name="hidden" keyPath="showsReleaseNotes" id="164">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</box>
<textField verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="17">
<rect key="frame" x="-2" y="220" width="111" height="14"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="100" constant="100" id="gkn-FW-9aC"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Napomene izdanja:" usesSingleLineMode="YES" id="170">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="hidden" keyPath="showsReleaseNotes" id="72">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="89" firstAttribute="top" secondItem="17" secondAttribute="bottom" constant="6" id="1H8-33-yNF"/>
<constraint firstAttribute="trailing" secondItem="89" secondAttribute="trailing" id="Bv8-Jz-SXd"/>
<constraint firstAttribute="bottom" secondItem="89" secondAttribute="bottom" id="E4h-VA-0Xt"/>
<constraint firstItem="17" firstAttribute="top" secondItem="fKC-QA-GZa" secondAttribute="top" id="P9G-6a-y7j"/>
<constraint firstItem="89" firstAttribute="leading" secondItem="fKC-QA-GZa" secondAttribute="leading" id="e5T-q1-kq1"/>
<constraint firstItem="17" firstAttribute="leading" secondItem="fKC-QA-GZa" secondAttribute="leading" id="tFH-k0-O7I"/>
</constraints>
</customView>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="998" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="103" y="12" width="169" height="32"/>
<buttonCell key="cell" type="push" title="Zanemari ovu inačicu" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="172">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="skipThisVersion:" target="-2" id="33"/>
</connections>
</button>
<button horizontalHuggingPriority="20" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="76">
<rect key="frame" x="435" y="12" width="171" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="120" id="N94-uf-6oP"/>
</constraints>
<buttonCell key="cell" type="push" title="Instaliraj nadogradnju" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" inset="2" id="173">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="installUpdate:" target="-2" id="77"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="117">
<rect key="frame" x="106" y="49" width="495" height="20"/>
<constraints>
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="28" id="0AI-ue-a0r"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="yM1-TA-HfP"/>
</constraints>
<buttonCell key="cell" type="check" title="Ubuduće preuzmi i instaliraj nadogradnje automatski" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="-2" name="hidden" keyPath="allowsAutomaticUpdates" id="141">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="93" name="value" keyPath="values.SUAutomaticallyUpdate" id="135"/>
</connections>
</button>
<button horizontalHuggingPriority="150" verticalHuggingPriority="750" horizontalCompressionResistancePriority="997" translatesAutoresizingMaskIntoConstraints="NO" id="22">
<rect key="frame" x="279" y="12" width="156" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="90" id="2Zy-5G-GBj"/>
</constraints>
<buttonCell key="cell" type="push" title="Podsjeti me kasnije" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="171">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
</buttonCell>
<connections>
<action selector="remindMeLater:" target="-2" id="34"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="10" firstAttribute="leading" secondItem="7" secondAttribute="trailing" constant="22" id="2ef-4I-Il3"/>
<constraint firstAttribute="trailing" secondItem="fKC-QA-GZa" secondAttribute="trailing" constant="20" id="406-Cn-C5d"/>
<constraint firstItem="101" firstAttribute="leading" secondItem="10" secondAttribute="leading" id="7XS-9C-U6N"/>
<constraint firstItem="23" firstAttribute="top" secondItem="117" secondAttribute="bottom" constant="12" id="CBk-cX-pk2"/>
<constraint firstItem="22" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="23" secondAttribute="trailing" constant="12" id="EeC-NR-NYg"/>
<constraint firstAttribute="trailing" secondItem="76" secondAttribute="trailing" constant="20" id="GdV-QF-Cdi"/>
<constraint firstItem="76" firstAttribute="width" secondItem="22" secondAttribute="width" multiplier="0.8" priority="110" id="I8t-73-gX0"/>
<constraint firstItem="117" firstAttribute="top" secondItem="fKC-QA-GZa" secondAttribute="bottom" priority="900" constant="8" id="M7E-UY-nWx"/>
<constraint firstItem="fKC-QA-GZa" firstAttribute="top" secondItem="101" secondAttribute="bottom" constant="8" id="Mbz-C0-6Cx"/>
<constraint firstItem="117" firstAttribute="leading" secondItem="23" secondAttribute="leading" id="Nm4-V1-7X0"/>
<constraint firstItem="23" firstAttribute="leading" secondItem="117" secondAttribute="leading" id="OXY-8u-ljs"/>
<constraint firstItem="23" firstAttribute="leading" secondItem="10" secondAttribute="leading" constant="1" id="RRB-n5-xid"/>
<constraint firstItem="76" firstAttribute="leading" secondItem="22" secondAttribute="trailing" constant="12" id="VQk-Ut-ggj"/>
<constraint firstItem="7" firstAttribute="top" secondItem="6" secondAttribute="top" constant="20" id="alH-AL-5RD"/>
<constraint firstItem="22" firstAttribute="baseline" secondItem="23" secondAttribute="baseline" id="ayY-6b-JGg"/>
<constraint firstItem="76" firstAttribute="baseline" secondItem="22" secondAttribute="baseline" id="dIR-3Q-wQx"/>
<constraint firstAttribute="bottom" secondItem="76" secondAttribute="bottom" constant="19" id="gcR-Kl-Wlq"/>
<constraint firstAttribute="trailing" secondItem="101" secondAttribute="trailing" constant="22" id="k7p-HC-x7i"/>
<constraint firstItem="fKC-QA-GZa" firstAttribute="leading" secondItem="23" secondAttribute="leading" constant="-1" id="nVW-Qt-8JE"/>
<constraint firstAttribute="trailing" secondItem="10" secondAttribute="trailing" constant="22" id="oQx-Oc-awc"/>
<constraint firstItem="76" firstAttribute="width" secondItem="23" secondAttribute="width" priority="109" id="pLI-z3-P0b"/>
<constraint firstItem="fKC-QA-GZa" firstAttribute="leading" secondItem="10" secondAttribute="leading" id="qQ9-OJ-06z"/>
<constraint firstItem="101" firstAttribute="top" secondItem="10" secondAttribute="bottom" constant="8" id="r7Q-z5-jkx"/>
<constraint firstItem="10" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="rXd-o0-WQQ"/>
<constraint firstAttribute="trailing" secondItem="117" secondAttribute="trailing" constant="21" id="sHI-Hm-eSA"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="22" id="zSE-lw-Ggj"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="50"/>
</connections>
<point key="canvasLocation" x="466" y="290"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="93" userLabel="Shared Defaults"/>
</objects>
<resources>
<image name="NSApplicationIcon" width="128" height="128"/>
</resources>
</document>
+227
View File
@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G22010" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt">
<connections>
<outlet property="cancelButton" destination="14" id="gmk-EB-rHf"/>
<outlet property="checkButton" destination="13" id="JAM-bi-JDs"/>
<outlet property="descriptionTextField" destination="33" id="133"/>
<outlet property="moreInfoButton" destination="71" id="132"/>
<outlet property="moreInfoView" destination="39" id="127"/>
<outlet property="profileTableView" destination="41" id="187"/>
<outlet property="window" destination="5" id="126"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Profile Info">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="83" y="492" width="438" height="168"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<value key="minSize" type="size" width="213" height="107"/>
<view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="438" height="168"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" misplaced="YES" tag="1" id="13">
<rect key="frame" x="247" y="12" width="177" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<buttonCell key="cell" type="push" title="Provjeravaj automatski" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" tag="1" inset="2" id="176">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="finishPrompt:" target="-2" id="144"/>
</connections>
</button>
<textField verticalHuggingPriority="750" misplaced="YES" id="32">
<rect key="frame" x="104" y="114" width="289" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Provjeravaj nadogradnje automatski?" id="178">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="33">
<rect key="frame" x="104" y="81" width="315" height="42"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="DO NOT LOCALIZE" id="179">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="promptDescription" id="161"/>
</connections>
</textField>
<button focusRingType="none" id="34">
<rect key="frame" x="104" y="53" width="278" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Uključi anonimizirane podatke o profilu sustava" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" focusRingType="none" inset="2" id="180">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="-2" name="hidden" keyPath="shouldAskAboutProfile" id="143">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
<binding destination="-2" name="value" keyPath="shouldSendProfile" id="148">
<dictionary key="options">
<integer key="NSNullPlaceholder" value="1"/>
<bool key="NSValidatesImmediately" value="YES"/>
</dictionary>
</binding>
</connections>
</button>
<imageView id="37">
<rect key="frame" x="23" y="84" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="axesIndependently" image="NSApplicationIcon" id="181"/>
<connections>
<binding destination="-2" name="value" keyPath="icon" id="130"/>
</connections>
</imageView>
<button focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" id="71">
<rect key="frame" x="80" y="50" width="27" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="disclosureTriangle" bezelStyle="disclosure" imagePosition="overlaps" alignment="center" borderStyle="border" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="182">
<behavior key="behavior" pushIn="YES" changeBackground="YES" changeGray="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleMoreInfo:" target="-2" id="131"/>
<binding destination="-2" name="hidden" keyPath="shouldAskAboutProfile" id="139">
<dictionary key="options">
<string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
</button>
<button verticalHuggingPriority="750" misplaced="YES" id="14">
<rect key="frame" x="100" y="12" width="127" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES"/>
<buttonCell key="cell" type="push" title="Ne provjeravaj" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="177">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
Gw
</string>
</buttonCell>
<connections>
<action selector="finishPrompt:" target="-2" id="145"/>
</connections>
</button>
</subviews>
</view>
</window>
<arrayController editable="NO" preservesSelection="NO" selectsInsertedObjects="NO" avoidsEmptySelection="NO" id="24" userLabel="Array Controller">
<declaredKeys>
<string>visibleKey</string>
<string>visibleValue</string>
<string>displayValue</string>
<string>displayKey</string>
</declaredKeys>
<connections>
<binding destination="-2" name="contentArray" keyPath="systemProfileInformationArray" id="25"/>
</connections>
</arrayController>
<customView id="39" userLabel="MoreInfoView">
<rect key="frame" x="0.0" y="0.0" width="362" height="205"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" id="46">
<rect key="frame" x="1" y="128" width="358" height="70"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="183">
<font key="font" metaFont="smallSystem"/>
<string key="title">Anonymous system profile information is used to help us plan future development work. Please contact us if you have any questions about this.
This is the information that would be sent:</string>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="0.0" verticalLineScroll="16" verticalPageScroll="0.0" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="40">
<rect key="frame" x="4" y="5" width="355" height="115"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="sbp-rk-wxX">
<rect key="frame" x="1" y="1" width="353" height="113"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" id="41">
<rect key="frame" x="0.0" y="0.0" width="353" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn editable="NO" width="128" minWidth="40" maxWidth="1000" id="42">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
</tableHeaderCell>
<textFieldCell key="dataCell" controlSize="small" selectable="YES" alignment="left" title="Text Cell" id="43">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="24" name="value" keyPath="arrangedObjects.displayKey" id="174"/>
</connections>
</tableColumn>
<tableColumn editable="NO" width="219" minWidth="40" maxWidth="1000" id="44">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
</tableHeaderCell>
<textFieldCell key="dataCell" controlSize="small" selectable="YES" alignment="left" title="Text Cell" id="45">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<connections>
<binding destination="24" name="value" keyPath="arrangedObjects.displayValue" id="173"/>
</connections>
</tableColumn>
</tableColumns>
</tableView>
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="YES" id="185">
<rect key="frame" x="-100" y="-100" width="345" height="11"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" controlSize="small" horizontal="NO" id="184">
<rect key="frame" x="-22" y="1" width="11" height="125"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
</customView>
<userDefaultsController id="49" userLabel="User Defaults Controller">
<declaredKeys>
<string>SUIncludeProfile</string>
<string>SUSendProfileInfo</string>
</declaredKeys>
</userDefaultsController>
</objects>
<resources>
<image name="NSApplicationIcon" width="128" height="128"/>
</resources>
</document>
+89
View File
@@ -0,0 +1,89 @@
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ je preuzeto i spremno za upotrebu! Ovo je važna nadogradnja. Želiš li je sada instalirati, te ponovo pokrenuti %1$@?";
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ je preuzeto i spremno za upotrebu! Želiš li je sada instalirati, te ponovo pokrenuti %1$@?";
"%1$@ can't be updated, because it was opened from a read-only or a temporary location. Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "%1$@ nije moguće aktualizirati, jer je pokrenuto s lokacije bez korisničkih prava pisanja, npr. dmg. Kopiraj %1$@ u mapu Aplikacije, pokreni je odande i pokušaj ponovo.";
"%@ %@ is currently the newest version available." = "%1$@ %2$@ je trenutačno najnovija dostupna inačica.";
/* Description text for SUUpdateAlert when the update is downloadable. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ je sada dostupna. Ti koristiš inačicu %3$@. Želiš li je sada preuzeti?";
/* Description text for SUUpdateAlert when the update informational with no download. */
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ je sada dostupna. Ti koristiš inačicu %3$@. Želiš li saznati više o ovoj nadogradnji na webu?";
"%@ downloaded" = "%@ preuzeto";
"%@ of %@" = "%1$@ od %2$@";
"A new version of %@ is available!" = "Dostupna je nova inačica za %@!";
"A new version of %@ is ready to install!" = "Nova inačica za %@ je spremna za instaliranje!";
"An error occurred in retrieving update information. Please try again later." = "Dogodila se greška u dohvaćanju informacija o nadogradnji. Pokušaj kasnije ponovo.";
"An error occurred while downloading the update. Please try again later." = "Dogodila se greška prilikom preuzimanja nadogradnje. Pokušaj kasnije ponovo.";
"An error occurred while extracting the archive. Please try again later." = "Dogodila se greška prilikom raspakiranja arhive. Pokušaj kasnije ponovo.";
"An error occurred while installing the update. Please try again later." = "Dogodila se greška prilikom instaliranja nadogradnje. Pokušaj kasnije ponovo.";
"An error occurred while parsing the update feed." = "Dogodila se greška prilikom analize nadogradnje.";
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Dogodila se greška prilikom ponovog pokretanja %1$@. Unatoč tome, nova inačica će biti dostupna prilikom idućeg pokretanja %1$@.";
"An important update to %@ is ready to install" = "Važna nadogradnja za %@ je spremna za instaliranje";
/* the unit for bytes */
"B" = "B";
"Cancel" = "Odustani";
"Cancel Update" = "Odustani od aktualiziranja";
"Checking for updates..." = "Provjera nadogradnji …";
/* Take care not to overflow the status window. */
"Downloading update..." = "Preuzimanje nadogradnje …";
/* Take care not to overflow the status window. */
"Extracting update..." = "Raspakiravanje nadogradnje …";
/* the unit for gigabytes */
"GB" = "GB";
"Install and Relaunch" = "Instaliraj i ponovo pokreni";
/* Take care not to overflow the status window. */
"Installing update..." = "Instaliranje nadogradnje …";
/* the unit for kilobytes */
"KB" = "KB";
/* Alternative name for "Install" button if we have a paid update or other update
without a download but with a URL. */
"Learn More..." = "Saznaj više …";
/* the unit for megabytes */
"MB" = "MB";
/* OK button. */
"OK" = "OK";
/* Status message on progress window once download has finished. */
"Ready to Install" = "Spremno za instaliranje";
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Da li da %1$@ automatski provjerava nadogradnje? Nadogradnje možeš i ručno provjeriti u %1$@ izborniku.";
"The update is improperly signed." = "Nadogradnja ima neispravnu signaturu.";
"Update Error!" = "Greška prilikom aktualiziranja!";
"Updating %@" = "Aktualiziranje %@";
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
"You already have the newest version of %@." = "Već koristiš najnoviju inačicu za %@.";
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
"You're up-to-date!" = "Koristiš najnoviju inačicu!";
+10 -23
View File
@@ -10,6 +10,7 @@
#import "SUUpdateSettingsWindowController.h"
#import "SUFileManager.h"
#import "SUTestWebServer.h"
#import "../ed25519/src/ed25519.h" // run `git submodule update --init` if you get an erorr here
@interface SUTestApplicationDelegate ()
@@ -117,32 +118,18 @@ static NSString * const UPDATED_VERSION = @"2.0";
// Don't ever do this at home, kids (seriously)
// (that is, including the private key inside of your application)
NSString *privateKeyPath = [mainBundle pathForResource:@"test_app_only_dsa_priv_dont_ever_do_this_for_real" ofType:@"pem"];
assert(privateKeyPath != nil);
// Sign our update
NSTask *signUpdateTask = [[NSTask alloc] init];
NSString *signUpdatePath = [mainBundle pathForResource:@"sign_update" ofType:@""];
assert(signUpdatePath != nil);
signUpdateTask.launchPath = signUpdatePath;
const unsigned char self_sign_demo_only_insecure_hack[64] = {200, 238, 135, 84, 10, 189, 3, 193, 61, 208, 203, 30, 133, 47, 12, 22, 19, 52, 252, 99, 110, 205, 209, 94, 215, 144, 201, 70, 27, 162, 163, 108, 0, 164, 68, 184, 226, 93, 121, 199, 172, 17, 26, 64, 89, 68, 232, 41, 2, 26, 245, 175, 158, 165, 42, 55, 5, 97, 8, 243, 251, 164, 93, 9};
// in normal app this goes to Info.plist
const unsigned char public_key[32] = {121, 17, 79, 45, 155, 141, 51, 169, 188, 110, 91, 102, 182, 147, 215, 225, 252, 202, 110, 231, 200, 215, 62, 171, 40, 145, 237, 128, 130, 44, 150, 89};
unsigned char signature[64];
NSURL *archiveURL = [serverDirectoryURL URLByAppendingPathComponent:zipName];
NSString *path = archiveURL.path;
assert(path != nil);
signUpdateTask.arguments = @[path, privateKeyPath];
NSData *archive = [NSData dataWithContentsOfURL:archiveURL];
assert(archive != nil);
NSPipe *outputPipe = [NSPipe pipe];
signUpdateTask.standardOutput = outputPipe;
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
[signUpdateTask launch];
[signUpdateTask waitUntilExit];
assert(signUpdateTask.terminationStatus == 0);
NSData *signatureData = [outputPipe.fileHandleForReading readDataToEndOfFile];
NSString *signature = [[[NSString alloc] initWithData:signatureData encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
assert(signature != nil);
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64Encoding];
// Obtain the file attributes to get the file size of our update later
NSError *fileAttributesError = nil;
@@ -179,7 +166,7 @@ static NSString * const UPDATED_VERSION = @"2.0";
NSUInteger numberOfLengthReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_ARCHIVE_LENGTH" withString:[NSString stringWithFormat:@"%llu", archiveFileAttributes.fileSize] options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
assert(numberOfLengthReplacements == 1);
NSUInteger numberOfSignatureReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_DSA_SIGNATURE" withString:signature options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
NSUInteger numberOfSignatureReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_EDDSA_SIGNATURE" withString:signatureString options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
assert(numberOfSignatureReplacements == 1);
NSError *writeAppcastError = nil;
+4 -4
View File
@@ -17,9 +17,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.5</string>
<string>1.5.1</string>
<key>CFBundleShortVersionString</key>
<string>1.5</string>
<string>1.5.1</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -28,8 +28,8 @@
<true/>
<key>SUFeedURL</key>
<string>http://localhost:1337/sparkletestcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>test_app_only_dsa_pub.pem</string>
<key>SUPublicEDKey</key>
<string>eRFPLZuNM6m8bltmtpPX4fzKbufI1z6rKJHtgIIsllk=</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
@@ -0,0 +1,3 @@
/* Localized versions of Info.plist keys */
NSHumanReadableCopyright = "© Andy Matuschak, 2006";
+2 -2
View File
@@ -12,12 +12,12 @@
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li>Suspendisse sed felis ac ante ultrices rhoncus. Etiam quis elit vel nibh placerat facilisis in id leo.</li>
<li>Vestibulum nec tortor odio, nec malesuada libero. Cras vel convallis nunc.</li>
<li>Suspendisse tristique massa eget velit consequat tincidunt. Praesent sodales hendrerit pretium.</li>
<li>Suspendisse tristique massa eget velit consequat tincidunt. Praesent sodales hendrerit <a href="#">pretium</a>.</li>
</ul>
]]>
</description>
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:dsaSignature="$INSERT_DSA_SIGNATURE" />
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
</item>
</channel>
</rss>
@@ -1,36 +0,0 @@
-----BEGIN DSA PRIVATE KEY-----
MIIGPgIBAAKCAgEAvvs5v/Vbc6gYls5WnHUmWy9rhUsuAvf+HAuz9Tzp63fb8Cni
8aqe+qkiL3RKuabl92BAK7Vwv4EMOXozDlNPWZS5EZUBZuiQ7vtQC9Eg3C68KWwb
lrhSwzyVnXz8twD75CiR+oPSZEIiOQ81Ok///i1+TV17ierbLxYJ2Sd1wTRQdLeS
7rmnL6aLka0PNtsFvFlvW9GbrlNP9PZaGmrJYadsTV5+F9XZRFnwZc6crmrIo+DA
VNucgqBdZUNN0CWz9OJfKr/GKMw+blTF2WixDnGH2FKtNh7QSuRwlvioXBjYJbX4
UV6jJqxZdLUMSm9iZteC8Q34cFVwrPizwRBO/8Yx/htFPrvyIkD0uvfMO55dbkld
0nWfbHcUJRHjSEOPahOlHHGejmLWEsBtp9vD453czFXi19GhR98gEaXmcbwOr4gH
A1WHTqOwUx6Ll+AFWG5nyZIKB9SxMUBWu0znVg9d9wqYAL0/aBWhXEFe86xYdReK
z0RvnTRyVDbIGhMrRMviyaiTGHBbJVC62Appp/fl8o0HFSKJfTwhRSfmLupqt0XE
C1GTbSZ9l04fsryY/dyyuO+E3e/+Q1jxyqrdJI9mhkUY2w4FWmaovScWNbekwhXb
qy6+bsY2ZyuNGjR/S0xFyHw95l5VGiHeyXD+bWg9lYQzIULjX3zTAU6FFYMCFQCu
tNIHrUBezHQxUxsQDgGubSZ90wKCAgAKHL/AbnSnGcoDNw2tDTrfYvQQH1CN8/yx
0X1ryUwzn9BJYCzl6NTaHZx/LSwhSasNRmiSlp95YqhLa31xJDPaHVZH8SDLyCSn
rBWCrKaKT8U3PKl71WUnxttYIyMTyNYh6ef+OP1uxDnOn0asWYinbDEM5E6CrRmW
AoKx0yDgchiyOMGiwCuTN1Z7fx0AL8Y+JZ1ulOJjwd+qBaPIT/tduz5fKzEvfpHy
6seOaRAuj/CNx1svSiCi16nlHZjlFlbzE5+IlX5iOvSEroacGbj7FHmHlRTpdgBo
Ez6uzSV3drPDmsH9jb0nvhy/MAkBrHVOm4jj77613nD/QlO3Ilrox5+O1LuYrU6c
gy5ZEek093QUsazHonjZc+btYIshs4FTWG9gBbZRQbJy0cOlNei0XcwIHOWqJXOJ
LWpV1ZXu2IxLhfbg4Nt02z1CNHTm+VKD8UPyUCk8Mf9SuPUzRXeWMiLE57+8hsUs
BcMvvURRgHZqVaNdO5ktb+i/g0zhEIFaOyfCAwZKNzLyz/JuwosbOruLMW0YCnaO
mj9YvO0MQ+zHcd806n/9t8sig69zU/4wg9lxJrgWvf3LbjwBii143nDcSu3DGaZj
Ti9ZAj19AbUX3PB44m9TDxFwTDTFI+xp8HSVtlWx1Pt2KXbsxD5mP1LEpHpq1GOB
7zLcRL1F1wKCAgEAlikrAItC1I6mHKst1GQLDr9c07OuIJA+GJIJB6Iq/K/CjdUA
Rjv/3L6l4pP33VAZySh6jqMe3Qm9W0ZZ687YSuVWRCsl2yKWAWuqXm8zaEijaHZR
Sa6tygj9EUMZ2zbJEOPihIdWB+fHcwd01KAqUzYZEWZvw7fLZNE2QM0emQai3U1V
3SXYney1qXW9lJ38EjB4LrYzcDFZaNKXidvXo3nI66M1MgI9lAltmRLGAOJmV6bL
KvJEFVpSux5cubXISPQBlAw9Zb15UPc3IAe82jX7ccsI8RHe5xeIepZ0c7xnk+J8
sFrgBrlN1swki2WfGavQOsV9kZg79rYCB3fOtxRsCBcQOasL295YWtQh5g/dCQWA
JMx+6SVMWwr//0YSu361zJakdFz/vssVVGkaun0bM2YTOYP1ZZp6LyHwIrWEqh9m
d2v2NAX1h4LktrJ8OHgBV/z6/YzFOlsa424Dvl1jnUozK1RDX5/z2FnX1J22hNSY
fx2M8wTD09+xwJyFOzT8g/pjkKvYMgvnWVjvONwvM5nc2OFzuHl9JVvdF5LbSYPO
M/KkRrtg+denjT4/fwp16gGcCsIf+RbEDN1F9rWg5hNPKteVkrMl6suuZZOu7H7E
uZIiEcW3bxXYiN8LLXwS4G6VH+9fsUmSusJZKxhBuRThzehy0n6lfgSRRGICFBi3
z3tWjm2F6noctsjrVH5d0jRZ
-----END DSA PRIVATE KEY-----
-36
View File
@@ -1,36 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIGOzCCBC0GByqGSM44BAEwggQgAoICAQC++zm/9VtzqBiWzlacdSZbL2uFSy4C
9/4cC7P1POnrd9vwKeLxqp76qSIvdEq5puX3YEArtXC/gQw5ejMOU09ZlLkRlQFm
6JDu+1AL0SDcLrwpbBuWuFLDPJWdfPy3APvkKJH6g9JkQiI5DzU6T//+LX5NXXuJ
6tsvFgnZJ3XBNFB0t5LuuacvpouRrQ822wW8WW9b0ZuuU0/09loaaslhp2xNXn4X
1dlEWfBlzpyuasij4MBU25yCoF1lQ03QJbP04l8qv8YozD5uVMXZaLEOcYfYUq02
HtBK5HCW+KhcGNgltfhRXqMmrFl0tQxKb2Jm14LxDfhwVXCs+LPBEE7/xjH+G0U+
u/IiQPS698w7nl1uSV3SdZ9sdxQlEeNIQ49qE6UccZ6OYtYSwG2n28PjndzMVeLX
0aFH3yARpeZxvA6viAcDVYdOo7BTHouX4AVYbmfJkgoH1LExQFa7TOdWD133CpgA
vT9oFaFcQV7zrFh1F4rPRG+dNHJUNsgaEytEy+LJqJMYcFslULrYCmmn9+XyjQcV
Iol9PCFFJ+Yu6mq3RcQLUZNtJn2XTh+yvJj93LK474Td7/5DWPHKqt0kj2aGRRjb
DgVaZqi9JxY1t6TCFdurLr5uxjZnK40aNH9LTEXIfD3mXlUaId7JcP5taD2VhDMh
QuNffNMBToUVgwIVAK600getQF7MdDFTGxAOAa5tJn3TAoICAAocv8BudKcZygM3
Da0NOt9i9BAfUI3z/LHRfWvJTDOf0ElgLOXo1NodnH8tLCFJqw1GaJKWn3liqEtr
fXEkM9odVkfxIMvIJKesFYKspopPxTc8qXvVZSfG21gjIxPI1iHp5/44/W7EOc6f
RqxZiKdsMQzkToKtGZYCgrHTIOByGLI4waLAK5M3Vnt/HQAvxj4lnW6U4mPB36oF
o8hP+127Pl8rMS9+kfLqx45pEC6P8I3HWy9KIKLXqeUdmOUWVvMTn4iVfmI69ISu
hpwZuPsUeYeVFOl2AGgTPq7NJXd2s8Oawf2NvSe+HL8wCQGsdU6biOPvvrXecP9C
U7ciWujHn47Uu5itTpyDLlkR6TT3dBSxrMeieNlz5u1giyGzgVNYb2AFtlFBsnLR
w6U16LRdzAgc5aolc4ktalXVle7YjEuF9uDg23TbPUI0dOb5UoPxQ/JQKTwx/1K4
9TNFd5YyIsTnv7yGxSwFwy+9RFGAdmpVo107mS1v6L+DTOEQgVo7J8IDBko3MvLP
8m7Cixs6u4sxbRgKdo6aP1i87QxD7Mdx3zTqf/23yyKDr3NT/jCD2XEmuBa9/ctu
PAGKLXjecNxK7cMZpmNOL1kCPX0BtRfc8Hjib1MPEXBMNMUj7GnwdJW2VbHU+3Yp
duzEPmY/UsSkemrUY4HvMtxEvUXXA4ICBgACggIBAJYpKwCLQtSOphyrLdRkCw6/
XNOzriCQPhiSCQeiKvyvwo3VAEY7/9y+peKT991QGckoeo6jHt0JvVtGWevO2Erl
VkQrJdsilgFrql5vM2hIo2h2UUmurcoI/RFDGds2yRDj4oSHVgfnx3MHdNSgKlM2
GRFmb8O3y2TRNkDNHpkGot1NVd0l2J3stal1vZSd/BIweC62M3AxWWjSl4nb16N5
yOujNTICPZQJbZkSxgDiZlemyyryRBVaUrseXLm1yEj0AZQMPWW9eVD3NyAHvNo1
+3HLCPER3ucXiHqWdHO8Z5PifLBa4Aa5TdbMJItlnxmr0DrFfZGYO/a2Agd3zrcU
bAgXEDmrC9veWFrUIeYP3QkFgCTMfuklTFsK//9GErt+tcyWpHRc/77LFVRpGrp9
GzNmEzmD9WWaei8h8CK1hKofZndr9jQF9YeC5LayfDh4AVf8+v2MxTpbGuNuA75d
Y51KMytUQ1+f89hZ19SdtoTUmH8djPMEw9PfscCchTs0/IP6Y5Cr2DIL51lY7zjc
LzOZ3Njhc7h5fSVb3ReS20mDzjPypEa7YPnXp40+P38KdeoBnArCH/kWxAzdRfa1
oOYTTyrXlZKzJerLrmWTrux+xLmSIhHFt28V2IjfCy18EuBulR/vX7FJkrrCWSsY
QbkU4c3octJ+pX4EkURi
-----END PUBLIC KEY-----
+2 -2
View File
@@ -19,14 +19,14 @@
sparkle:deltaFrom="2.0"
length="1235"
type="application/octet-stream"
sparkle:dsaSignature="..." />
sparkle:edSignature="..." />
<enclosure url="http://localhost:1337/3.0_from_1.0.patch"
sparkle:version="3.0"
sparkle:deltaFrom="1.0"
length="1485"
type="application/octet-stream"
sparkle:dsaSignature="..." />
sparkle:edSignature="..." />
</sparkle:deltas>
</item>
<!-- A release testing minimumSystemVersion -->
+1 -1
View File
@@ -251,7 +251,7 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
XCTFail(@"Failed setting file permissions");
}
XCTAssertFalse([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
XCTAssertTrue([self testDirectoryHashEqualityWithSource:sourceDirectory destination:destinationDirectory]);
}];
}
+19 -12
View File
@@ -8,7 +8,8 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "SUDSAVerifier.h"
#import "SUSignatureVerifier.h"
#import "SUSignatures.h"
@interface SUDSAVerifierTest : XCTestCase
@property NSString *testFile, *pubKeyFile;
@@ -27,7 +28,7 @@
- (void)testVerifyFileAtPath
{
NSData *pubKey = [NSData dataWithContentsOfFile:self.pubKeyFile];
NSString *pubKey = [NSString stringWithContentsOfFile:self.pubKeyFile encoding:NSASCIIStringEncoding error:nil];
XCTAssertNotNil(pubKey, @"Public key must be readable");
NSString *validSig = @"MCwCFCIHCIYYkfZavNzTitTW5tlRp/k5AhQ40poFytqcVhIYdCxQznaXeJPJDQ==";
@@ -38,7 +39,7 @@
@"Expected valid signature");
XCTAssertFalse([self checkFile:self.testFile
withPubKey:[NSData dataWithBytes:"lol" length:3]
withPubKey:@"lol"
signature:validSig],
@"Invalid pubkey");
@@ -63,23 +64,29 @@
@"Expected invalid signature");
}
- (BOOL)checkFile:(NSString *)aFile withPubKey:(NSData *)pubKey signature:(NSString *)sigString
- (BOOL)checkFile:(NSString *)aFile withPubKey:(NSString *)pubKey signature:(NSString *)sigString
{
SUDSAVerifier *v = [[SUDSAVerifier alloc] initWithPublicKeyData:pubKey];
SUPublicKeys *pubKeys = [[SUPublicKeys alloc] initWithDsa:pubKey ed:nil];
SUSignatureVerifier *v = [[SUSignatureVerifier alloc] initWithPublicKeys:pubKeys];
NSData *sig = [[NSData alloc] initWithBase64EncodedString:sigString options:(NSDataBase64DecodingOptions)0];
SUSignatures *sig = [[SUSignatures alloc] initWithDsa:sigString ed:nil];
return [v verifyFileAtPath:aFile signature:sig];
return [v verifyFileAtPath:aFile signatures:sig];
}
- (void)testValidatePath
{
NSString *pubkey = [NSString stringWithContentsOfFile:self.pubKeyFile encoding:NSASCIIStringEncoding error:nil];
NSString *dsaStr = [NSString stringWithContentsOfFile:self.pubKeyFile encoding:NSASCIIStringEncoding error:nil];
XCTAssertNotNil(dsaStr);
SUPublicKeys *pubkeys = [[SUPublicKeys alloc] initWithDsa:dsaStr ed:nil];
XCTAssertNotNil(pubkeys);
XCTAssertNotNil(pubkeys.dsaPubKey);
XCTAssertTrue([SUDSAVerifier validatePath:self.testFile
withEncodedDSASignature:@"MC0CFFMF3ha5kjvrJ9JTpTR8BenPN9QUAhUAzY06JRdtP17MJewxhK0twhvbKIE="
withPublicDSAKey:pubkey],
@"Expected valid signature");
SUSignatures *sig = [[SUSignatures alloc] initWithDsa:@"MC0CFFMF3ha5kjvrJ9JTpTR8BenPN9QUAhUAzY06JRdtP17MJewxhK0twhvbKIE=" ed:nil];
XCTAssertNotNil(sig);
XCTAssertNotNil(sig.dsaSignature);
XCTAssertTrue([SUSignatureVerifier validatePath:self.testFile withSignatures:sig withPublicKeys:pubkeys], @"Expected valid signature");
}
@end
@@ -8,7 +8,7 @@ for file in "dsaparam.pem" "dsa_priv.pem" "dsa_pub.pem"; do
done
openssl="/usr/bin/openssl"
$openssl gendsa <($openssl dsaparam 4096) -out dsa_priv.pem
$openssl gendsa <($openssl dsaparam 2047) -out dsa_priv.pem
chmod 0400 dsa_priv.pem
$openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
set -e
set -o pipefail
if [ "$#" -ne 2 ]; then
echo "Usage: $0 update_archive_file dsa_priv.pem"
echo "This is an old DSA signing script for deprecated DSA keys."
echo "Do not use this for new applications."
exit 1
fi
openssl=/usr/bin/openssl
version=`$openssl version`
if [[ $version =~ "OpenSSL 0.9" ]]; then
# pre-10.13 system: Fall back to OpenSSL DSS1 digest because it does not like the -sha1 option
$openssl dgst -sha1 -binary < "$1" | $openssl dgst -dss1 -sign "$2" | $openssl enc -base64
else
# 10.13 and later: Use LibreSSL SHA1 digest
$openssl dgst -sha1 -binary < "$1" | $openssl dgst -sha1 -sign "$2" | $openssl enc -base64
fi
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
if [ "$#" -ne 2 ]; then
echo "Usage: $0 update_archive private_key"
exit 1
fi
openssl=/usr/bin/openssl
$openssl dgst -sha1 -binary < "$1" | $openssl dgst -sha1 -sign "$2" | $openssl enc -base64
Submodule
+1
Submodule ed25519 added at 7fa6712ef5.
@@ -6,3 +6,5 @@
#import "SUUnarchiver.h"
#import "SUBinaryDeltaUnarchiver.h"
#import "SUBinaryDeltaCreate.h"
#import "SUSignatures.h"
#import "../ed25519/src/ed25519.h" // run `git submodule update --init` if you get an erorr here
+71 -18
View File
@@ -14,10 +14,11 @@ func makeError(code: SUError, _ description: String) -> NSError {
]);
}
func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) throws -> [String:[ArchiveItem]] {
func makeAppcast(archivesSourceDir: URL, keys: PrivateKeys, verbose: Bool) throws -> [String:[ArchiveItem]] {
let cacheDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0].appendingPathComponent("Sparkle_generate_appcast");
let comparator = SUStandardVersionComparator();
let allUpdates = (try unarchiveUpdates(archivesSourceDir: archivesSourceDir, verbose:verbose))
let allUpdates = (try unarchiveUpdates(archivesSourceDir: archivesSourceDir, archivesDestDir: cacheDir, verbose:verbose))
.sorted(by: {
.orderedDescending == comparator.compareVersion($0.version, toVersion:$1.version)
})
@@ -33,11 +34,31 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) thro
for update in allUpdates {
group.enter();
DispatchQueue.global().async {
do {
update.dsaSignature = try dsaSignature(path: update.archivePath, privateKey: privateKey);
} catch {
print(update, error);
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, let expectedPublicKey = keys.publicEdKey {
if publicEdKey == expectedPublicKey {
do {
update.edSignature = try edSignature(path: update.archivePath, publicEdKey: publicEdKey, privateEdKey: privateEdKey);
} catch {
print(update, error);
}
} else {
print("Warning: SUPublicEDKey in the app \(update.archivePath.path) does not match key EdDSA in the Keychain. Run generate_keys and update Info.plist to match");
}
} else {
print("Warning: could not sign \(update.archivePath.path) due to lack of private EdDSA key");
}
}
group.leave();
}
@@ -63,16 +84,29 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) thro
var numDeltas = 0;
let appBaseName = latestItem.appPath.deletingPathExtension().lastPathComponent;
for item in updates {
if numDeltas > maxDeltas {
break;
}
// No downgrades
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");
var delta:DeltaUpdate;
if !FileManager.default.fileExists(atPath: deltaPath.path) {
let ignoreMarkerPath = cacheDir.appendingPathComponent(deltaPath.lastPathComponent).appendingPathExtension(".ignore");
let fm = FileManager.default;
if fm.fileExists(atPath: ignoreMarkerPath.path) {
continue;
}
if !fm.fileExists(atPath: deltaPath.path) {
do {
delta = try DeltaUpdate.create(from: item, to: latestItem, archivePath: deltaPath);
} catch {
@@ -83,23 +117,37 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) thro
delta = DeltaUpdate(fromVersion: item.version, archivePath: deltaPath);
}
// Require delta to be a bit smaller
if delta.fileSize / 7 < latestItem.fileSize / 8 {
numDeltas += 1;
if numDeltas > maxDeltas {
break;
}
numDeltas += 1;
group.enter();
DispatchQueue.global().async {
// Require delta to be a bit smaller
if delta.fileSize / 7 > latestItem.fileSize / 8 {
markDeltaAsIgnored(delta: delta, markerPath: ignoreMarkerPath)
continue;
}
group.enter();
DispatchQueue.global().async {
if item.supportsDSA, let privateDSAKey = keys.privateDSAKey {
do {
delta.dsaSignature = try dsaSignature(path: deltaPath, privateKey: privateKey);
latestItem.deltas.append(delta);
delta.dsaSignature = try dsaSignature(path: deltaPath, privateDSAKey: privateDSAKey);
} catch {
print(delta.archivePath.lastPathComponent, error);
}
group.leave();
}
if let publicEdKey = item.publicEdKey, let privateEdKey = keys.privateEdKey {
do {
delta.edSignature = try edSignature(path: deltaPath, publicEdKey: publicEdKey, privateEdKey: privateEdKey);
} catch {
print(delta.archivePath.lastPathComponent, error);
}
}
if delta.dsaSignature != nil || delta.edSignature != nil {
latestItem.deltas.append(delta);
} else {
markDeltaAsIgnored(delta: delta, markerPath: ignoreMarkerPath)
print("Delta \(delta.archivePath.path) ignored, because it could not be signed");
}
group.leave();
}
}
}
@@ -109,3 +157,8 @@ func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) thro
return updatesByAppcast;
}
func markDeltaAsIgnored(delta: DeltaUpdate, markerPath: URL) {
let _ = try? FileManager.default.removeItem(at: delta.archivePath)
let _ = try? Data.init().write(to: markerPath); // 0-sized file
}
+29 -10
View File
@@ -9,6 +9,7 @@ class DeltaUpdate {
let fromVersion: String;
let archivePath: URL;
var dsaSignature: String?;
var edSignature: String?;
init(fromVersion: String, archivePath: URL) {
self.archivePath = archivePath;
@@ -38,41 +39,57 @@ class ArchiveItem: CustomStringConvertible {
let archivePath: URL;
let appPath: URL;
let feedURL: URL?;
let publicEdKey: Data?;
let supportsDSA: Bool;
let archiveFileAttributes: [FileAttributeKey:Any];
var deltas: [DeltaUpdate];
var dsaSignature: String?;
var edSignature: String?;
init(version: String, shortVersion: String?, feedURL: URL?, minimumSystemVersion: String?, appPath: URL, archivePath: URL) throws {
init(version: String, shortVersion: String?, feedURL: URL?, minimumSystemVersion: String?, publicEdKey: String?, supportsDSA: Bool, appPath: URL, archivePath: URL) throws {
self.version = version;
self._shortVersion = shortVersion;
self.feedURL = feedURL;
self.minimumSystemVersion = minimumSystemVersion ?? "10.7";
self.archivePath = archivePath;
self.appPath = appPath;
self.supportsDSA = supportsDSA;
if let publicEdKey = publicEdKey {
self.publicEdKey = Data(base64Encoded: publicEdKey);
} else {
self.publicEdKey = nil;
}
self.archiveFileAttributes = try FileManager.default.attributesOfItem(atPath: self.archivePath.path);
self.deltas = [];
}
convenience init(fromArchive archivePath: URL, unarchivedDir: URL) throws {
let items = try FileManager.default.contentsOfDirectory(atPath: unarchivedDir.path)
.filter({ !$0.hasPrefix(".") })
.map({ unarchivedDir.appendingPathComponent($0) })
let resourceKeys = [URLResourceKey.typeIdentifierKey]
let items = try FileManager.default.contentsOfDirectory(at: unarchivedDir, includingPropertiesForKeys: resourceKeys, options: .skipsHiddenFiles)
let apps = items.filter({ $0.pathExtension == "app" });
if apps.count > 0 {
if apps.count > 1 {
throw makeError(code: .unarchivingError, "Too many apps in \(unarchivedDir.path) \(apps)");
let bundles = items.filter({
if let resourceValues = try? $0.resourceValues(forKeys: Set(resourceKeys)) {
return UTTypeConformsTo(resourceValues.typeIdentifier! as CFString, kUTTypeBundle)
} else {
return false
}
});
if bundles.count > 0 {
if bundles.count > 1 {
throw makeError(code: .unarchivingError, "Too many bundles in \(unarchivedDir.path) \(bundles)");
}
let appPath = apps[0];
let appPath = bundles[0];
guard let infoPlist = NSDictionary(contentsOf: appPath.appendingPathComponent("Contents/Info.plist")) else {
throw makeError(code: .unarchivingError, "No plist \(appPath.path)");
}
guard let version = infoPlist[kCFBundleVersionKey] as? String else {
throw makeError(code: .unarchivingError, "No Version \(kCFBundleVersionKey) \(appPath)");
throw makeError(code: .unarchivingError, "No Version \(kCFBundleVersionKey as String? ?? "missing kCFBundleVersionKey") \(appPath)");
}
let shortVersion = infoPlist["CFBundleShortVersionString"] as? String;
let publicEdKey = infoPlist[SUPublicEDKeyKey] as? String;
let supportsDSA = infoPlist[SUPublicDSAKeyKey] != nil || infoPlist[SUPublicDSAKeyFileKey] != nil;
var feedURL:URL? = nil;
if let feedURLStr = infoPlist["SUFeedURL"] as? String {
@@ -83,6 +100,8 @@ class ArchiveItem: CustomStringConvertible {
shortVersion: shortVersion,
feedURL: feedURL,
minimumSystemVersion: infoPlist["LSMinimumSystemVersion"] as? String,
publicEdKey: publicEdKey,
supportsDSA: supportsDSA,
appPath: appPath,
archivePath: archivePath);
} else {
+19 -13
View File
@@ -112,19 +112,19 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
descElement.setChildren([cdata]);
}
var minVer = findElement(name: "sparkle:minimumSystemVersion", parent: item);
var minVer = findElement(name: SUAppcastElementMinimumSystemVersion, parent: item);
if nil == minVer {
minVer = XMLElement.element(withName: "sparkle:minimumSystemVersion", uri: sparkleNS) as? XMLElement;
minVer = XMLElement.element(withName: SUAppcastElementMinimumSystemVersion, uri: sparkleNS) as? XMLElement;
linebreak(item);
item.addChild(minVer!);
}
minVer?.setChildren([text(update.minimumSystemVersion)]);
let relElement = findElement(name: "sparkle:releaseNotesLink", parent: item);
let relElement = findElement(name: SUAppcastElementReleaseNotesLink, parent: item);
if let url = update.releaseNotesURL {
if nil == relElement {
linebreak(item);
item.addChild(XMLElement.element(withName:"sparkle:releaseNotesLink", stringValue: url.absoluteString) as! XMLElement);
item.addChild(XMLElement.element(withName: SUAppcastElementReleaseNotesLink, stringValue: url.absoluteString) as! XMLElement);
}
} else if let childIndex = relElement?.index {
item.removeChild(at: childIndex);
@@ -142,20 +142,23 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
};
var attributes = [
XMLNode.attribute(withName: "url", stringValue: archiveURL) as! XMLNode,
XMLNode.attribute(withName: "sparkle:version", uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: "sparkle:shortVersionString", uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
XMLNode.attribute(withName: SUAppcastAttributeVersion, uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: SUAppcastAttributeShortVersionString, uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
XMLNode.attribute(withName: "length", stringValue: String(update.fileSize)) as! XMLNode,
XMLNode.attribute(withName: "type", stringValue: update.mimeType) as! XMLNode,
];
if let sig = update.edSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode);
}
if let sig = update.dsaSignature {
attributes.append(XMLNode.attribute(withName: "sparkle:dsaSignature", uri: sparkleNS, stringValue: sig) as! XMLNode);
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeDSASignature, uri: sparkleNS, stringValue: sig) as! XMLNode);
}
enclosure!.attributes = attributes;
if update.deltas.count > 0 {
var deltas = findElement(name: "sparkle:deltas", parent: item);
var deltas = findElement(name: SUAppcastElementDeltas, parent: item);
if nil == deltas {
deltas = XMLElement.element(withName: "sparkle:deltas", uri: sparkleNS) as? XMLElement;
deltas = XMLElement.element(withName: SUAppcastElementDeltas, uri: sparkleNS) as? XMLElement;
linebreak(item);
item.addChild(deltas!);
} else {
@@ -164,14 +167,17 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
for delta in update.deltas {
var attributes = [
XMLNode.attribute(withName: "url", stringValue: URL(string: delta.archivePath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlPathAllowed)!, relativeTo: update.archiveURL)!.absoluteString) as! XMLNode,
XMLNode.attribute(withName: "sparkle:version", uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: "sparkle:shortVersionString", uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
XMLNode.attribute(withName: "sparkle:deltaFrom", uri: sparkleNS, stringValue: delta.fromVersion) as! XMLNode,
XMLNode.attribute(withName: SUAppcastAttributeVersion, uri: sparkleNS, stringValue: update.version) as! XMLNode,
XMLNode.attribute(withName: SUAppcastAttributeShortVersionString, uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
XMLNode.attribute(withName: SUAppcastAttributeDeltaFrom, uri: sparkleNS, stringValue: delta.fromVersion) as! XMLNode,
XMLNode.attribute(withName: "length", stringValue: String(delta.fileSize)) as! XMLNode,
XMLNode.attribute(withName: "type", stringValue: "application/octet-stream") as! XMLNode,
];
if let sig = delta.edSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode);
}
if let sig = delta.dsaSignature {
attributes.append(XMLNode.attribute(withName: "sparkle:dsaSignature", uri: sparkleNS, stringValue: sig) as! XMLNode);
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeDSASignature, uri: sparkleNS, stringValue: sig) as! XMLNode);
}
linebreak(deltas!);
deltas!.addChild(XMLNode.element(withName: "enclosure", children: nil, attributes: attributes) as! XMLElement);
@@ -5,7 +5,19 @@
import Foundation
func loadPrivateKey(at privateKeyURL: URL) throws -> SecKey {
struct PrivateKeys {
var privateDSAKey: SecKey?;
var privateEdKey: Data?;
var publicEdKey: Data?;
init(privateDSAKey: SecKey?, privateEdKey: Data?, publicEdKey: Data?) {
self.privateDSAKey = privateDSAKey;
self.privateEdKey = privateEdKey;
self.publicEdKey = publicEdKey;
}
}
func loadPrivateDSAKey(at privateKeyURL: URL) throws -> SecKey {
let data = try Data(contentsOf: privateKeyURL);
var cfitems: CFArray? = nil;
@@ -25,7 +37,7 @@ func loadPrivateKey(at privateKeyURL: URL) throws -> SecKey {
return (cfitems! as NSArray)[0] as! SecKey;
}
func loadPrivateKey(named keyName: String, fromKeychainAt keychainURL: URL) throws -> SecKey {
func loadPrivateDSAKey(named keyName: String, fromKeychainAt keychainURL: URL) throws -> SecKey {
var keychain: SecKeychain? = nil
guard SecKeychainOpen(keychainURL.path, &keychain) == errSecSuccess, keychain != nil else {
@@ -49,7 +61,7 @@ func loadPrivateKey(named keyName: String, fromKeychainAt keychainURL: URL) thro
return item! as! SecKey
}
func dsaSignature(path: URL, privateKey: SecKey) throws -> String {
func dsaSignature(path: URL, privateDSAKey: SecKey) throws -> String {
var error: Unmanaged<CFError>?;
@@ -57,7 +69,7 @@ func dsaSignature(path: URL, privateKey: SecKey) throws -> String {
let dataReadTransform = SecTransformCreateReadTransformWithReadStream(stream);
let dataDigestTransform = SecDigestTransformCreate(kSecDigestSHA1, 20, nil);
guard let dataSignTransform = SecSignTransformCreate(privateKey, &error) else {
guard let dataSignTransform = SecSignTransformCreate(privateDSAKey, &error) else {
print("can't use the key");
throw error!.takeRetainedValue();
}
@@ -82,3 +94,21 @@ func dsaSignature(path: URL, privateKey: SecKey) throws -> String {
}
return resultData.base64EncodedString();
}
func edSignature(path: URL, publicEdKey: Data, privateEdKey: Data) throws -> String {
assert(publicEdKey.count == 32)
assert(privateEdKey.count == 64)
let data = try Data.init(contentsOf: path, options: .mappedIfSafe);
let len = data.count;
var output = Data(count: 64);
output.withUnsafeMutableBytes({ (output: UnsafeMutablePointer<UInt8>) in
data.withUnsafeBytes({ (data: UnsafePointer<UInt8>) in
publicEdKey.withUnsafeBytes({ (publicEdKey: UnsafePointer<UInt8>) in
privateEdKey.withUnsafeBytes({ (privateEdKey: UnsafePointer<UInt8>) in
ed25519_sign(output, data, len, publicEdKey, privateEdKey)
});
});
})
});
return output.base64EncodedString();
}
+6 -3
View File
@@ -13,7 +13,11 @@ func unarchive(itemPath:URL, archiveDestDir: URL, callback: @escaping (Error?) -
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:]);
do {
try fileManager.linkItem(at: itemPath, to: itemCopy);
do {
try fileManager.linkItem(at: itemPath, to: itemCopy);
} catch {
try fileManager.copyItem(at: itemPath, to: itemCopy);
}
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemCopy.path, updatingHostBundlePath:nil, decryptionPassword:nil) {
unarchiver.unarchive(completionBlock: { (error: Error?) in
if error != nil {
@@ -39,8 +43,7 @@ func unarchive(itemPath:URL, archiveDestDir: URL, callback: @escaping (Error?) -
}
}
func unarchiveUpdates(archivesSourceDir: URL, verbose: Bool) throws -> [ArchiveItem] {
let archivesDestDir = archivesSourceDir.appendingPathComponent(".tmp");
func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, verbose: Bool) throws -> [ArchiveItem] {
if verbose {
print("Unarchiving to temp directory", archivesDestDir.path);
}
+37 -14
View File
@@ -12,39 +12,61 @@ var verbose = false;
func printUsage() {
let command = URL(fileURLWithPath: CommandLine.arguments.first!).lastPathComponent;
print("Generate appcast from a directory of Sparkle updates\n",
print("Generate appcast from a directory of Sparkle update archives\n",
"Usage:\n",
" \(command) < -f private key path | -k keychain_path -n key_name > <directory with update archives>\n",
" e.g. \(command) -k ~/Library/Keychains/login.keychain -n 'My Private Key' archives/\n",
"\nOR (legacy)\n\n",
" \(command) <private key path> <directory with update archives>\n",
" \(command) <directory with update files>\n",
" e.g. \(command) ./my-app-release-zipfiles/\n",
"\nOR for old apps that have a DSA keys (deprecated):\n",
" \(command) <private DSA key path> <directory with update files>\n",
" e.g. \(command) dsa_priv.pem archives/\n",
"\n",
" Appcast files and deltas will be written to the archives directory.\n",
" Note that pkg-based updates are not supported.\n"
"Appcast files and deltas will be written to the archives directory.\n",
"Note that pkg-based updates are not supported.\n"
)
}
func loadPrivateKeys(_ privateDSAKey: SecKey?) -> PrivateKeys {
var privateEdKey: Data?;
var publicEdKey: Data?;
var item: CFTypeRef?;
let res = SecItemCopyMatching([
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: "https://sparkle-project.org",
kSecAttrAccount as String: "ed25519",
kSecAttrProtocol as String: kSecAttrProtocolSSH,
kSecReturnData as String: kCFBooleanTrue,
] as CFDictionary, &item);
if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
privateEdKey = keys[0..<64];
publicEdKey = keys[64...];
} else {
print("Warning: Private key not found in the Keychain (\(res)). Please run the generate_keys tool");
}
return PrivateKeys(privateDSAKey: privateDSAKey, privateEdKey: privateEdKey, publicEdKey: publicEdKey);
}
func main() {
let args = CommandLine.arguments;
if args.count < 3 {
if args.count < 2 {
printUsage()
exit(1)
}
let privateKey: SecKey
var privateDSAKey: SecKey? = nil;
// this was typical usage for DSA keys
if args.count == 3 || (args.count == 4 && args[1] == "-f") {
// private key specified by filename
let privateKeyURL = URL(fileURLWithPath: args.count == 3 ? args[1] : args[2])
do {
privateKey = try loadPrivateKey(at: privateKeyURL)
privateDSAKey = try loadPrivateDSAKey(at: privateKeyURL)
} catch {
print("Unable to load DSA private key from", privateKeyURL.path, "\n", error)
exit(1)
}
}
// this is legacy for DSA keychain; probably very rarely used
else if args.count == 6 && (args[1] == "-n" || args[1] == "-k") {
// private key specified by keychain + key name
let keyName: String
@@ -70,21 +92,22 @@ func main() {
}
do {
privateKey = try loadPrivateKey(named: keyName, fromKeychainAt: keychainURL)
privateDSAKey = try loadPrivateDSAKey(named: keyName, fromKeychainAt: keychainURL)
} catch {
print("Unable to load DSA private key '\(keyName)' from keychain at", keychainURL.path, "\n", error)
exit(1)
}
}
else {
else if args.count != 2 {
printUsage()
exit(1)
}
let archivesSourceDir = URL(fileURLWithPath: args.last!, isDirectory: true)
let keys = loadPrivateKeys(privateDSAKey)
do {
let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, privateKey: privateKey, verbose:verbose);
let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, keys: keys, verbose:verbose);
for (appcastFile, updates) in allUpdates {
let appcastDestPath = URL(fileURLWithPath: appcastFile, relativeTo: archivesSourceDir);
+6
View File
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
#import "SUConstants.h"
#import "SUErrors.h"
#import "SUSignatures.h"
#import "../ed25519/src/ed25519.h" // run `git submodule update --init` if you get an erorr here
+94
View File
@@ -0,0 +1,94 @@
//
// main.swift
// generate_keys
//
// Created by Kornel on 15/09/2018.
// Copyright © 2018 Sparkle Project. All rights reserved.
//
import Foundation
import Security
func findPublicKey() -> Data? {
var item: CFTypeRef?;
let res = SecItemCopyMatching([
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: "https://sparkle-project.org",
kSecAttrAccount as String: "ed25519",
kSecAttrProtocol as String: kSecAttrProtocolSSH,
kSecReturnData as String: kCFBooleanTrue,
] as CFDictionary, &item);
if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
print("OK! Read the existing key saved in the Keychain.");
return keys[64...]
}
else if res == errSecItemNotFound {
return nil;
}
else if res == errSecAuthFailed {
print("\nERROR! Access denied. Can't check existing keys in the keychain.");
print("Go to Keychain Access.app, lock the login keychain, then unlock it again.");
}
else if res == errSecUserCanceled {
print("\nABORTED! You've cancelled the request to read the key from the Keychain. Please run the tool again.");
} else if res == errSecInteractionNotAllowed {
print("\nERROR! The operating system has blocked access to the Keychain.");
} else {
print("\nERROR! Unable to access existing item in the Keychain", res, "(you can look it up at osstatus.com)");
}
exit(1)
}
func generateKeyPair() -> Data {
var seed = Data(count: 32);
var publicEdKey = Data(count: 32);
var privateEdKey = Data(count: 64);
if !seed.withUnsafeMutableBytes { (seed: UnsafeMutablePointer<UInt8>) in 0 == ed25519_create_seed(seed)} {
print("\nERROR: Unable to initialize random seed");
exit(1)
}
seed.withUnsafeBytes({(seed: UnsafePointer<UInt8>) in
publicEdKey.withUnsafeMutableBytes({(publicEdKey: UnsafeMutablePointer<UInt8>) in
privateEdKey.withUnsafeMutableBytes({(privateEdKey: UnsafeMutablePointer<UInt8>) in
ed25519_create_keypair(publicEdKey, privateEdKey, seed);
});
});
});
let bothKeys = privateEdKey + publicEdKey; // public key can't be derived from the private one
let query = [
// macOS doesn't support ed25519 keys, so we're forced to save the key as a "password"
// and add some made-up service data for it to prevent it clashing with other passwords.
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: "https://sparkle-project.org",
kSecAttrAccount as String: "ed25519",
kSecValueData as String: bothKeys.base64EncodedData() as CFData, // it's base64-encoded, because user may request to show it
kSecAttrIsSensitive as String: kCFBooleanTrue,
kSecAttrIsPermanent as String: kCFBooleanTrue,
kSecAttrLabel as String: "Private key for signing Sparkle updates",
kSecAttrComment as String: "Public key (SUPublicEDKey value) for this key is:\n\n\(publicEdKey.base64EncodedString())",
kSecAttrDescription as String: "private key",
] as CFDictionary;
let res = SecItemAdd(query, nil);
if res == errSecSuccess {
print("OK! A new key has been generated and saved in the Keychain.");
}
else if res == errSecDuplicateItem {
print("\nERROR: You already have a previously generated key in the Keychain");
} else if res == errSecAuthFailed {
print("\nERROR: System denied access to the Keychain. Unable to save the new key");
print("Go to Keychain Access.app, lock the login keychain, then unlock it again.");
} else {
print("\nERROR: The key could not be saved to the Keychain. error: \(res) (you can look it up at osstatus.com)");
}
exit(1);
}
print("This tool uses macOS Keychain to store the Sparkle private key.")
print("If the Keychain prompts you for permission, please allow it.")
let pubKey = findPublicKey() ?? generateKeyPair();
print("\nIn your app's Info.plist set SUPublicEDKey to:\n\(pubKey.base64EncodedString())\n")
+72
View File
@@ -0,0 +1,72 @@
//
// main.swift
// sign_update
//
// Created by Kornel on 16/09/2018.
// Copyright © 2018 Sparkle Project. All rights reserved.
//
import Foundation
import Security
func findKeys() -> (Data, Data) {
var item: CFTypeRef?;
let res = SecItemCopyMatching([
kSecClass as String: kSecClassGenericPassword,
kSecAttrService as String: "https://sparkle-project.org",
kSecAttrAccount as String: "ed25519",
kSecAttrProtocol as String: kSecAttrProtocolSSH,
kSecReturnData as String: kCFBooleanTrue,
] as CFDictionary, &item);
if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
return (keys[0..<64], keys[64..<(64+32)])
}
else if res == errSecItemNotFound {
print("ERROR! Signing key not found. Please run generate_keys tool first.");
}
else if res == errSecAuthFailed {
print("ERROR! Access denied. Can't get keys from the keychain.");
print("Go to Keychain Access.app, lock the login keychain, then unlock it again.");
}
else if res == errSecUserCanceled {
print("ABORTED! You've cancelled the request to read the key from the Keychain. Please run the tool again.");
} else if res == errSecInteractionNotAllowed {
print("ERROR! The operating system has blocked access to the Keychain.");
} else {
print("ERROR! Unable to access required key in the Keychain", res, "(you can look it up at osstatus.com)");
}
exit(1)
}
func edSignature(data: Data, publicEdKey: Data, privateEdKey: Data) -> String {
assert(publicEdKey.count == 32)
assert(privateEdKey.count == 64)
let len = data.count;
var output = Data(count: 64);
output.withUnsafeMutableBytes({ (output: UnsafeMutablePointer<UInt8>) in
data.withUnsafeBytes({ (data: UnsafePointer<UInt8>) in
publicEdKey.withUnsafeBytes({ (publicEdKey: UnsafePointer<UInt8>) in
privateEdKey.withUnsafeBytes({ (privateEdKey: UnsafePointer<UInt8>) in
ed25519_sign(output, data, len, publicEdKey, privateEdKey)
});
});
})
});
return output.base64EncodedString();
}
let args = CommandLine.arguments;
if args.count != 2 {
print("Usage: \(args[0]) <archive to sign>\nPrivavte EdDSA (ed25519) key is automatically read from the Keychain.\n");
exit(1)
}
let(priv, pub) = findKeys();
do {
let data = try Data.init(contentsOf: URL.init(fileURLWithPath: args[1]), options: .mappedIfSafe);
let sig = edSignature(data:data , publicEdKey: pub, privateEdKey: priv);
print("sparkle:edSignature=\"\(sig)\" length=\"\(data.count)\"");
} catch {
print("ERROR: ", error)
}