mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0900d09ab3 | ||
|
|
1755a3da05 | ||
|
|
bb56b5b259 | ||
|
|
5df208336a | ||
|
|
50f754c21d | ||
|
|
8455216a58 | ||
|
|
524761c50f | ||
|
|
626ccc79c6 | ||
|
|
a9ba760d6e | ||
|
|
9561b365af | ||
|
|
723e5d11be | ||
|
|
19ef31b681 | ||
|
|
50d321a1a9 | ||
|
|
55e0dc508c | ||
|
|
f6f4ac6925 | ||
|
|
2ace19e72b | ||
|
|
cb12461be1 | ||
|
|
e7c828b332 | ||
|
|
5dbc53a8b8 | ||
|
|
5dc407ddc5 | ||
|
|
261f5dc797 | ||
|
|
25d394acda | ||
|
|
401cd5f628 | ||
|
|
ddc8fac6c6 | ||
|
|
da573aa9ab | ||
|
|
8b40e22432 | ||
|
|
93a8aca7fd | ||
|
|
63aa96a076 | ||
|
|
7b13157dce | ||
|
|
aa9e05958d | ||
|
|
58fff9732e | ||
|
|
9c8fef56e3 | ||
|
|
0e0b87afd4 | ||
|
|
b8f87f1702 | ||
|
|
32db72a2fc | ||
|
|
f83f29193b | ||
|
|
93cff25e6f | ||
|
|
f886459367 | ||
|
|
54e663085b | ||
|
|
80627a4946 | ||
|
|
ba8dd4d010 | ||
|
|
5270fe0f51 | ||
|
|
03ab0b72a6 | ||
|
|
931f7855f7 | ||
|
|
a10a99ce1a | ||
|
|
a9209b94b7 | ||
|
|
e5e4c6c2e1 |
No files matched your search
@@ -0,0 +1,3 @@
|
||||
[submodule "Vendor/ed25519"]
|
||||
path = Vendor/ed25519
|
||||
url = https://github.com/orlp/ed25519
|
||||
@@ -0,0 +1,20 @@
|
||||
excluded:
|
||||
- Vendor
|
||||
disabled_rules:
|
||||
- opening_brace
|
||||
- empty_parentheses_with_trailing_closure
|
||||
- function_body_length
|
||||
- line_length
|
||||
- cyclomatic_complexity
|
||||
- large_tuple
|
||||
|
||||
# Rule-specific config
|
||||
trailing_comma:
|
||||
mandatory_comma: true
|
||||
force_try:
|
||||
severity: warning
|
||||
force_cast:
|
||||
severity: warning
|
||||
identifier_name:
|
||||
min_length:
|
||||
warning: 2
|
||||
+6
-4
@@ -1,5 +1,7 @@
|
||||
os: osx
|
||||
language: objective-c
|
||||
osx_image: xcode9
|
||||
before_install:
|
||||
- brew update
|
||||
script: make ci
|
||||
osx_image:
|
||||
- xcode10.3
|
||||
- xcode11.4
|
||||
script:
|
||||
- set -o pipefail && xcodebuild test -project Sparkle.xcodeproj -scheme Distribution -derivedDataPath build -enableCodeCoverage YES | xcpretty
|
||||
+14
-10
@@ -58,7 +58,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@property (nonatomic, copy) NSString *updateDirectoryPath;
|
||||
@property (nonatomic, copy) NSString *downloadName;
|
||||
@property (nonatomic, copy) NSString *decryptionPassword;
|
||||
@property (nonatomic, copy) NSString *dsaSignature;
|
||||
@property (nonatomic, strong) SUSignatures *signatures;
|
||||
@property (nonatomic, copy) NSString *relaunchPath;
|
||||
@property (nonatomic, copy) NSString *installationType;
|
||||
@property (nonatomic, assign) BOOL shouldRelaunch;
|
||||
@@ -91,7 +91,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||
@synthesize downloadName = _downloadName;
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
@synthesize dsaSignature = _dsaSignature;
|
||||
@synthesize signatures = _signatures;
|
||||
@synthesize relaunchPath = _relaunchPath;
|
||||
@synthesize installationType = _installationType;
|
||||
@synthesize shouldRelaunch = _shouldRelaunch;
|
||||
@@ -188,19 +188,23 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
|
||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword];
|
||||
|
||||
BOOL success;
|
||||
BOOL success = NO;
|
||||
if (!unarchiver) {
|
||||
SULog(SULogLevelError, @"Error: No valid unarchiver for %@", archivePath);
|
||||
|
||||
success = NO;
|
||||
} else {
|
||||
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
|
||||
|
||||
// Delta & package updates will require validation before extraction
|
||||
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or DSA keys
|
||||
BOOL needsPrevalidation = [[unarchiver class] unsafeIfArchiveIsNotValidated] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||
|
||||
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath dsaSignature:self.dsaSignature host:self.host performingPrevalidation:needsPrevalidation];
|
||||
|
||||
success = self.updateValidator.canValidate;
|
||||
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||
|
||||
if (needsPrevalidation) {
|
||||
success = [self.updateValidator validateDownloadPath];
|
||||
} else {
|
||||
success = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
@@ -251,7 +255,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
self.updateDirectoryPath = nil;
|
||||
self.downloadName = nil;
|
||||
self.decryptionPassword = nil;
|
||||
self.dsaSignature = nil;
|
||||
self.signatures = nil;
|
||||
self.relaunchPath = nil;
|
||||
self.host = nil;
|
||||
|
||||
@@ -387,7 +391,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
|
||||
self.installationType = installationType;
|
||||
self.relaunchPath = installationData.relaunchPath;
|
||||
self.downloadName = installationData.downloadName;
|
||||
self.dsaSignature = installationData.dsaSignature;
|
||||
self.signatures = installationData.signatures;
|
||||
self.updateDirectoryPath = cacheInstallationPath;
|
||||
self.host = [[SUHost alloc] initWithBundle:hostBundle];
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class SUSignatures;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUInstallationInputData : NSObject <NSSecureCoding>
|
||||
@@ -17,17 +19,17 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* hostBundlePath - path to host bundle to update & replace
|
||||
* updateDirectoryPath - path to update directory (i.e, temporary directory containing the new update archive)
|
||||
* downloadName - name of update archive in update directory
|
||||
* dsaSignature - DSA signature for the update that came from the appcast item
|
||||
* signatures - signatures for the update that came from the appcast item
|
||||
* decryptionPassword - optional decryption password for dmg archives
|
||||
*/
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *relaunchPath;
|
||||
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
|
||||
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
|
||||
@property (nonatomic, copy, readonly) NSString *downloadName;
|
||||
@property (nonatomic, copy, readonly) NSString *installationType;
|
||||
@property (nonatomic, copy, readonly) NSString *dsaSignature;
|
||||
@property (nonatomic, strong, readonly) SUSignatures *signatures;
|
||||
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "SPUInstallationInputData.h"
|
||||
#import "SPUInstallationType.h"
|
||||
|
||||
#import "SUSignatures.h"
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@@ -16,7 +16,7 @@ static NSString *SURelaunchPathKey = @"SURelaunchPath";
|
||||
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
|
||||
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
|
||||
static NSString *SUDownloadNameKey = @"SUDownloadName";
|
||||
static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
static NSString *SUSignaturesKey = @"SUSignatures";
|
||||
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
|
||||
static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
|
||||
@@ -26,11 +26,11 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
@synthesize hostBundlePath = _hostBundlePath;
|
||||
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||
@synthesize downloadName = _downloadName;
|
||||
@synthesize dsaSignature = _dsaSignature;
|
||||
@synthesize signatures = _signatures;
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
@synthesize installationType = _installationType;
|
||||
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures *)signatures decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -42,7 +42,7 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
_installationType = [installationType copy];
|
||||
assert(SPUValidInstallationType(_installationType));
|
||||
|
||||
_dsaSignature = [dsaSignature copy];
|
||||
_signatures = signatures;
|
||||
_decryptionPassword = [decryptionPassword copy];
|
||||
}
|
||||
return self;
|
||||
@@ -75,14 +75,14 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *dsaSignature = [decoder decodeObjectOfClass:[NSString class] forKey:SUDSASignatureKey];
|
||||
if (dsaSignature == nil) {
|
||||
SUSignatures *signatures = [decoder decodeObjectOfClass:[SUSignatures class] forKey:SUSignaturesKey];
|
||||
if (signatures == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
|
||||
|
||||
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType dsaSignature:dsaSignature decryptionPassword:decryptionPassword];
|
||||
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
@@ -92,7 +92,7 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
|
||||
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
|
||||
[coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
|
||||
[coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
|
||||
[coder encodeObject:self.dsaSignature forKey:SUDSASignatureKey];
|
||||
[coder encodeObject:self.signatures forKey:SUSignaturesKey];
|
||||
if (self.decryptionPassword != nil) {
|
||||
[coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
return [[path pathExtension] isEqualToString:@"delta"];
|
||||
}
|
||||
|
||||
+ (BOOL)unsafeIfArchiveIsNotValidated
|
||||
+ (BOOL)mustValidateBeforeExtraction
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -30,7 +30,7 @@
|
||||
return [[path pathExtension] isEqualToString:@"dmg"];
|
||||
}
|
||||
|
||||
+ (BOOL)unsafeIfArchiveIsNotValidated
|
||||
+ (BOOL)mustValidateBeforeExtraction
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
|
||||
}
|
||||
|
||||
+ (BOOL)unsafeIfArchiveIsNotValidated
|
||||
+ (BOOL)mustValidateBeforeExtraction
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// SUSignatureVerifier.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
|
||||
@@ -12,48 +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.h" // Run `git submodule update --init` if you get an error 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 =
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_9
|
||||
[[NSData alloc] initWithBase64Encoding:strippedSignature];
|
||||
#else
|
||||
[[NSData alloc] initWithBase64EncodedString:strippedSignature options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
#endif
|
||||
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;
|
||||
@@ -72,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;
|
||||
}
|
||||
|
||||
@@ -121,6 +164,7 @@
|
||||
if (dataDigestTransform) CFRelease(dataDigestTransform);
|
||||
if (dataVerifyTransform) CFRelease(dataVerifyTransform);
|
||||
if (error) CFRelease(error);
|
||||
if (dsaPubKeySecKey) CFRelease(dsaPubKeySecKey);
|
||||
return NO;
|
||||
};
|
||||
|
||||
@@ -137,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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Generate Appcast Debug
|
||||
|
||||
#include "ConfigGenerateAppcast.xcconfig"
|
||||
#include "CommandLineTool-Shared.xcconfig"
|
||||
#include "ConfigSwiftDebug.xcconfig"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Generate Appcast Release
|
||||
|
||||
#include "ConfigGenerateAppcast.xcconfig"
|
||||
#include "CommandLineTool-Shared.xcconfig"
|
||||
#include "ConfigSwiftRelease.xcconfig"
|
||||
@@ -0,0 +1,6 @@
|
||||
// Generate Appcast only
|
||||
|
||||
#include "ConfigSwift.xcconfig"
|
||||
|
||||
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
@@ -1,7 +0,0 @@
|
||||
// Generate Appcast only
|
||||
|
||||
#include "ConfigSwift.xcconfig"
|
||||
|
||||
SWIFT_OBJC_BRIDGING_HEADER = generate_appcast/Appcast-Bridging-Header.h
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
PRODUCT_NAME = generate_appcast
|
||||
@@ -0,0 +1,3 @@
|
||||
// Copyright © 2019 Sparkle Project. All rights reserved.
|
||||
|
||||
#include "ed25519-Shared.xcconfig"
|
||||
@@ -0,0 +1,3 @@
|
||||
// Copyright © 2019 Sparkle Project. All rights reserved.
|
||||
|
||||
#include "ed25519-Shared.xcconfig"
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright © 2019 Sparkle Project. All rights reserved.
|
||||
|
||||
// Deployment
|
||||
SKIP_INSTALL = YES
|
||||
|
||||
// Packaging
|
||||
EXECUTABLE_PREFIX = lib
|
||||
PRODUCT_NAME = $(TARGET_NAME)
|
||||
|
||||
// Search Paths
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
// Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing.
|
||||
WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversion
|
||||
@@ -34,7 +34,7 @@ bspatch.c and bsdiff.c, from bsdiff 4.3 <http://www.daemonology.net/bsdiff/>:
|
||||
sais.c and sais.c, from sais-lite (2010/08/07) <https://sites.google.com/site/yuta256/sais>:
|
||||
Copyright (c) 2008-2010 Yuta Mori.
|
||||
|
||||
SUDSAVerifier.m:
|
||||
SUSignatureVerifier.m:
|
||||
Copyright (c) 2011 Mark Hamlin.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "1.20.0"
|
||||
s.version = "2.0.0"
|
||||
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"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
14652F8019A9740F00959E44 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
|
||||
14652F8219A9746000959E44 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
|
||||
14652F8419A978C200959E44 /* SUExport.h in Headers */ = {isa = PBXBuildFile; fileRef = 14652F8319A9759F00959E44 /* SUExport.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
14732BC01960F2C200593899 /* test_app_only_dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 14732BBF1960F0AC00593899 /* test_app_only_dsa_pub.pem */; };
|
||||
14732BD019610A0D00593899 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
|
||||
14732BD119610A1200593899 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
|
||||
14732BD319610A1800593899 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14732BD219610A1800593899 /* XCTest.framework */; };
|
||||
@@ -50,13 +49,19 @@
|
||||
55C14F06136EF6DB00649790 /* SULog.h in Headers */ = {isa = PBXBuildFile; fileRef = 55C14F04136EF6DB00649790 /* SULog.h */; };
|
||||
55C14F07136EF6DB00649790 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
|
||||
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E6F33219EC9F6C00005E76 /* SUErrors.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5A06357023FE332300478A72 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
5A06357323FE333600478A72 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
5A06357423FE33A400478A72 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */; };
|
||||
5A6DD17123FE1FFC000AEF33 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
5AA89BA523FE27660094DAB8 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
5AA89BA623FE276A0094DAB8 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */; };
|
||||
5AE459001C34118500E3BB47 /* SUUpdaterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 14950074195FDF5900BC5B5B /* SUUpdaterTest.m */; };
|
||||
5AE459021C34118500E3BB47 /* SUVersionComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */; };
|
||||
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */ = {isa = PBXBuildFile; fileRef = 5AF6C74E1AEA46D10014A3AB /* test.pkg */; };
|
||||
5AF6C7541AEA49840014A3AB /* SUInstallerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF6C74C1AEA40760014A3AB /* SUInstallerTest.m */; };
|
||||
5AF9DC3C1981DBEE001EA135 /* SUDSAVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */; };
|
||||
5AF9DC3C1981DBEE001EA135 /* SUSignatureVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF9DC3B1981DBEE001EA135 /* SUSignatureVerifierTest.m */; };
|
||||
5D06E8FF0FD68D6D005AE3F6 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; };
|
||||
5D06E9050FD68D7D005AE3F6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
|
||||
5D1AF58B0FD7678C0065DB48 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; };
|
||||
@@ -96,7 +101,7 @@
|
||||
7205C4411E13049400E370AE /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4401E13049400E370AE /* main.swift */; };
|
||||
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4471E1304CE00E370AE /* Appcast.swift */; };
|
||||
7205C44D1E1304CE00E370AE /* ArchiveItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4481E1304CE00E370AE /* ArchiveItem.swift */; };
|
||||
7205C44E1E1304CE00E370AE /* DSASignature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4491E1304CE00E370AE /* DSASignature.swift */; };
|
||||
7205C44E1E1304CE00E370AE /* Signatures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4491E1304CE00E370AE /* Signatures.swift */; };
|
||||
7205C44F1E1304CE00E370AE /* FeedXML.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C44A1E1304CE00E370AE /* FeedXML.swift */; };
|
||||
7205C4501E1304CE00E370AE /* Unarchive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C44B1E1304CE00E370AE /* Unarchive.swift */; };
|
||||
7205C4561E13060D00E370AE /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
|
||||
@@ -204,7 +209,7 @@
|
||||
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; };
|
||||
7267E5881D3D89B300D1BF90 /* SUUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5851D3D89B300D1BF90 /* SUUnarchiver.m */; };
|
||||
7267E59C1D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
|
||||
7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */; };
|
||||
7267E59D1D3D8A5A00D1BF90 /* SUSignatureVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUSignatureVerifier.m */; };
|
||||
7267E59F1D3D8A6F00D1BF90 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59E1D3D8A6F00D1BF90 /* main.m */; };
|
||||
7267E5A21D3D8A7E00D1BF90 /* AppInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */; };
|
||||
7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */; };
|
||||
@@ -246,7 +251,7 @@
|
||||
7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||
7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
||||
7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; };
|
||||
7267E5F21D3D918000D1BF90 /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */; };
|
||||
7267E5F21D3D918000D1BF90 /* SUSignatureVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59B1D3D8A5A00D1BF90 /* SUSignatureVerifier.m */; };
|
||||
7267E5F31D3D918500D1BF90 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
|
||||
7267E5F41D3D918B00D1BF90 /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BB1D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m */; };
|
||||
7267E5F51D3D918B00D1BF90 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5BF1D3D8B2700D1BF90 /* SUPackageInstaller.m */; };
|
||||
@@ -399,7 +404,6 @@
|
||||
72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */; };
|
||||
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; };
|
||||
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; };
|
||||
72E45CFE1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */; };
|
||||
72E45DDD1B65C3BD005C701A /* sign_update in Resources */ = {isa = PBXBuildFile; fileRef = 72E45DDC1B65C3BD005C701A /* sign_update */; };
|
||||
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC431D5E9ED8004AC8B6 /* SPUDownloadData.m */; };
|
||||
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; };
|
||||
@@ -431,6 +435,32 @@
|
||||
EA1E282622B64693004AA304 /* bscommon.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 72B09CEA1CEA18900052EF9E /* bscommon.h */; };
|
||||
EA1E282722B64694004AA304 /* bspatch.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 611142E810FB1BE5009810AA /* bspatch.h */; };
|
||||
EA1E282822B64694004AA304 /* sais.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7223E7621AD1AEFF008E3161 /* sais.h */; };
|
||||
EA1E284522B660ED004AA304 /* seed.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283522B660ED004AA304 /* seed.c */; };
|
||||
EA1E284622B660ED004AA304 /* fe.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283622B660ED004AA304 /* fe.c */; };
|
||||
EA1E284722B660ED004AA304 /* verify.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283722B660ED004AA304 /* verify.c */; };
|
||||
EA1E284822B660ED004AA304 /* ge.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283822B660ED004AA304 /* ge.c */; };
|
||||
EA1E284922B660ED004AA304 /* sc.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283922B660ED004AA304 /* sc.c */; };
|
||||
EA1E284A22B660ED004AA304 /* sign.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283A22B660ED004AA304 /* sign.c */; };
|
||||
EA1E284B22B660ED004AA304 /* key_exchange.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283C22B660ED004AA304 /* key_exchange.c */; };
|
||||
EA1E284C22B660ED004AA304 /* add_scalar.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E283D22B660ED004AA304 /* add_scalar.c */; };
|
||||
EA1E284D22B660ED004AA304 /* keypair.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E284022B660ED004AA304 /* keypair.c */; };
|
||||
EA1E284E22B660ED004AA304 /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = EA1E284222B660ED004AA304 /* sha512.c */; };
|
||||
EA1E284F22B66115004AA304 /* precomp_data.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E283422B660ED004AA304 /* precomp_data.h */; };
|
||||
EA1E285022B66115004AA304 /* sha512.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E283B22B660ED004AA304 /* sha512.h */; };
|
||||
EA1E285122B66115004AA304 /* ed25519.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E283E22B660ED004AA304 /* ed25519.h */; };
|
||||
EA1E285222B66115004AA304 /* fe.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E283F22B660ED004AA304 /* fe.h */; };
|
||||
EA1E285322B66115004AA304 /* fixedint.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E284122B660ED004AA304 /* fixedint.h */; };
|
||||
EA1E285422B66115004AA304 /* sc.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E284322B660ED004AA304 /* sc.h */; };
|
||||
EA1E285522B66115004AA304 /* ge.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = EA1E284422B660ED004AA304 /* ge.h */; };
|
||||
EA1E285622B6619B004AA304 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
EA1E286122B66487004AA304 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286022B66487004AA304 /* main.swift */; };
|
||||
EA1E286A22B6653D004AA304 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */ = {isa = PBXBuildFile; fileRef = EA1E286C22B665E8004AA304 /* SUSignatures.h */; };
|
||||
EA1E286F22B6661D004AA304 /* SUSignatures.h in Headers */ = {isa = PBXBuildFile; fileRef = EA1E286C22B665E8004AA304 /* SUSignatures.h */; };
|
||||
EA1E287022B66621004AA304 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
EA1E287122B66622004AA304 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
EA1E287922B666EB004AA304 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA1E287822B666EB004AA304 /* main.swift */; };
|
||||
EA1E287E22B66705004AA304 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; };
|
||||
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -513,6 +543,13 @@
|
||||
remoteGlobalIDString = EA1E280E22B64522004AA304;
|
||||
remoteInfo = bsdiff;
|
||||
};
|
||||
5A06357123FE332300478A72 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = EA1E282C22B660BE004AA304;
|
||||
remoteInfo = ed25519;
|
||||
};
|
||||
61B5F91B09C4CF7200B25A18 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
@@ -769,6 +806,41 @@
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E283222B660C6004AA304 /* Copy Headers */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
EA1E284F22B66115004AA304 /* precomp_data.h in Copy Headers */,
|
||||
EA1E285022B66115004AA304 /* sha512.h in Copy Headers */,
|
||||
EA1E285122B66115004AA304 /* ed25519.h in Copy Headers */,
|
||||
EA1E285222B66115004AA304 /* fe.h in Copy Headers */,
|
||||
EA1E285322B66115004AA304 /* fixedint.h in Copy Headers */,
|
||||
EA1E285422B66115004AA304 /* sc.h in Copy Headers */,
|
||||
EA1E285522B66115004AA304 /* ge.h in Copy Headers */,
|
||||
);
|
||||
name = "Copy Headers";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E285C22B66487004AA304 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
EA1E287422B666EB004AA304 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -791,7 +863,6 @@
|
||||
14732BB91960EEEE00593899 /* SampleAppcast.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = SampleAppcast.xml; sourceTree = "<group>"; };
|
||||
14732BBA1960EF7100593899 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = SOURCE_ROOT; };
|
||||
14732BBC1960EFB500593899 /* README.markdown */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.markdown; sourceTree = SOURCE_ROOT; };
|
||||
14732BBF1960F0AC00593899 /* test_app_only_dsa_pub.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = test_app_only_dsa_pub.pem; sourceTree = "<group>"; };
|
||||
14732BC11960F3B200593899 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = SOURCE_ROOT; usesTabs = 1; };
|
||||
14732BC31960F3FF00593899 /* generate_keys */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = generate_keys; sourceTree = "<group>"; };
|
||||
14732BC41960F3FF00593899 /* sign_update */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = sign_update; sourceTree = "<group>"; };
|
||||
@@ -895,7 +966,7 @@
|
||||
5AEF45D9189D1CC90030D7DC /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
5AF6C74C1AEA40760014A3AB /* SUInstallerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallerTest.m; sourceTree = "<group>"; };
|
||||
5AF6C74E1AEA46D10014A3AB /* test.pkg */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.pkg; sourceTree = "<group>"; };
|
||||
5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUDSAVerifierTest.m; sourceTree = "<group>"; };
|
||||
5AF9DC3B1981DBEE001EA135 /* SUSignatureVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSignatureVerifierTest.m; sourceTree = "<group>"; };
|
||||
5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BinaryDelta; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */ = {isa = PBXFileReference; comments = "-Wno-shorten-64-to-32"; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bsdiff.c; sourceTree = "<group>"; };
|
||||
5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = "<group>"; };
|
||||
@@ -972,17 +1043,14 @@
|
||||
657C5F2B218CBC1700925834 /* INSTALL.markdown */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.markdown; sourceTree = SOURCE_ROOT; };
|
||||
7205C43E1E13049400E370AE /* generate_appcast */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = generate_appcast; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7205C4401E13049400E370AE /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
7205C4461E1304C300E370AE /* Appcast-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Appcast-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
7205C4461E1304C300E370AE /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
7205C4471E1304CE00E370AE /* Appcast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Appcast.swift; sourceTree = "<group>"; };
|
||||
7205C4481E1304CE00E370AE /* ArchiveItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArchiveItem.swift; sourceTree = "<group>"; };
|
||||
7205C4491E1304CE00E370AE /* DSASignature.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DSASignature.swift; sourceTree = "<group>"; };
|
||||
7205C4491E1304CE00E370AE /* Signatures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Signatures.swift; sourceTree = "<group>"; };
|
||||
7205C44A1E1304CE00E370AE /* FeedXML.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedXML.swift; sourceTree = "<group>"; };
|
||||
7205C44B1E1304CE00E370AE /* Unarchive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unarchive.swift; sourceTree = "<group>"; };
|
||||
7205C4511E13053500E370AE /* ConfigSwiftDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigSwiftDebug.xcconfig; sourceTree = "<group>"; };
|
||||
7205C4521E13053500E370AE /* ConfigSwiftRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigSwiftRelease.xcconfig; sourceTree = "<group>"; };
|
||||
7205C4531E13054900E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = "<group>"; };
|
||||
7205C4541E13054900E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = "<group>"; };
|
||||
7205C4551E13054900E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = "<group>"; };
|
||||
7205C46C1E13244800E370AE /* ConfigUnitTestDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUnitTestDebug.xcconfig; sourceTree = "<group>"; };
|
||||
7205C46D1E13245600E370AE /* ConfigUnitTestRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUnitTestRelease.xcconfig; sourceTree = "<group>"; };
|
||||
7205C46E1E13254500E370AE /* ConfigUITestDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestDebug.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -1090,8 +1158,8 @@
|
||||
7267E5891D3D89CA00D1BF90 /* SUUnarchiverProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUUnarchiverProtocol.h; path = Autoupdate/SUUnarchiverProtocol.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5981D3D8A5A00D1BF90 /* SUCodeSigningVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUCodeSigningVerifier.h; path = Autoupdate/SUCodeSigningVerifier.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUCodeSigningVerifier.m; path = Autoupdate/SUCodeSigningVerifier.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E59A1D3D8A5A00D1BF90 /* SUDSAVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDSAVerifier.h; path = Autoupdate/SUDSAVerifier.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUDSAVerifier.m; path = Autoupdate/SUDSAVerifier.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E59A1D3D8A5A00D1BF90 /* SUSignatureVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUSignatureVerifier.h; path = Autoupdate/SUSignatureVerifier.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E59B1D3D8A5A00D1BF90 /* SUSignatureVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUSignatureVerifier.m; path = Autoupdate/SUSignatureVerifier.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E59E1D3D8A6F00D1BF90 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Autoupdate/main.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5A01D3D8A7E00D1BF90 /* AppInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppInstaller.h; path = Autoupdate/AppInstaller.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppInstaller.m; path = Autoupdate/AppInstaller.m; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1219,7 +1287,6 @@
|
||||
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateSettingsWindowController.m; sourceTree = "<group>"; };
|
||||
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
|
||||
72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; };
|
||||
72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_app_only_dsa_priv_dont_ever_do_this_for_real.pem; sourceTree = "<group>"; };
|
||||
72E45DDC1B65C3BD005C701A /* sign_update */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = sign_update; path = bin/sign_update; sourceTree = SOURCE_ROOT; };
|
||||
72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; };
|
||||
72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerLauncherDebug.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -1246,6 +1313,38 @@
|
||||
EA1E281422B64548004AA304 /* bsdiff-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "bsdiff-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E281522B64549004AA304 /* bsdiff-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "bsdiff-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E281622B64549004AA304 /* bsdiff-Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "bsdiff-Shared.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E282D22B660BE004AA304 /* libed25519.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libed25519.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA1E283422B660ED004AA304 /* precomp_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = precomp_data.h; sourceTree = "<group>"; };
|
||||
EA1E283522B660ED004AA304 /* seed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = seed.c; sourceTree = "<group>"; };
|
||||
EA1E283622B660ED004AA304 /* fe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fe.c; sourceTree = "<group>"; };
|
||||
EA1E283722B660ED004AA304 /* verify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = verify.c; sourceTree = "<group>"; };
|
||||
EA1E283822B660ED004AA304 /* ge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ge.c; sourceTree = "<group>"; };
|
||||
EA1E283922B660ED004AA304 /* sc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sc.c; sourceTree = "<group>"; };
|
||||
EA1E283A22B660ED004AA304 /* sign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sign.c; sourceTree = "<group>"; };
|
||||
EA1E283B22B660ED004AA304 /* sha512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha512.h; sourceTree = "<group>"; };
|
||||
EA1E283C22B660ED004AA304 /* key_exchange.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = key_exchange.c; sourceTree = "<group>"; };
|
||||
EA1E283D22B660ED004AA304 /* add_scalar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = add_scalar.c; sourceTree = "<group>"; };
|
||||
EA1E283E22B660ED004AA304 /* ed25519.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ed25519.h; sourceTree = "<group>"; };
|
||||
EA1E283F22B660ED004AA304 /* fe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fe.h; sourceTree = "<group>"; };
|
||||
EA1E284022B660ED004AA304 /* keypair.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = keypair.c; sourceTree = "<group>"; };
|
||||
EA1E284122B660ED004AA304 /* fixedint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixedint.h; sourceTree = "<group>"; };
|
||||
EA1E284222B660ED004AA304 /* sha512.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha512.c; sourceTree = "<group>"; };
|
||||
EA1E284322B660ED004AA304 /* sc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sc.h; sourceTree = "<group>"; };
|
||||
EA1E284422B660ED004AA304 /* ge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ge.h; sourceTree = "<group>"; };
|
||||
EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ed25519-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E285822B6622E004AA304 /* ed25519-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ed25519-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "ed25519-Shared.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E285E22B66487004AA304 /* generate_keys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = generate_keys; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA1E286022B66487004AA304 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
EA1E286622B664A5004AA304 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "CommandLineTool-Release.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "CommandLineTool-Debug.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E286922B664FD004AA304 /* CommandLineTool-Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "CommandLineTool-Shared.xcconfig"; sourceTree = "<group>"; };
|
||||
EA1E286C22B665E8004AA304 /* SUSignatures.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUSignatures.h; sourceTree = "<group>"; };
|
||||
EA1E286D22B665E8004AA304 /* SUSignatures.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUSignatures.m; sourceTree = "<group>"; };
|
||||
EA1E287622B666EB004AA304 /* sign_update */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sign_update; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA1E287822B666EB004AA304 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
EA1E287F22B667D8004AA304 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifierTest.m; sourceTree = "<group>"; };
|
||||
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp.zip; sourceTree = "<group>"; };
|
||||
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -1278,6 +1377,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A06357323FE333600478A72 /* libed25519.a in Frameworks */,
|
||||
EA1E281822B645CE004AA304 /* libbsdiff.a in Frameworks */,
|
||||
14732BD119610A1200593899 /* AppKit.framework in Frameworks */,
|
||||
14732BD019610A0D00593899 /* Foundation.framework in Frameworks */,
|
||||
@@ -1293,6 +1393,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A06357423FE33A400478A72 /* libed25519.a in Frameworks */,
|
||||
14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */,
|
||||
14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */,
|
||||
61B5F90F09C4CF3A00B25A18 /* Sparkle.framework in Frameworks */,
|
||||
@@ -1303,6 +1404,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E285622B6619B004AA304 /* libed25519.a in Frameworks */,
|
||||
EA1E281A22B645F4004AA304 /* libbsdiff.a in Frameworks */,
|
||||
7205C4641E1306BE00E370AE /* libbz2.tbd in Frameworks */,
|
||||
7205C4631E1306B500E370AE /* libxar.tbd in Frameworks */,
|
||||
@@ -1376,6 +1478,7 @@
|
||||
EA1E281722B645AE004AA304 /* libbsdiff.a in Frameworks */,
|
||||
7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */,
|
||||
7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */,
|
||||
5A06357023FE332300478A72 /* libed25519.a in Frameworks */,
|
||||
7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */,
|
||||
7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */,
|
||||
721D8A611D48413B0032E472 /* Security.framework in Frameworks */,
|
||||
@@ -1401,6 +1504,29 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E282B22B660BE004AA304 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E285B22B66487004AA304 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E286A22B6653D004AA304 /* libed25519.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E287322B666EB004AA304 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E287E22B66705004AA304 /* libed25519.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -1423,6 +1549,9 @@
|
||||
726B2B5D1C645FC900388755 /* UI Tests.xctest */,
|
||||
721C24451CB753E6005440CB /* Updater.app */,
|
||||
EA1E280F22B64522004AA304 /* libbsdiff.a */,
|
||||
EA1E282D22B660BE004AA304 /* libed25519.a */,
|
||||
EA1E285E22B66487004AA304 /* generate_keys */,
|
||||
EA1E287622B666EB004AA304 /* sign_update */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -1430,8 +1559,8 @@
|
||||
0867D691FE84028FC02AAC07 /* Sparkle */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7205C43F1E13049400E370AE /* generate_appcast */,
|
||||
1495006D195FBBBD00BC5B5B /* Sparkle */,
|
||||
EA1E288122B6688A004AA304 /* Command Line Tools */,
|
||||
14732BB81960EEB600593899 /* Resources */,
|
||||
61227A100DB5484000AB99EA /* Tests */,
|
||||
61B5F91D09C4CF7F00B25A18 /* Test Application */,
|
||||
@@ -1439,12 +1568,13 @@
|
||||
1420DE391962322200203BB0 /* Documentation */,
|
||||
FA1941C40D94A6EA00DD942E /* Configurations */,
|
||||
726B2B5E1C645FC900388755 /* UI Tests */,
|
||||
72D9549F1CBB415C006F28BD /* sparkle-cli */,
|
||||
0867D69AFE84028FC02AAC07 /* Frameworks */,
|
||||
034768DFFF38A50411DB9C8B /* Products */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
name = Sparkle;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 4;
|
||||
usesTabs = 0;
|
||||
};
|
||||
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
||||
@@ -1499,6 +1629,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
14732BB61960ECE800593899 /* bsdiff */,
|
||||
EA1E283322B660ED004AA304 /* ed25519 */,
|
||||
);
|
||||
path = Vendor;
|
||||
sourceTree = "<group>";
|
||||
@@ -1555,6 +1686,7 @@
|
||||
721C24461CB753E6005440CB /* Installer Progress */,
|
||||
729746481C91483B00FC134E /* IPC */,
|
||||
61B5F8F309C4CE5900B25A18 /* Other Sources */,
|
||||
EA1E286B22B665DB004AA304 /* Signatures */,
|
||||
61F83F6E0DBFE07A006FDD30 /* Update Control */,
|
||||
61299B3A09CB056100B7442F /* User Interface */,
|
||||
72F94F551CC43D99002DEE68 /* XPC Services */,
|
||||
@@ -1645,7 +1777,7 @@
|
||||
5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */,
|
||||
142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */,
|
||||
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */,
|
||||
5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */,
|
||||
5AF9DC3B1981DBEE001EA135 /* SUSignatureVerifierTest.m */,
|
||||
72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */,
|
||||
5AF6C74C1AEA40760014A3AB /* SUInstallerTest.m */,
|
||||
72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */,
|
||||
@@ -1767,8 +1899,6 @@
|
||||
72E45CF41B640DAE005C701A /* SUUpdateSettingsWindowController.h */,
|
||||
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */,
|
||||
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */,
|
||||
72E45CFD1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem */,
|
||||
14732BBF1960F0AC00593899 /* test_app_only_dsa_pub.pem */,
|
||||
61B5F90409C4CEE200B25A18 /* TestApplication-Info.plist */,
|
||||
);
|
||||
name = "Test Application";
|
||||
@@ -1780,8 +1910,8 @@
|
||||
children = (
|
||||
7267E5981D3D8A5A00D1BF90 /* SUCodeSigningVerifier.h */,
|
||||
7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */,
|
||||
7267E59A1D3D8A5A00D1BF90 /* SUDSAVerifier.h */,
|
||||
7267E59B1D3D8A5A00D1BF90 /* SUDSAVerifier.m */,
|
||||
7267E59A1D3D8A5A00D1BF90 /* SUSignatureVerifier.h */,
|
||||
7267E59B1D3D8A5A00D1BF90 /* SUSignatureVerifier.m */,
|
||||
);
|
||||
name = Verifiers;
|
||||
path = ..;
|
||||
@@ -1838,12 +1968,12 @@
|
||||
7205C43F1E13049400E370AE /* generate_appcast */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7205C4461E1304C300E370AE /* Appcast-Bridging-Header.h */,
|
||||
7205C4461E1304C300E370AE /* Bridging-Header.h */,
|
||||
7205C4471E1304CE00E370AE /* Appcast.swift */,
|
||||
7205C4481E1304CE00E370AE /* ArchiveItem.swift */,
|
||||
7205C4491E1304CE00E370AE /* DSASignature.swift */,
|
||||
7205C44A1E1304CE00E370AE /* FeedXML.swift */,
|
||||
7205C4401E13049400E370AE /* main.swift */,
|
||||
7205C4491E1304CE00E370AE /* Signatures.swift */,
|
||||
7205C44B1E1304CE00E370AE /* Unarchive.swift */,
|
||||
);
|
||||
path = generate_appcast;
|
||||
@@ -2046,6 +2176,69 @@
|
||||
name = Deprecated;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA1E283322B660ED004AA304 /* ed25519 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA1E283422B660ED004AA304 /* precomp_data.h */,
|
||||
EA1E283522B660ED004AA304 /* seed.c */,
|
||||
EA1E283622B660ED004AA304 /* fe.c */,
|
||||
EA1E283722B660ED004AA304 /* verify.c */,
|
||||
EA1E283822B660ED004AA304 /* ge.c */,
|
||||
EA1E283922B660ED004AA304 /* sc.c */,
|
||||
EA1E283A22B660ED004AA304 /* sign.c */,
|
||||
EA1E283B22B660ED004AA304 /* sha512.h */,
|
||||
EA1E283C22B660ED004AA304 /* key_exchange.c */,
|
||||
EA1E283D22B660ED004AA304 /* add_scalar.c */,
|
||||
EA1E283E22B660ED004AA304 /* ed25519.h */,
|
||||
EA1E283F22B660ED004AA304 /* fe.h */,
|
||||
EA1E284022B660ED004AA304 /* keypair.c */,
|
||||
EA1E284122B660ED004AA304 /* fixedint.h */,
|
||||
EA1E284222B660ED004AA304 /* sha512.c */,
|
||||
EA1E284322B660ED004AA304 /* sc.h */,
|
||||
EA1E284422B660ED004AA304 /* ge.h */,
|
||||
);
|
||||
name = ed25519;
|
||||
path = ed25519/src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA1E285F22B66487004AA304 /* generate_keys */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA1E286622B664A5004AA304 /* Bridging-Header.h */,
|
||||
EA1E286022B66487004AA304 /* main.swift */,
|
||||
);
|
||||
path = generate_keys;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA1E286B22B665DB004AA304 /* Signatures */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA1E286C22B665E8004AA304 /* SUSignatures.h */,
|
||||
EA1E286D22B665E8004AA304 /* SUSignatures.m */,
|
||||
);
|
||||
name = Signatures;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA1E287722B666EB004AA304 /* sign_update */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EA1E287F22B667D8004AA304 /* Bridging-Header.h */,
|
||||
EA1E287822B666EB004AA304 /* main.swift */,
|
||||
);
|
||||
path = sign_update;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EA1E288122B6688A004AA304 /* Command Line Tools */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7205C43F1E13049400E370AE /* generate_appcast */,
|
||||
EA1E285F22B66487004AA304 /* generate_keys */,
|
||||
EA1E287722B666EB004AA304 /* sign_update */,
|
||||
72D9549F1CBB415C006F28BD /* sparkle-cli */,
|
||||
);
|
||||
name = "Command Line Tools";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FA1941C40D94A6EA00DD942E /* Configurations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -2053,6 +2246,9 @@
|
||||
EA1E281422B64548004AA304 /* bsdiff-Debug.xcconfig */,
|
||||
EA1E281522B64549004AA304 /* bsdiff-Release.xcconfig */,
|
||||
EA1E281622B64549004AA304 /* bsdiff-Shared.xcconfig */,
|
||||
EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */,
|
||||
EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */,
|
||||
EA1E286922B664FD004AA304 /* CommandLineTool-Shared.xcconfig */,
|
||||
5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */,
|
||||
FA1941D00D94A70100DD942E /* ConfigCommon.xcconfig */,
|
||||
149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */,
|
||||
@@ -2062,9 +2258,6 @@
|
||||
72F94ED61CC344A7002DEE68 /* ConfigDownloaderDebug.xcconfig */,
|
||||
FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */,
|
||||
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */,
|
||||
7205C4531E13054900E370AE /* ConfigGenerateAppcast.xcconfig */,
|
||||
7205C4541E13054900E370AE /* ConfigGenerateAppcastDebug.xcconfig */,
|
||||
7205C4551E13054900E370AE /* ConfigGenerateAppcastRelease.xcconfig */,
|
||||
724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */,
|
||||
724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */,
|
||||
726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */,
|
||||
@@ -2089,6 +2282,9 @@
|
||||
149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */,
|
||||
7205C46C1E13244800E370AE /* ConfigUnitTestDebug.xcconfig */,
|
||||
7205C46D1E13245600E370AE /* ConfigUnitTestRelease.xcconfig */,
|
||||
EA1E285822B6622E004AA304 /* ed25519-Debug.xcconfig */,
|
||||
EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */,
|
||||
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */,
|
||||
14732BC91960F70A00593899 /* make-release-package.sh */,
|
||||
721D8A831D498F1D0032E472 /* set-agent-signing.sh */,
|
||||
729BB3CE1D50344A007C4276 /* set-ats-exceptions-downloader-service.sh */,
|
||||
@@ -2111,6 +2307,7 @@
|
||||
72A5D5EB1D692BD40009E5AC /* SPUDownloadData.h in Headers */,
|
||||
72A5D5F91D692F4C0009E5AC /* SPUStatusCompletionResults.h in Headers */,
|
||||
72A5D5E71D692BB00009E5AC /* SPUUpdatePermissionRequest.h in Headers */,
|
||||
EA1E286F22B6661D004AA304 /* SUSignatures.h in Headers */,
|
||||
72A5D5E21D692B770009E5AC /* SPUUpdater.h in Headers */,
|
||||
72A5D5E41D692B770009E5AC /* SPUUpdaterDelegate.h in Headers */,
|
||||
72A5D5E31D692B770009E5AC /* SPUUpdaterSettings.h in Headers */,
|
||||
@@ -2179,6 +2376,7 @@
|
||||
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */,
|
||||
72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */,
|
||||
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
|
||||
EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */,
|
||||
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */,
|
||||
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
|
||||
61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */,
|
||||
@@ -2481,6 +2679,7 @@
|
||||
);
|
||||
dependencies = (
|
||||
37DC0CE62340667000501A67 /* PBXTargetDependency */,
|
||||
5A06357223FE332300478A72 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Autoupdate;
|
||||
productName = Autoupdate;
|
||||
@@ -2546,6 +2745,57 @@
|
||||
productReference = EA1E280F22B64522004AA304 /* libbsdiff.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
EA1E282C22B660BE004AA304 /* ed25519 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EA1E282E22B660BE004AA304 /* Build configuration list for PBXNativeTarget "ed25519" */;
|
||||
buildPhases = (
|
||||
EA1E282A22B660BE004AA304 /* Sources */,
|
||||
EA1E282B22B660BE004AA304 /* Frameworks */,
|
||||
EA1E283222B660C6004AA304 /* Copy Headers */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ed25519;
|
||||
productName = ed25519;
|
||||
productReference = EA1E282D22B660BE004AA304 /* libed25519.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
EA1E285D22B66487004AA304 /* generate_keys */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EA1E286222B66487004AA304 /* Build configuration list for PBXNativeTarget "generate_keys" */;
|
||||
buildPhases = (
|
||||
EA1E285A22B66487004AA304 /* Sources */,
|
||||
EA1E285B22B66487004AA304 /* Frameworks */,
|
||||
EA1E285C22B66487004AA304 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = generate_keys;
|
||||
productName = generate_keys;
|
||||
productReference = EA1E285E22B66487004AA304 /* generate_keys */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
EA1E287522B666EB004AA304 /* sign_update */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = EA1E287D22B666EB004AA304 /* Build configuration list for PBXNativeTarget "sign_update" */;
|
||||
buildPhases = (
|
||||
EA1E287222B666EB004AA304 /* Sources */,
|
||||
EA1E287322B666EB004AA304 /* Frameworks */,
|
||||
EA1E287422B666EB004AA304 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = sign_update;
|
||||
productName = sign_update;
|
||||
productReference = EA1E287622B666EB004AA304 /* sign_update */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -2553,7 +2803,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = SU;
|
||||
LastSwiftUpdateCheck = 0820;
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 0830;
|
||||
ORGANIZATIONNAME = "Sparkle Project";
|
||||
TargetAttributes = {
|
||||
@@ -2617,6 +2867,15 @@
|
||||
EA1E280E22B64522004AA304 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
};
|
||||
EA1E282C22B660BE004AA304 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
};
|
||||
EA1E285D22B66487004AA304 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
};
|
||||
EA1E287522B666EB004AA304 = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "Sparkle" */;
|
||||
@@ -2690,7 +2949,10 @@
|
||||
1495005F195FB89400BC5B5B /* All */,
|
||||
726B2B5C1C645FC900388755 /* UI Tests */,
|
||||
7205C43D1E13049400E370AE /* generate_appcast */,
|
||||
EA1E285D22B66487004AA304 /* generate_keys */,
|
||||
EA1E287522B666EB004AA304 /* sign_update */,
|
||||
EA1E280E22B64522004AA304 /* bsdiff */,
|
||||
EA1E282C22B660BE004AA304 /* ed25519 */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -2726,8 +2988,6 @@
|
||||
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */,
|
||||
725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */,
|
||||
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */,
|
||||
72E45CFE1B641D0D005C701A /* test_app_only_dsa_priv_dont_ever_do_this_for_real.pem in Resources */,
|
||||
14732BC01960F2C200593899 /* test_app_only_dsa_pub.pem in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -2975,7 +3235,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "ln -sfh \"pt_BR.lproj\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/pt.lproj\"";
|
||||
shellScript = "ln -sfh \"pt_BR.lproj\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/pt.lproj\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
@@ -3009,8 +3269,8 @@
|
||||
7267E5F31D3D918500D1BF90 /* SUCodeSigningVerifier.m in Sources */,
|
||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
|
||||
7267E5F61D3D919000D1BF90 /* SUDiskImageUnarchiver.m in Sources */,
|
||||
7267E5F21D3D918000D1BF90 /* SUDSAVerifier.m in Sources */,
|
||||
5AF9DC3C1981DBEE001EA135 /* SUDSAVerifierTest.m in Sources */,
|
||||
7267E5F21D3D918000D1BF90 /* SUSignatureVerifier.m in Sources */,
|
||||
5AF9DC3C1981DBEE001EA135 /* SUSignatureVerifierTest.m in Sources */,
|
||||
7267E5E91D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
||||
72A4A2401BB6567D00E7820D /* SUFileManagerTest.swift in Sources */,
|
||||
7267E5F41D3D918B00D1BF90 /* SUGuidedPackageInstaller.m in Sources */,
|
||||
@@ -3050,7 +3310,7 @@
|
||||
72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */,
|
||||
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */,
|
||||
7205C44D1E1304CE00E370AE /* ArchiveItem.swift in Sources */,
|
||||
7205C44E1E1304CE00E370AE /* DSASignature.swift in Sources */,
|
||||
7205C44E1E1304CE00E370AE /* Signatures.swift in Sources */,
|
||||
7205C44F1E1304CE00E370AE /* FeedXML.swift in Sources */,
|
||||
7205C4411E13049400E370AE /* main.swift in Sources */,
|
||||
7205C45F1E13066F00E370AE /* SUBinaryDeltaApply.m in Sources */,
|
||||
@@ -3079,6 +3339,7 @@
|
||||
7267E5DC1D3D8F1E00D1BF90 /* SPUMessageTypes.m in Sources */,
|
||||
723C8A561E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */,
|
||||
721652621D3C44A100FD13D8 /* SPUSystemAuthorization.m in Sources */,
|
||||
5AA89BA623FE276A0094DAB8 /* SUSignatures.m in Sources */,
|
||||
7267E5FA1D3DAC3600D1BF90 /* StatusInfo.m in Sources */,
|
||||
720595EF1D700568000572E8 /* SUApplicationInfo.m in Sources */,
|
||||
7214B8831D456C2400CB5CED /* SUBundleIcon.m in Sources */,
|
||||
@@ -3131,6 +3392,7 @@
|
||||
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */,
|
||||
7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */,
|
||||
724BB3AF1D34828A005D534A /* SPUSystemAuthorization.m in Sources */,
|
||||
5AA89BA523FE27660094DAB8 /* SUSignatures.m in Sources */,
|
||||
7214B8841D456C9500CB5CED /* SUBundleIcon.m in Sources */,
|
||||
726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */,
|
||||
7267E5E81D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
||||
@@ -3174,6 +3436,7 @@
|
||||
72A5D5CD1D6929F80009E5AC /* SPUCoreBasedUpdateDriver.m in Sources */,
|
||||
72A5D5BD1D6929F80009E5AC /* SPUDownloadData.m in Sources */,
|
||||
72A5D5D01D6929F80009E5AC /* SPUDownloadDriver.m in Sources */,
|
||||
EA1E287122B66622004AA304 /* SUSignatures.m in Sources */,
|
||||
72A5D5AF1D6929F80009E5AC /* SPUDownloader.m in Sources */,
|
||||
72A5D5B71D6929F80009E5AC /* SPUInstallationInfo.m in Sources */,
|
||||
72A5D5B41D6929F80009E5AC /* SPUInstallationInputData.m in Sources */,
|
||||
@@ -3239,11 +3502,12 @@
|
||||
7267E59C1D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m in Sources */,
|
||||
7267E5CC1D3D8C6B00D1BF90 /* SUConstants.m in Sources */,
|
||||
7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */,
|
||||
7267E59D1D3D8A5A00D1BF90 /* SUDSAVerifier.m in Sources */,
|
||||
7267E59D1D3D8A5A00D1BF90 /* SUSignatureVerifier.m in Sources */,
|
||||
7267E5E71D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
||||
7267E5C21D3D8B2700D1BF90 /* SUGuidedPackageInstaller.m in Sources */,
|
||||
7267E5D71D3D8D3F00D1BF90 /* SUHost.m in Sources */,
|
||||
7267E5C31D3D8B2700D1BF90 /* SUInstaller.m in Sources */,
|
||||
5A6DD17123FE1FFC000AEF33 /* SUSignatures.m in Sources */,
|
||||
7267E5CE1D3D8C7500D1BF90 /* SULog.m in Sources */,
|
||||
7267E5C41D3D8B2700D1BF90 /* SUPackageInstaller.m in Sources */,
|
||||
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */,
|
||||
@@ -3316,6 +3580,7 @@
|
||||
55C14F07136EF6DB00649790 /* SULog.m in Sources */,
|
||||
726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */,
|
||||
61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */,
|
||||
EA1E287022B66621004AA304 /* SUSignatures.m in Sources */,
|
||||
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */,
|
||||
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */,
|
||||
61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */,
|
||||
@@ -3339,6 +3604,39 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E282A22B660BE004AA304 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E284622B660ED004AA304 /* fe.c in Sources */,
|
||||
EA1E284822B660ED004AA304 /* ge.c in Sources */,
|
||||
EA1E284722B660ED004AA304 /* verify.c in Sources */,
|
||||
EA1E284C22B660ED004AA304 /* add_scalar.c in Sources */,
|
||||
EA1E284D22B660ED004AA304 /* keypair.c in Sources */,
|
||||
EA1E284522B660ED004AA304 /* seed.c in Sources */,
|
||||
EA1E284B22B660ED004AA304 /* key_exchange.c in Sources */,
|
||||
EA1E284A22B660ED004AA304 /* sign.c in Sources */,
|
||||
EA1E284922B660ED004AA304 /* sc.c in Sources */,
|
||||
EA1E284E22B660ED004AA304 /* sha512.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E285A22B66487004AA304 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E286122B66487004AA304 /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
EA1E287222B666EB004AA304 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA1E287922B666EB004AA304 /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
@@ -3397,6 +3695,11 @@
|
||||
target = EA1E280E22B64522004AA304 /* bsdiff */;
|
||||
targetProxy = 37DC0CE52340667000501A67 /* PBXContainerItemProxy */;
|
||||
};
|
||||
5A06357223FE332300478A72 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = EA1E282C22B660BE004AA304 /* ed25519 */;
|
||||
targetProxy = 5A06357123FE332300478A72 /* PBXContainerItemProxy */;
|
||||
};
|
||||
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
|
||||
@@ -3819,27 +4122,24 @@
|
||||
};
|
||||
7205C4421E13049400E370AE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7205C4541E13054900E370AE /* ConfigGenerateAppcastDebug.xcconfig */;
|
||||
baseConfigurationReference = EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7205C4431E13049400E370AE /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7205C4541E13054900E370AE /* ConfigGenerateAppcastDebug.xcconfig */;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
7205C4441E13049400E370AE /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7205C4551E13054900E370AE /* ConfigGenerateAppcastRelease.xcconfig */;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
};
|
||||
name = Release;
|
||||
@@ -4084,6 +4384,69 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EA1E282F22B660BE004AA304 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E285822B6622E004AA304 /* ed25519-Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EA1E283022B660BE004AA304 /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
EA1E283122B660BE004AA304 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EA1E286322B66487004AA304 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EA1E286422B66487004AA304 /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
EA1E286522B66487004AA304 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
EA1E287A22B666EB004AA304 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
EA1E287B22B666EB004AA304 /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Coverage;
|
||||
};
|
||||
EA1E287C22B666EB004AA304 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -4287,6 +4650,36 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EA1E282E22B660BE004AA304 /* Build configuration list for PBXNativeTarget "ed25519" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EA1E282F22B660BE004AA304 /* Debug */,
|
||||
EA1E283022B660BE004AA304 /* Coverage */,
|
||||
EA1E283122B660BE004AA304 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EA1E286222B66487004AA304 /* Build configuration list for PBXNativeTarget "generate_keys" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EA1E286322B66487004AA304 /* Debug */,
|
||||
EA1E286422B66487004AA304 /* Coverage */,
|
||||
EA1E286522B66487004AA304 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
EA1E287D22B666EB004AA304 /* Build configuration list for PBXNativeTarget "sign_update" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
EA1E287A22B666EB004AA304 /* Debug */,
|
||||
EA1E287B22B666EB004AA304 /* Coverage */,
|
||||
EA1E287C22B666EB004AA304 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E285D22B66487004AA304"
|
||||
BuildableName = "generate_keys"
|
||||
BlueprintName = "generate_keys"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E285D22B66487004AA304"
|
||||
BuildableName = "generate_keys"
|
||||
BlueprintName = "generate_keys"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E285D22B66487004AA304"
|
||||
BuildableName = "generate_keys"
|
||||
BlueprintName = "generate_keys"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E285D22B66487004AA304"
|
||||
BuildableName = "generate_keys"
|
||||
BlueprintName = "generate_keys"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E287522B666EB004AA304"
|
||||
BuildableName = "sign_update"
|
||||
BlueprintName = "sign_update"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E287522B666EB004AA304"
|
||||
BuildableName = "sign_update"
|
||||
BlueprintName = "sign_update"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E287522B666EB004AA304"
|
||||
BuildableName = "sign_update"
|
||||
BlueprintName = "sign_update"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "EA1E287522B666EB004AA304"
|
||||
BuildableName = "sign_update"
|
||||
BlueprintName = "sign_update"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
Vendored
+2
-4
@@ -65,18 +65,16 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn))
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)__unused completionBlock
|
||||
{
|
||||
// Nothing really to do here.. this shouldn't be called.
|
||||
SULog(SULogLevelError, @"Error: resumeInstallingUpdateWithCompletion: called on SPUAutomaticUpdateDriver");
|
||||
abort();
|
||||
}
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate completion:(SPUUpdateDriverCompletion)__unused completionBlock __attribute__((noreturn))
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)__unused resumableUpdate completion:(SPUUpdateDriverCompletion)__unused completionBlock
|
||||
{
|
||||
// Nothing really to do here.. this shouldn't be called.
|
||||
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver");
|
||||
abort();
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem
|
||||
|
||||
Vendored
+2
@@ -69,6 +69,8 @@
|
||||
if ([self.host isRunningOnReadOnlyVolume])
|
||||
{
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%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.", nil), [self.host name]] }]];
|
||||
} else if ([self.host isRunningTranslocated]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningTranslocated userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can’t be updated if it’s running from the location it was downloaded to.", nil), [self.host name]] }]];
|
||||
} else {
|
||||
[self.appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background includesSkippedUpdates:includesSkippedUpdates];
|
||||
}
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
Vendored
+2
-4
@@ -171,15 +171,13 @@
|
||||
pathToRelaunch = relaunchPath;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *dsaSignature = (self.updateItem.DSASignature == nil) ? @"" : self.updateItem.DSASignature;
|
||||
|
||||
|
||||
NSString *decryptionPassword = nil;
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(decryptionPasswordForUpdater:)]) {
|
||||
decryptionPassword = [self.updaterDelegate decryptionPasswordForUpdater:self.updater];
|
||||
}
|
||||
|
||||
SPUInstallationInputData *installationData = [[SPUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName installationType:self.updateItem.installationType dsaSignature:dsaSignature decryptionPassword:decryptionPassword];
|
||||
SPUInstallationInputData *installationData = [[SPUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadName:self.downloadName installationType:self.updateItem.installationType signatures:self.updateItem.signatures decryptionPassword:decryptionPassword];
|
||||
|
||||
NSData *archivedData = SPUArchiveRootObjectSecurely(installationData);
|
||||
if (archivedData == nil) {
|
||||
|
||||
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Cocoa;
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
+9
-1
@@ -73,7 +73,15 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
NSError *updaterError = nil;
|
||||
if (![self.updater startUpdater:&updaterError]) {
|
||||
SULog(SULogLevelError, @"Fatal updater error (%ld): %@", updaterError.code, updaterError.localizedDescription);
|
||||
abort();
|
||||
|
||||
// Delay the alert four seconds so it doesn't show RIGHT as the app launches, but also doesn't interrupt the user once they really get to work.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"Unable to Check For Updates";
|
||||
alert.informativeText = @"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version.";
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
[alert runModal];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Cocoa;
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SPUUserDriver.h>
|
||||
#import <Sparkle/SPUStandardUserDriverProtocol.h>
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
@protocol SUVersionDisplay;
|
||||
|
||||
Vendored
-4
@@ -9,11 +9,7 @@
|
||||
#ifndef SPUStatusCompletionResults_h
|
||||
#define SPUStatusCompletionResults_h
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SPUUserInitiatedCheckStatus) {
|
||||
SPUUserInitiatedCheckDone,
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
Vendored
+3
-7
@@ -6,11 +6,7 @@
|
||||
// Copyright 2006 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
#import <Sparkle/SPUUserDriver.h>
|
||||
|
||||
@@ -134,9 +130,9 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
If the updater's delegate implements -[SPUUpdaterDelegate feedURLStringForUpdater:], this will return that feed URL.
|
||||
Otherwise if the feed URL has been set before, the feed URL returned will be retrieved from the host bundle's user defaults.
|
||||
Otherwise the feed URL in the host bundle's Info.plist will be returned.
|
||||
If no feed URL can be retrieved, this will raise an exception.
|
||||
If no feed URL can be retrieved, returns nil.
|
||||
|
||||
This property must be called on the main thread.
|
||||
This property must be called on the main thread; calls from background threads will return nil.
|
||||
*/
|
||||
@property (nonatomic, readonly) NSURL *feedURL;
|
||||
|
||||
@@ -149,7 +145,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
Passing nil will remove any feed URL that has been set in the host bundle's user defaults.
|
||||
|
||||
This method must be called on the main thread.
|
||||
This method must be called on the main thread; calls from background threads will have no effect.
|
||||
*/
|
||||
- (void)setFeedURL:(NSURL * _Nullable)feedURL;
|
||||
|
||||
|
||||
Vendored
+29
-17
@@ -29,6 +29,7 @@
|
||||
#import "SPUUpdaterCycle.h"
|
||||
#import "SPUUpdaterTimer.h"
|
||||
#import "SPUResumableUpdate.h"
|
||||
#import "SUSignatures.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -115,16 +116,24 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// To prevent subclasses from doing something bad based on older Sparkle code
|
||||
- (instancetype)initForBundle:(NSBundle *)__unused bundle
|
||||
{
|
||||
SULog(SULogLevelError, @"-[%@ initForBundle:] is not implemented anymore.", NSStringFromClass([self class]));
|
||||
abort();
|
||||
NSString *reason = [NSString stringWithFormat:@"-[%@ initForBundle:] is not implemented anymore in Sparkle 2.", NSStringFromClass([self class])];
|
||||
SULog(SULogLevelError, @"%@", reason);
|
||||
|
||||
NSException *exception = [NSException exceptionWithName:@"SUIncorrectAPIUsageException" reason:reason userInfo:nil];
|
||||
@throw exception;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
// To prevent trying to stick an SUUpdater in a nib or initializing it in an incorrect way
|
||||
- (instancetype)init
|
||||
{
|
||||
SULog(SULogLevelError, @"-[%@ init] is not implemented. If you want to drop an updater into a nib, see SPUStandardUpdaterController.", NSStringFromClass([self class]));
|
||||
abort();
|
||||
NSString *reason = [NSString stringWithFormat:@"-[%@ init] is not implemented. If you want to drop an updater into a nib, see SPUStandardUpdaterController.", NSStringFromClass([self class])];
|
||||
SULog(SULogLevelError, @"%@", reason);
|
||||
|
||||
NSException *exception = [NSException exceptionWithName:@"SUIncorrectAPIUsageException" reason:reason userInfo:nil];
|
||||
@throw exception;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -208,8 +217,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
BOOL hasPublicDSAKey = [self.host publicDSAKey] != nil;
|
||||
if (!hasPublicDSAKey) {
|
||||
BOOL hasPublicKey = self.host.publicKeys.dsaPubKey != nil || self.host.publicKeys.ed25519PubKey != nil;
|
||||
if (!hasPublicKey) {
|
||||
// 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) {
|
||||
@@ -219,11 +228,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPublicDSAKey) {
|
||||
|
||||
if (!hasPublicKey) {
|
||||
if (!servingOverHttps || ![SUCodeSigningVerifier bundleAtURLIsCodeSigned:[[self hostBundle] bundleURL]]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: @"For security reasons, updates need to be signed with a DSA key. See Sparkle's documentation for more information." }];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: @"For security reasons, updates need to be signed with an EdDSA key. See Sparkle's documentation for more information." }];
|
||||
}
|
||||
return NO;
|
||||
} else {
|
||||
@@ -231,7 +240,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// Deprecated because we pass the downloaded archive to the installer and the installer has no way of knowing where the download came from.
|
||||
// Even if it did, the server and the download on it could still be compromised. But if a DSA signature was used, the private key should
|
||||
// not be stored on the server serving the update
|
||||
SULog(SULogLevelDefault, @"DEPRECATION: Serving updates without a DSA key is now deprecated and may be removed from a future release. See Sparkle's documentation for more information.");
|
||||
SULog(SULogLevelDefault, @"DEPRECATION: Serving updates without an EdDSA key is now deprecated and may be removed from a future release. See Sparkle's documentation for more information.");
|
||||
|
||||
self.loggedDSAWarning = YES;
|
||||
}
|
||||
@@ -614,8 +623,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
- (void)setFeedURL:(NSURL * _Nullable)feedURL
|
||||
{
|
||||
if (![NSThread isMainThread]) {
|
||||
SULog(SULogLevelError, @"This method must be called on the main thread");
|
||||
abort();
|
||||
SULog(SULogLevelError, @"Error: SPUUpdater -setFeedURL: must be called on the main thread. The call from a background thread was ignored.");
|
||||
return;
|
||||
}
|
||||
|
||||
// When feedURL is nil, -absoluteString will return nil and will remove the user default key
|
||||
@@ -625,8 +634,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
- (BOOL)retrieveFeedURL:(NSURL * __autoreleasing *)feedURL error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
if (![NSThread isMainThread]) {
|
||||
SULog(SULogLevelError, @"This method must be called on the main thread");
|
||||
abort();
|
||||
SULog(SULogLevelError, @"Error: SPUUpdater -retrieveFeedURL:error: must be called on the main thread.");
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUIncorrectAPIUsageError userInfo:@{ NSLocalizedDescriptionKey: @"SUUpdater -retriveFeedURL:error: must be called on the main thread."}];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
// A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds).
|
||||
@@ -657,14 +669,14 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return YES;
|
||||
}
|
||||
|
||||
// A client may call this method but do not invoke this method ourselves because its unsafe
|
||||
// A client may call this method but do not invoke this method ourselves because it's unsafe
|
||||
- (NSURL *)feedURL
|
||||
{
|
||||
NSURL *feedURL = nil;
|
||||
NSError *feedError = nil;
|
||||
if (![self retrieveFeedURL:&feedURL error:&feedError]) {
|
||||
SULog(SULogLevelError, @"Fatal Feed Error (%ld): %@", feedError.code, feedError.localizedDescription);
|
||||
abort();
|
||||
SULog(SULogLevelError, @"Feed Error (%ld): %@", feedError.code, feedError.localizedDescription);
|
||||
return nil;
|
||||
}
|
||||
return feedURL;
|
||||
}
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
@protocol SUVersionComparison;
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SPUStatusCompletionResults.h>
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SPUStatusCompletionResults.h>
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
|
||||
Vendored
-4
@@ -9,11 +9,7 @@
|
||||
#ifndef SUAPPCAST_H
|
||||
#define SUAPPCAST_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
Vendored
+19
-9
@@ -105,9 +105,14 @@
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Encountered download feed error: %@", error);
|
||||
|
||||
NSDictionary *userInfo = [NSDictionary
|
||||
dictionaryWithObject: SULocalizedString(@"An error occurred while downloading the update feed.", nil)
|
||||
forKey: NSLocalizedDescriptionKey];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary
|
||||
dictionaryWithObject: SULocalizedString(@"An error occurred while downloading the update feed.", nil)
|
||||
forKey: NSLocalizedDescriptionKey];
|
||||
|
||||
if (error != nil) {
|
||||
NSError *assignedError = error; // Silences a Clang warning about implicit conversion from Nullable to Nonnull.
|
||||
[userInfo setObject:assignedError forKey:NSUnderlyingErrorKey];
|
||||
}
|
||||
|
||||
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain
|
||||
code:SUDownloadError
|
||||
@@ -258,12 +263,17 @@
|
||||
|
||||
- (void)reportError:(NSError *)error
|
||||
{
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey: [error localizedDescription],
|
||||
NSUnderlyingErrorKey: error,
|
||||
}];
|
||||
|
||||
NSMutableDictionary *userInfo = [error.userInfo mutableCopy];
|
||||
|
||||
if (!userInfo)
|
||||
{
|
||||
userInfo = [[NSMutableDictionary alloc] initWithDictionary:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey: [error localizedDescription],
|
||||
NSUnderlyingErrorKey: error,
|
||||
}];
|
||||
}
|
||||
|
||||
NSURL *failingUrl = [error.userInfo objectForKey:NSURLErrorFailingURLErrorKey];
|
||||
if (failingUrl) {
|
||||
[userInfo setObject:failingUrl forKey:NSURLErrorFailingURLErrorKey];
|
||||
|
||||
Vendored
+2
-5
@@ -9,19 +9,16 @@
|
||||
#ifndef SUAPPCASTITEM_H
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
@class SUSignatures;
|
||||
|
||||
SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
@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;
|
||||
|
||||
Vendored
+7
-6
@@ -10,6 +10,7 @@
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
#import "SULog.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUSignatures.h"
|
||||
#import "SPUInstallationType.h"
|
||||
|
||||
|
||||
@@ -17,7 +18,7 @@
|
||||
|
||||
static NSString *SUAppcastItemDeltaUpdatesKey = @"deltaUpdates";
|
||||
static NSString *SUAppcastItemDisplayVersionStringKey = @"displayVersionString";
|
||||
static NSString *SUAppcastItemDSASignatureKey = @"DSASignature";
|
||||
static NSString *SUAppcastItemSignaturesKey = @"signatures";
|
||||
static NSString *SUAppcastItemFileURLKey = @"fileURL";
|
||||
static NSString *SUAppcastItemInfoURLKey = @"infoURL";
|
||||
static NSString *SUAppcastItemContentLengthKey = @"contentLength";
|
||||
@@ -35,7 +36,7 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT
|
||||
@synthesize dateString = _dateString;
|
||||
@synthesize deltaUpdates = _deltaUpdates;
|
||||
@synthesize displayVersionString = _displayVersionString;
|
||||
@synthesize DSASignature = _DSASignature;
|
||||
@synthesize signatures = _signatures;
|
||||
@synthesize fileURL = _fileURL;
|
||||
@synthesize contentLength = _contentLength;
|
||||
@synthesize infoURL = _infoURL;
|
||||
@@ -61,7 +62,7 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT
|
||||
if (self != nil) {
|
||||
_deltaUpdates = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [SUAppcastItem class]]] forKey:SUAppcastItemDeltaUpdatesKey];
|
||||
_displayVersionString = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDisplayVersionStringKey] copy];
|
||||
_DSASignature = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemDSASignatureKey] copy];
|
||||
_signatures = (SUSignatures *)[decoder decodeObjectOfClass:[SUSignatures class] forKey:SUAppcastItemSignaturesKey];
|
||||
_fileURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFileURLKey];
|
||||
_infoURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemInfoURLKey];
|
||||
|
||||
@@ -94,8 +95,8 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT
|
||||
[encoder encodeObject:self.displayVersionString forKey:SUAppcastItemDisplayVersionStringKey];
|
||||
}
|
||||
|
||||
if (self.DSASignature != nil) {
|
||||
[encoder encodeObject:self.DSASignature forKey:SUAppcastItemDSASignatureKey];
|
||||
if (self.signatures != nil) {
|
||||
[encoder encodeObject:self.signatures forKey:SUAppcastItemSignaturesKey];
|
||||
}
|
||||
|
||||
if (self.fileURL != nil) {
|
||||
@@ -250,7 +251,7 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT
|
||||
_fileURL = [NSURL URLWithString:fileURLString];
|
||||
}
|
||||
if (enclosure) {
|
||||
_DSASignature = [(NSString *)[enclosure objectForKey:SUAppcastAttributeDSASignature] copy];
|
||||
_signatures = [[SUSignatures alloc] initWithDsa:[enclosure objectForKey:SUAppcastAttributeDSASignature] ed:[enclosure objectForKey:SUAppcastAttributeEDSignature]];
|
||||
}
|
||||
|
||||
_versionString = [(NSString *)newVersion copy];
|
||||
|
||||
Vendored
+3
@@ -43,8 +43,10 @@ extern NSString *const SUSkippedVersionKey;
|
||||
extern NSString *const SUScheduledCheckIntervalKey;
|
||||
extern NSString *const SULastCheckTimeKey;
|
||||
extern NSString *const SUExpectsDSASignatureKey;
|
||||
extern NSString *const SUExpectsEDSignatureKey;
|
||||
extern NSString *const SUPublicDSAKeyKey;
|
||||
extern NSString *const SUPublicDSAKeyFileKey;
|
||||
extern NSString *const SUPublicEDKeyKey;
|
||||
extern NSString *const SUAutomaticallyUpdateKey;
|
||||
extern NSString *const SUAllowsAutomaticUpdatesKey;
|
||||
extern NSString *const SUEnableAutomaticChecksKey;
|
||||
@@ -66,6 +68,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;
|
||||
|
||||
Vendored
+3
@@ -38,8 +38,10 @@ NSString *const SUSkippedVersionKey = @"SUSkippedVersion";
|
||||
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
|
||||
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||
NSString *const SUExpectsEDSignatureKey = @"SUExpectsEDSignatureKey";
|
||||
NSString *const SUPublicDSAKeyKey = @"SUPublicDSAKey";
|
||||
NSString *const SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
|
||||
NSString *const SUPublicEDKeyKey = @"SUPublicEDKey";
|
||||
NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
|
||||
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
|
||||
NSString *const SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
@@ -59,6 +61,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";
|
||||
|
||||
Vendored
+5
-5
@@ -9,11 +9,7 @@
|
||||
#ifndef SUERRORS_H
|
||||
#define SUERRORS_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
/**
|
||||
@@ -37,6 +33,7 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUAppcastError = 1002,
|
||||
SURunningFromDiskImageError = 1003,
|
||||
SUResumeAppcastError = 1004,
|
||||
SURunningTranslocated = 1005,
|
||||
|
||||
// Download phase errors.
|
||||
SUTemporaryDirectoryError = 2000,
|
||||
@@ -56,7 +53,10 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUDowngradeError = 4006,
|
||||
SUInstallationCanceledError = 4007,
|
||||
SUInstallationAuthorizeLaterError = 4008,
|
||||
SUNotAllowedInteractionError = 4009
|
||||
SUNotAllowedInteractionError = 4009,
|
||||
|
||||
// API misuse errors.
|
||||
SUIncorrectAPIUsageError = 5000
|
||||
};
|
||||
|
||||
#endif
|
||||
Vendored
+5
-1
@@ -7,6 +7,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class SUPublicKeys;
|
||||
|
||||
@interface SUHost : NSObject
|
||||
|
||||
@property (strong, readonly) NSBundle *bundle;
|
||||
@@ -18,8 +20,10 @@
|
||||
@property (readonly, copy) NSString *version;
|
||||
@property (readonly, nonatomic) BOOL validVersion;
|
||||
@property (readonly, copy) NSString *displayVersion;
|
||||
@property (readonly) SUPublicKeys *publicKeys;
|
||||
|
||||
@property (getter=isRunningOnReadOnlyVolume, readonly) BOOL runningOnReadOnlyVolume;
|
||||
@property (readonly, copy) NSString *publicDSAKey;
|
||||
@property (getter=isRunningTranslocated, readonly) BOOL runningTranslocated;
|
||||
@property (readonly, nonatomic, copy) NSString *publicDSAKeyFileKey;
|
||||
|
||||
- (id)objectForInfoDictionaryKey:(NSString *)key;
|
||||
|
||||
Vendored
+21
-2
@@ -10,6 +10,7 @@
|
||||
#import "SUConstants.h"
|
||||
#include <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
|
||||
#import "SULog.h"
|
||||
#import "SUSignatures.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -26,6 +27,7 @@
|
||||
@property (nonatomic, readonly) BOOL isMainBundle;
|
||||
@property (copy) NSString *defaultsDomain;
|
||||
@property (assign) BOOL usesStandardUserDefaults;
|
||||
@property (readonly, copy) NSString *publicDSAKey;
|
||||
|
||||
@end
|
||||
|
||||
@@ -105,7 +107,8 @@
|
||||
NSString *version = [self _version];
|
||||
if (version == nil) {
|
||||
SULog(SULogLevelError, @"This host (%@) has no %@! This attribute is required.", [self bundlePath], (__bridge NSString *)kCFBundleVersionKey);
|
||||
abort();
|
||||
// Instead of abort()-ing, return an empty string to satisfy the _Nonnull contract.
|
||||
return @"";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
@@ -126,6 +129,17 @@
|
||||
return (statfs_info.f_flags & MNT_RDONLY) != 0;
|
||||
}
|
||||
|
||||
- (BOOL)isRunningTranslocated
|
||||
{
|
||||
NSString *path = [self.bundle bundlePath];
|
||||
return [path rangeOfString:@"/AppTranslocation/"].location != NSNotFound;
|
||||
}
|
||||
|
||||
- (NSString *_Nullable)publicEDKey
|
||||
{
|
||||
return [self objectForInfoDictionaryKey:SUPublicEDKeyKey];
|
||||
}
|
||||
|
||||
- (NSString *_Nullable)publicDSAKey
|
||||
{
|
||||
// Maybe the key is just a string in the Info.plist.
|
||||
@@ -152,9 +166,14 @@
|
||||
return key;
|
||||
}
|
||||
|
||||
- (SUPublicKeys *)publicKeys
|
||||
{
|
||||
return [[SUPublicKeys alloc] initWithDsa:[self publicDSAKey] ed:[self publicEDKey]];
|
||||
}
|
||||
|
||||
- (NSString * _Nullable)publicDSAKeyFileKey
|
||||
{
|
||||
return [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];;
|
||||
return [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
|
||||
}
|
||||
|
||||
- (id)objectForInfoDictionaryKey:(NSString *)key
|
||||
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// 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 (SUSignatureVerifier)
|
||||
- (id)initWithBase64Encoding:(NSString *)base64String;
|
||||
@end
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUSignatures : NSObject <NSSecureCoding> {
|
||||
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;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+129
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// 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"
|
||||
|
||||
static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
static NSString *SUEDSignatureKey = @"SUEDSignature";
|
||||
|
||||
@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
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
NSData *dsaSignature = [decoder decodeObjectOfClass:[NSData class] forKey:SUDSASignatureKey];
|
||||
if (dsaSignature) {
|
||||
_dsaSignature = dsaSignature;
|
||||
}
|
||||
|
||||
NSData *edSignature = [decoder decodeObjectOfClass:[NSData class] forKey:SUEDSignatureKey];
|
||||
if (edSignature) {
|
||||
if (edSignature.length != sizeof(self->ed25519_signature)) {
|
||||
return nil;
|
||||
}
|
||||
[edSignature getBytes:self->ed25519_signature];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
if (self.dsaSignature) {
|
||||
[coder encodeObject:self.dsaSignature forKey:SUDSASignatureKey];
|
||||
}
|
||||
if (self.ed25519Signature) {
|
||||
// Xcode may enable this in pedantic mode
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
NSData *edSignature = [NSData dataWithBytesNoCopy:&self->ed25519_signature length:sizeof(self->ed25519_signature) freeWhenDone:false];
|
||||
#pragma clang diagnostic pop
|
||||
[coder encodeObject:edSignature forKey:SUEDSignatureKey];
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)supportsSecureCoding {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
- (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
|
||||
-4
@@ -9,11 +9,7 @@
|
||||
#ifndef SUSTANDARDVERSIONCOMPARATOR_H
|
||||
#define SUSTANDARDVERSIONCOMPARATOR_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
/*!
|
||||
|
||||
Vendored
+4
-5
@@ -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;
|
||||
|
||||
|
||||
Vendored
+108
-87
@@ -7,20 +7,20 @@
|
||||
//
|
||||
|
||||
#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 (strong, nonatomic, readonly) SUSignatures *signatures;
|
||||
@property (nonatomic, readonly) NSString *downloadPath;
|
||||
|
||||
@end
|
||||
@@ -28,58 +28,44 @@
|
||||
@implementation SUUpdateValidator
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize canValidate = _canValidate;
|
||||
@synthesize prevalidatedDsaSignature = _prevalidatedDsaSignature;
|
||||
@synthesize dsaSignature = _dsaSignature;
|
||||
@synthesize prevalidatedSignature = _prevalidatedSignature;
|
||||
@synthesize signatures = _signatures;
|
||||
@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:host.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);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)validateWithUpdateDirectory:(NSString *)updateDirectory
|
||||
{
|
||||
assert(self.canValidate);
|
||||
|
||||
NSString *DSASignature = self.dsaSignature;
|
||||
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
|
||||
@@ -91,19 +77,19 @@
|
||||
|
||||
NSURL *installSourceURL = [NSURL fileURLWithPath:installSource];
|
||||
|
||||
if (!prevalidatedDsaSignature) {
|
||||
if (!self.prevalidatedSignature) {
|
||||
// Check to see if we have a package or bundle to validate
|
||||
if (isPackage) {
|
||||
// If we get here, then the appcast installation type was lying to us.. This error will be caught later when starting the installer.
|
||||
// For package type updates, all we do is check if the DSA signature is valid
|
||||
BOOL validationCheckSuccess = [SUDSAVerifier validatePath:downloadPath withEncodedDSASignature:DSASignature withPublicDSAKey:host.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 validateBundleUpdateForHost:host newBundleURL:installSourceURL archivePath:downloadPath DSASignature:DSASignature];
|
||||
return [self validateUpdateForHost:host downloadedToPath:downloadPath newBundleURL:installSourceURL signatures:signatures];
|
||||
}
|
||||
} else if (isPackage) {
|
||||
// We already prevalidated the package and nothing else needs to be done
|
||||
@@ -116,70 +102,105 @@
|
||||
if ([SUCodeSigningVerifier bundleAtURLIsCodeSigned:installSourceURL] && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:installSourceURL error:&error]) {
|
||||
SULog(SULogLevelError, @"Failed to validate apple code sign signature on bundle after archive validation with error: %@", error);
|
||||
return NO;
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)validateBundleUpdateForHost:(SUHost *)host newBundleURL:(NSURL *)newBundleURL archivePath:(NSString *)archivePath DSASignature:(NSString *)DSASignature
|
||||
/**
|
||||
* If the update is a bundle, then it must meet any one of:
|
||||
*
|
||||
* * old and new DSA public keys are the same and valid (it allows change of Code Signing identity), or
|
||||
*
|
||||
* * old and new Code Signing identity are the same and valid
|
||||
*
|
||||
*/
|
||||
- (BOOL)validateUpdateForHost:(SUHost *)host downloadedToPath:(NSString *)downloadedPath newBundleURL:(NSURL *)newBundleURL signatures:(SUSignatures *)signatures
|
||||
{
|
||||
NSBundle *newBundle = [NSBundle bundleWithURL:newBundleURL];
|
||||
if (newBundle == nil) {
|
||||
SULog(SULogLevelError, @"No suitable bundle is found in the update. The update will be rejected.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
SUPublicKeys *publicKeys = host.publicKeys;
|
||||
|
||||
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
|
||||
NSString *newPublicDSAKey = newHost.publicDSAKey;
|
||||
|
||||
NSString *publicDSAKey = host.publicDSAKey;
|
||||
|
||||
// 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.");
|
||||
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];
|
||||
|
||||
// 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:archivePath 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:newBundleURL];
|
||||
|
||||
if (dsaKeysMatch) {
|
||||
NSError *error = nil;
|
||||
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newBundleURL 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 {
|
||||
NSURL *hostBundleURL = host.bundle.bundleURL;
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:hostBundleURL];
|
||||
|
||||
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:hostBundleURL matchesSignatureAtBundleURL:newBundleURL 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
|
||||
Vendored
-4
@@ -9,11 +9,7 @@
|
||||
#ifndef SUUPDATER_H
|
||||
#define SUUPDATER_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Cocoa;
|
||||
#else
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
#import <Sparkle/SUVersionDisplayProtocol.h>
|
||||
|
||||
Vendored
-1
@@ -86,7 +86,6 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
NSError *updaterError = nil;
|
||||
if (![self.updater startUpdater:&updaterError]) {
|
||||
SULog(SULogLevelError, @"Error: Failed to start updater with error: %@", updaterError);
|
||||
abort();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
@protocol SUVersionComparison, SUVersionDisplay;
|
||||
|
||||
-5
@@ -9,12 +9,7 @@
|
||||
#ifndef SUVERSIONCOMPARISONPROTOCOL_H
|
||||
#define SUVERSIONCOMPARISONPROTOCOL_H
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
Vendored
-5
@@ -6,12 +6,7 @@
|
||||
// Copyright 2009 Elgato Systems GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
/*!
|
||||
|
||||
Vendored
+2
@@ -2,6 +2,8 @@
|
||||
|
||||
"%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." = "Aplikace %1$@ nemůže být aktualizována, protože je spuštěna z média na které nelze zapisovat. Může to být CD/DVD-ROM, obraz disku nebo jen nemáte právo zápisu na disk. Přesuňte aplikaci %1$@ do vaší složky Aplikace, spusťte ji z tohoto umístěni znovu.";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "Aplikace %1$@ nemůže být aktualizována pokud je spuštěna z umístění, ve kterém je stažena.";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ je nejnovější dostupná verze";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
|
||||
Vendored
+2
@@ -4,6 +4,8 @@
|
||||
|
||||
"%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$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG Datei oder Laufwerk ohne Schreibzugriff gestartet wurde. Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ ist zurzeit die neueste verfügbare Version.";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
|
||||
Vendored
+1
@@ -25,6 +25,7 @@
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window identifier="SUUpdateAlert" title="Software Update" 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"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="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="778"/>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<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"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="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"/>
|
||||
|
||||
Vendored
+2
@@ -4,6 +4,8 @@
|
||||
|
||||
"%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$@ 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$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ can’t be updated if it’s running from the location it was downloaded to.";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ is currently the newest version available.";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
|
||||
Vendored
+2
@@ -4,6 +4,8 @@
|
||||
|
||||
"%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$@ ne peut pas être mis à jour quand il fonctionne à partir d’un volume en lecture seule, comme une image disque ou un lecteur optique. Déplacez %1$@ dans votre dossier Applications, relancez-le à partir de là et réessayez.";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ ne peut pas être mis à jour s'il est exécuté depuis le dossier dans lequel il a été téléchargé.";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ est la version la plus récente disponible.";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
|
||||
Vendored
+2
@@ -4,6 +4,8 @@
|
||||
|
||||
"%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$@は読み出し専用またはテンポラリな場所で開かれているためアップデートできません。%1$@をアプリケーションフォルダに移動し、そこから再起動したあとやり直してください。";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "この場所ではダウンロードされたアップデータを %1$@ に適用できません。";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@は現在入手できる最新バージョンです。";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
|
||||
Vendored
+2
@@ -2,6 +2,8 @@
|
||||
|
||||
"%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$@,因为它运行于一个只读宗卷如磁盘映像或光盘。移动 %1$@ 到应用程序文件夹并再试一次。";
|
||||
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "如果在下载位置运行此程序,则无法对 %1$@ 进行更新。";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ 是当前的最新版本。";
|
||||
|
||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ 可供下载,您现在的版本是 %3$@。要现在下载吗?";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "SUFileManager.h"
|
||||
#import "SUTestWebServer.h"
|
||||
#import "TestAppHelperProtocol.h"
|
||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||
|
||||
@interface SUTestApplicationDelegate ()
|
||||
|
||||
@@ -128,30 +129,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];
|
||||
signUpdateTask.arguments = @[(NSString *)archiveURL.path, privateKeyPath];
|
||||
|
||||
NSPipe *outputPipe = [NSPipe pipe];
|
||||
signUpdateTask.standardOutput = outputPipe;
|
||||
|
||||
[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);
|
||||
NSData *archive = [NSData dataWithContentsOfURL:archiveURL];
|
||||
assert(archive != nil);
|
||||
|
||||
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
||||
|
||||
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64Encoding];
|
||||
|
||||
// Obtain the file attributes to get the file size of our update later
|
||||
NSError *fileAttributesError = nil;
|
||||
@@ -188,7 +177,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;
|
||||
|
||||
@@ -56,7 +56,12 @@
|
||||
NSError *updaterError = nil;
|
||||
if (![self.updater startUpdater:&updaterError]) {
|
||||
NSLog(@"Failed to start updater with error: %@", updaterError);
|
||||
abort();
|
||||
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"Updater Error";
|
||||
alert.informativeText = @"The Updater failed to start. For detailed error information, check the Console.app log.";
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
[alert runModal];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,7 +28,7 @@
|
||||
<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>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -17,7 +17,7 @@
|
||||
]]>
|
||||
</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-----
|
||||
@@ -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-----
|
||||
@@ -0,0 +1,4 @@
|
||||
# Inherits from top level config
|
||||
disabled_rules:
|
||||
- force_try
|
||||
- force_cast
|
||||
@@ -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 -->
|
||||
|
||||
+43
-43
@@ -7,82 +7,82 @@
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Sparkle;
|
||||
import Sparkle
|
||||
|
||||
class SUAppcastTest: XCTestCase {
|
||||
|
||||
func testParseAppcast() {
|
||||
let appcast = SUAppcast();
|
||||
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "testappcast", ofType: "xml")!;
|
||||
let appcast = SUAppcast()
|
||||
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "testappcast", ofType: "xml")!
|
||||
let testData = NSData(contentsOfFile: testFile)!
|
||||
|
||||
|
||||
do {
|
||||
let items = try appcast.parseAppcastItems(fromXMLData: testData as Data) as! [SUAppcastItem];
|
||||
|
||||
XCTAssertEqual(4, items.count);
|
||||
|
||||
XCTAssertEqual("Version 2.0", items[0].title);
|
||||
XCTAssertEqual("desc", items[0].itemDescription);
|
||||
let items = try appcast.parseAppcastItems(fromXMLData: testData as Data) as! [SUAppcastItem]
|
||||
|
||||
XCTAssertEqual(4, items.count)
|
||||
|
||||
XCTAssertEqual("Version 2.0", items[0].title)
|
||||
XCTAssertEqual("desc", items[0].itemDescription)
|
||||
XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString)
|
||||
XCTAssertTrue(items[0].isCriticalUpdate);
|
||||
|
||||
XCTAssertTrue(items[0].isCriticalUpdate)
|
||||
|
||||
// This is the best release matching our system version
|
||||
XCTAssertEqual("Version 3.0", items[1].title);
|
||||
XCTAssertNil(items[1].itemDescription);
|
||||
XCTAssertEqual("Version 3.0", items[1].title)
|
||||
XCTAssertNil(items[1].itemDescription)
|
||||
XCTAssertNil(items[1].dateString)
|
||||
XCTAssertFalse(items[1].isCriticalUpdate);
|
||||
|
||||
XCTAssertEqual("Version 4.0", items[2].title);
|
||||
XCTAssertNil(items[2].itemDescription);
|
||||
XCTAssertFalse(items[1].isCriticalUpdate)
|
||||
|
||||
XCTAssertEqual("Version 4.0", items[2].title)
|
||||
XCTAssertNil(items[2].itemDescription)
|
||||
XCTAssertEqual("Sat, 26 Jul 2014 15:20:13 +0000", items[2].dateString)
|
||||
XCTAssertFalse(items[2].isCriticalUpdate);
|
||||
|
||||
XCTAssertEqual("Version 5.0", items[3].title);
|
||||
XCTAssertNil(items[3].itemDescription);
|
||||
XCTAssertFalse(items[2].isCriticalUpdate)
|
||||
|
||||
XCTAssertEqual("Version 5.0", items[3].title)
|
||||
XCTAssertNil(items[3].itemDescription)
|
||||
XCTAssertNil(items[3].dateString)
|
||||
XCTAssertFalse(items[3].isCriticalUpdate);
|
||||
|
||||
XCTAssertFalse(items[3].isCriticalUpdate)
|
||||
|
||||
// Test best appcast item & a delta update item
|
||||
var deltaItem: SUAppcastItem? = nil
|
||||
var deltaItem: SUAppcastItem?
|
||||
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: items, getDeltaItem: &deltaItem, withHostVersion: "1.0", comparator: SUStandardVersionComparator())
|
||||
|
||||
XCTAssertEqual(bestAppcastItem, items[1])
|
||||
XCTAssertEqual(deltaItem!.fileURL.lastPathComponent, "3.0_from_1.0.patch")
|
||||
|
||||
|
||||
// Test latest delta update item available
|
||||
var latestDeltaItem: SUAppcastItem? = nil
|
||||
var latestDeltaItem: SUAppcastItem?
|
||||
SUAppcastDriver.bestItem(fromAppcastItems: items, getDeltaItem: &latestDeltaItem, withHostVersion: "2.0", comparator: SUStandardVersionComparator())
|
||||
|
||||
|
||||
XCTAssertEqual(latestDeltaItem!.fileURL.lastPathComponent, "3.0_from_2.0.patch")
|
||||
|
||||
|
||||
// Test a delta item that does not exist
|
||||
var nonexistantDeltaItem: SUAppcastItem? = nil
|
||||
var nonexistantDeltaItem: SUAppcastItem?
|
||||
SUAppcastDriver.bestItem(fromAppcastItems: items, getDeltaItem: &nonexistantDeltaItem, withHostVersion: "2.1", comparator: SUStandardVersionComparator())
|
||||
|
||||
|
||||
XCTAssertNil(nonexistantDeltaItem)
|
||||
} catch let err as NSError {
|
||||
NSLog("%@", err);
|
||||
XCTFail(err.localizedDescription);
|
||||
NSLog("%@", err)
|
||||
XCTFail(err.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
func testNamespaces() {
|
||||
let appcast = SUAppcast();
|
||||
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "testnamespaces", ofType: "xml")!;
|
||||
let appcast = SUAppcast()
|
||||
let testFile = Bundle(for: SUAppcastTest.self).path(forResource: "testnamespaces", ofType: "xml")!
|
||||
let testData = NSData(contentsOfFile: testFile)!
|
||||
|
||||
do {
|
||||
let items = try appcast.parseAppcastItems(fromXMLData: testData as Data) as! [SUAppcastItem];
|
||||
let items = try appcast.parseAppcastItems(fromXMLData: testData as Data) as! [SUAppcastItem]
|
||||
|
||||
XCTAssertEqual(2, items.count);
|
||||
XCTAssertEqual(2, items.count)
|
||||
|
||||
XCTAssertEqual("Version 2.0", items[1].title);
|
||||
XCTAssertEqual("desc", items[1].itemDescription);
|
||||
XCTAssertNotNil(items[0].releaseNotesURL);
|
||||
XCTAssertEqual("https://sparkle-project.org/#works", items[0].releaseNotesURL!.absoluteString);
|
||||
XCTAssertEqual("Version 2.0", items[1].title)
|
||||
XCTAssertEqual("desc", items[1].itemDescription)
|
||||
XCTAssertNotNil(items[0].releaseNotesURL)
|
||||
XCTAssertEqual("https://sparkle-project.org/#works", items[0].releaseNotesURL!.absoluteString)
|
||||
} catch let err as NSError {
|
||||
NSLog("%@", err);
|
||||
XCTFail(err.localizedDescription);
|
||||
NSLog("%@", err)
|
||||
XCTFail(err.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,14 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SUAdHocCodeSigning.h"
|
||||
#import "SUFileManager.h"
|
||||
|
||||
#if defined(__MAC_10_15)
|
||||
// In macOS 10.15 and later, pre-installed apps are installed under the System folder
|
||||
#define CALCULATOR_PATH @"/System/Applications/Calculator.app"
|
||||
#else
|
||||
#define CALCULATOR_PATH @"/Applications/Calculator.app"
|
||||
#endif
|
||||
|
||||
@interface SUCodeSigningVerifierTest : XCTestCase
|
||||
|
||||
@@ -30,6 +34,13 @@
|
||||
@synthesize invalidSignedAppURL = _invalidSignedAppURL;
|
||||
@synthesize calculatorCopyURL = _calculatorCopyURL;
|
||||
|
||||
+ (NSString *)calculatorApplicationPath
|
||||
{
|
||||
NSString *applicationsDirectory = [NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSSystemDomainMask, NO) objectAtIndex:0];
|
||||
NSString *calculatorPath = [applicationsDirectory stringByAppendingPathComponent:@"Calculator.app"];
|
||||
return calculatorPath;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
@@ -87,8 +98,9 @@
|
||||
}
|
||||
|
||||
self.validSignedAppURL = signedAndValid;
|
||||
if (![SUAdHocCodeSigning codeSignApplicationAtPath:self.validSignedAppURL.path]) {
|
||||
NSLog(@"Failed to codesign %@", self.validSignedAppURL);
|
||||
|
||||
if (![self codesignAppURL:self.validSignedAppURL]) {
|
||||
XCTFail(@"Failed to codesign %@", self.validSignedAppURL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,14 +111,15 @@
|
||||
|
||||
[[NSFileManager defaultManager] removeItemAtURL:calculatorCopy error:NULL];
|
||||
|
||||
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
|
||||
// Make a copy of the signed calculator app so we can match signatures later
|
||||
// Matching signatures on ad-hoc signed apps does *not* work
|
||||
NSError *copyError = nil;
|
||||
// Don't check the return value of this operation - seems like on 10.11 the API can say it fails even though the operation really succeeds,
|
||||
// which sounds like some kind of (SIP / attribute?) bug
|
||||
[[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:CALCULATOR_PATH] toURL:calculatorCopy error:©Error];
|
||||
[[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:calculatorPath] toURL:calculatorCopy error:©Error];
|
||||
|
||||
if (![calculatorCopy checkResourceIsReachableAndReturnError:NULL]) {
|
||||
if (![calculatorCopy checkResourceIsReachableAndReturnError:nil]) {
|
||||
XCTFail(@"Copied calculator application does not exist");
|
||||
}
|
||||
|
||||
@@ -131,7 +144,7 @@
|
||||
[[NSFileManager defaultManager] removeItemAtURL:signedAndInvalid error:NULL];
|
||||
if ([[NSFileManager defaultManager] copyItemAtURL:self.notSignedAppURL toURL:signedAndInvalid error:&error]) {
|
||||
self.invalidSignedAppURL = signedAndInvalid;
|
||||
if ([SUAdHocCodeSigning codeSignApplicationAtPath:self.invalidSignedAppURL.path]) {
|
||||
if ([self codesignAppURL:self.invalidSignedAppURL]) {
|
||||
NSURL *fileInAppBundleToRemove = [self.invalidSignedAppURL URLByAppendingPathComponent:@"Contents/Resources/test_app_only_dsa_pub.pem"];
|
||||
if (![[NSFileManager defaultManager] removeItemAtURL:fileInAppBundleToRemove error:&error]) {
|
||||
NSLog(@"Failed to remove %@ with error %@", fileInAppBundleToRemove, error);
|
||||
@@ -167,6 +180,25 @@
|
||||
return success;
|
||||
}
|
||||
|
||||
- (BOOL)codesignAppURL:(NSURL *)appURL
|
||||
{
|
||||
BOOL success = NO;
|
||||
@try
|
||||
{
|
||||
// ad-hoc signing with the dash
|
||||
NSString *appPath = [appURL path];
|
||||
NSArray<NSString *> *arguments = @[ @"--force", @"--deep", @"--sign", @"-", appPath ];
|
||||
NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/codesign" arguments:arguments];
|
||||
[task waitUntilExit];
|
||||
success = (task.terminationStatus == 0);
|
||||
}
|
||||
@catch (NSException *exception)
|
||||
{
|
||||
NSLog(@"exception: %@", exception);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
- (void)testUnsignedApp
|
||||
{
|
||||
XCTAssertFalse([SUCodeSigningVerifier bundleAtURLIsCodeSigned:self.notSignedAppURL], @"App not expected to be code signed");
|
||||
@@ -187,7 +219,8 @@
|
||||
|
||||
- (void)testValidSignedCalculatorApp
|
||||
{
|
||||
NSURL *appPath = [NSURL fileURLWithPath:CALCULATOR_PATH];
|
||||
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
|
||||
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
|
||||
XCTAssertTrue([SUCodeSigningVerifier bundleAtURLIsCodeSigned:appPath], @"App expected to be code signed");
|
||||
|
||||
NSError *error = nil;
|
||||
@@ -197,23 +230,26 @@
|
||||
|
||||
- (void)testValidMatchingSelf
|
||||
{
|
||||
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
|
||||
NSError *error = nil;
|
||||
NSURL *appPath = [NSURL fileURLWithPath:CALCULATOR_PATH];
|
||||
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
|
||||
|
||||
XCTAssertTrue([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:appPath error:&error], @"Our valid signed app expected to having matching signature to itself");
|
||||
}
|
||||
|
||||
- (void)testValidMatching
|
||||
{
|
||||
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
|
||||
// We can't test our own app because matching with ad-hoc signed apps understandably does not succeed
|
||||
NSError *error = nil;
|
||||
NSURL *appPath = [NSURL fileURLWithPath:CALCULATOR_PATH];
|
||||
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
|
||||
XCTAssertTrue([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:self.calculatorCopyURL error:&error], @"The calculator app is expected to have matching identity signature to its altered copy");
|
||||
}
|
||||
|
||||
- (void)testInvalidMatching
|
||||
{
|
||||
NSURL *appPath = [NSURL fileURLWithPath:CALCULATOR_PATH];
|
||||
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
|
||||
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
|
||||
NSError *error = nil;
|
||||
XCTAssertFalse([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:self.validSignedAppURL error:&error], @"Calculator app bundle expected to have different signature than our valid signed app");
|
||||
}
|
||||
|
||||
@@ -13,54 +13,54 @@ class SUFileManagerTest: XCTestCase
|
||||
func makeTempFiles(_ testBlock: (SUFileManager, URL, URL, URL, URL, URL, URL) -> Void)
|
||||
{
|
||||
let fileManager = SUFileManager()
|
||||
|
||||
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectory(withPreferredName: "Sparkle Unit Test Data", appropriateForDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
|
||||
|
||||
defer {
|
||||
try! fileManager.removeItem(at: tempDirectoryURL)
|
||||
}
|
||||
|
||||
|
||||
let ordinaryFileURL = tempDirectoryURL.appendingPathComponent("a file written by sparkles unit tests")
|
||||
try! "foo".data(using: String.Encoding.utf8)!.write(to: ordinaryFileURL, options: .atomic)
|
||||
|
||||
|
||||
let directoryURL = tempDirectoryURL.appendingPathComponent("a directory written by sparkles unit tests")
|
||||
try! FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: false, attributes: nil)
|
||||
|
||||
|
||||
let fileInDirectoryURL = directoryURL.appendingPathComponent("a file inside a directory written by sparkles unit tests")
|
||||
try! "bar baz".data(using: String.Encoding.utf8)!.write(to: fileInDirectoryURL, options: .atomic)
|
||||
|
||||
|
||||
let validSymlinkURL = tempDirectoryURL.appendingPathComponent("symlink test")
|
||||
try! FileManager.default.createSymbolicLink(at: validSymlinkURL, withDestinationURL: directoryURL)
|
||||
|
||||
|
||||
let invalidSymlinkURL = tempDirectoryURL.appendingPathComponent("symlink test 2")
|
||||
try! FileManager.default.createSymbolicLink(at: invalidSymlinkURL, withDestinationURL: (tempDirectoryURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
testBlock(fileManager, tempDirectoryURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL)
|
||||
}
|
||||
|
||||
|
||||
func testMoveFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.moveItem(at: ordinaryFileURL, to: directoryURL))
|
||||
XCTAssertNil(try? fileManager.moveItem(at: ordinaryFileURL, to: directoryURL.appendingPathComponent("foo").appendingPathComponent("bar")))
|
||||
XCTAssertNil(try? fileManager.moveItem(at: rootURL.appendingPathComponent("does not exist"), to: directoryURL))
|
||||
|
||||
|
||||
let newFileURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new file"))
|
||||
try! fileManager.moveItem(at: ordinaryFileURL, to: newFileURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: newFileURL))
|
||||
|
||||
|
||||
let newValidSymlinkURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new symlink"))
|
||||
try! fileManager.moveItem(at: validSymlinkURL, to: newValidSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: validSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: newValidSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: directoryURL))
|
||||
|
||||
|
||||
let newInvalidSymlinkURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new invalid symlink"))
|
||||
try! fileManager.moveItem(at: invalidSymlinkURL, to: newInvalidSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: invalidSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: newValidSymlinkURL))
|
||||
|
||||
|
||||
let newDirectoryURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new directory"))
|
||||
try! fileManager.moveItem(at: directoryURL, to: newDirectoryURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: directoryURL))
|
||||
@@ -69,23 +69,23 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertTrue(fileManager._itemExists(at: newDirectoryURL.appendingPathComponent(fileInDirectoryURL.lastPathComponent)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testCopyFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, _, invalidSymlinkURL in
|
||||
XCTAssertNil(try? fileManager.copyItem(at: ordinaryFileURL, to: directoryURL))
|
||||
XCTAssertNil(try? fileManager.copyItem(at: ordinaryFileURL, to: directoryURL.appendingPathComponent("foo").appendingPathComponent("bar")))
|
||||
XCTAssertNil(try? fileManager.copyItem(at: rootURL.appendingPathComponent("does not exist"), to: directoryURL))
|
||||
|
||||
|
||||
let newFileURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new file"))
|
||||
try! fileManager.copyItem(at: ordinaryFileURL, to: newFileURL)
|
||||
XCTAssertTrue(fileManager._itemExists(at: ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: newFileURL))
|
||||
|
||||
|
||||
let newSymlinkURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new symlink file"))
|
||||
try! fileManager.copyItem(at: invalidSymlinkURL, to: newSymlinkURL)
|
||||
XCTAssertTrue(fileManager._itemExists(at: newSymlinkURL))
|
||||
|
||||
|
||||
let newDirectoryURL = (ordinaryFileURL.deletingLastPathComponent().appendingPathComponent("new directory"))
|
||||
try! fileManager.copyItem(at: directoryURL, to: newDirectoryURL)
|
||||
XCTAssertTrue(fileManager._itemExists(at: directoryURL))
|
||||
@@ -97,80 +97,80 @@ class SUFileManagerTest: XCTestCase
|
||||
|
||||
func testRemoveFiles()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, _ in
|
||||
XCTAssertNil(try? fileManager.removeItem(at: rootURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
try! fileManager.removeItem(at: ordinaryFileURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: ordinaryFileURL))
|
||||
|
||||
|
||||
try! fileManager.removeItem(at: validSymlinkURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: validSymlinkURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: directoryURL))
|
||||
|
||||
|
||||
try! fileManager.removeItem(at: directoryURL)
|
||||
XCTAssertFalse(fileManager._itemExists(at: directoryURL))
|
||||
XCTAssertFalse(fileManager._itemExists(at: fileInDirectoryURL))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testReleaseFilesFromQuarantine()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, _, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, _ in
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: ordinaryFileURL)
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: directoryURL)
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: validSymlinkURL)
|
||||
|
||||
|
||||
let quarantineData = "does not really matter what is here".cString(using: String.Encoding.utf8)!
|
||||
let quarantineDataLength = Int(strlen(quarantineData))
|
||||
|
||||
|
||||
XCTAssertEqual(0, setxattr(ordinaryFileURL.path, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE))
|
||||
XCTAssertGreaterThan(getxattr(ordinaryFileURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
|
||||
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: ordinaryFileURL)
|
||||
XCTAssertEqual(-1, getxattr(ordinaryFileURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
|
||||
|
||||
XCTAssertEqual(0, setxattr(directoryURL.path, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE))
|
||||
XCTAssertGreaterThan(getxattr(directoryURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
|
||||
|
||||
XCTAssertEqual(0, setxattr(fileInDirectoryURL.path, SUAppleQuarantineIdentifier, quarantineData, quarantineDataLength, 0, XATTR_CREATE))
|
||||
XCTAssertGreaterThan(getxattr(fileInDirectoryURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
|
||||
|
||||
// Extended attributes can't be set on symbolic links currently
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: validSymlinkURL)
|
||||
XCTAssertGreaterThan(getxattr(directoryURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW), 0)
|
||||
XCTAssertEqual(-1, getxattr(validSymlinkURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
|
||||
|
||||
try! fileManager.releaseItemFromQuarantine(atRootURL: directoryURL)
|
||||
|
||||
|
||||
XCTAssertEqual(-1, getxattr(directoryURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
XCTAssertEqual(-1, getxattr(fileInDirectoryURL.path, SUAppleQuarantineIdentifier, nil, 0, 0, XATTR_NOFOLLOW))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func groupIDAtPath(_ path: String) -> gid_t
|
||||
{
|
||||
let attributes = try! FileManager.default.attributesOfItem(atPath: path)
|
||||
let groupID = attributes[FileAttributeKey.groupOwnerAccountID] as! NSNumber
|
||||
return groupID.uint32Value
|
||||
}
|
||||
|
||||
|
||||
// Only the super user can alter user IDs, so changing user IDs is not tested here
|
||||
// Instead we try to change the group ID - we just have to be a member of that group
|
||||
func testAlterFilesGroupID()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, _ in
|
||||
XCTAssertNil(try? fileManager.changeOwnerAndGroupOfItem(atRootURL: ordinaryFileURL, toMatch: rootURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
XCTAssertNil(try? fileManager.changeOwnerAndGroupOfItem(atRootURL: rootURL.appendingPathComponent("does not exist"), toMatch: ordinaryFileURL))
|
||||
|
||||
|
||||
let everyoneGroup = getgrnam("everyone")
|
||||
let everyoneGroupID = everyoneGroup?.pointee.gr_gid
|
||||
|
||||
|
||||
let staffGroup = getgrnam("staff")
|
||||
let staffGroupID = staffGroup?.pointee.gr_gid
|
||||
|
||||
|
||||
XCTAssertNotEqual(staffGroupID, everyoneGroupID)
|
||||
|
||||
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(ordinaryFileURL.path))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(directoryURL.path))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(fileInDirectoryURL.path))
|
||||
@@ -179,55 +179,55 @@ class SUFileManagerTest: XCTestCase
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: fileInDirectoryURL, toMatch: ordinaryFileURL)
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: ordinaryFileURL, toMatch: ordinaryFileURL)
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: validSymlinkURL, toMatch: ordinaryFileURL)
|
||||
|
||||
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(ordinaryFileURL.path))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(directoryURL.path))
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(validSymlinkURL.path))
|
||||
|
||||
|
||||
XCTAssertEqual(0, chown(ordinaryFileURL.path, getuid(), everyoneGroupID!))
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(ordinaryFileURL.path))
|
||||
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: fileInDirectoryURL, toMatch: ordinaryFileURL)
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(fileInDirectoryURL.path))
|
||||
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: fileInDirectoryURL, toMatch: directoryURL)
|
||||
XCTAssertEqual(staffGroupID, self.groupIDAtPath(fileInDirectoryURL.path))
|
||||
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: validSymlinkURL, toMatch: ordinaryFileURL)
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(validSymlinkURL.path))
|
||||
|
||||
|
||||
try! fileManager.changeOwnerAndGroupOfItem(atRootURL: directoryURL, toMatch: ordinaryFileURL)
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(directoryURL.path))
|
||||
XCTAssertEqual(everyoneGroupID, self.groupIDAtPath(fileInDirectoryURL.path))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testUpdateFileModificationTime()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, _, validSymlinkURL, _ in
|
||||
XCTAssertNil(try? fileManager.updateModificationAndAccessTimeOfItem(at: rootURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
let oldOrdinaryFileAttributes = try! FileManager.default.attributesOfItem(atPath: ordinaryFileURL.path)
|
||||
let oldDirectoryAttributes = try! FileManager.default.attributesOfItem(atPath: directoryURL.path)
|
||||
let oldValidSymlinkAttributes = try! FileManager.default.attributesOfItem(atPath: validSymlinkURL.path)
|
||||
|
||||
|
||||
sleep(1); // wait for clock to advance
|
||||
|
||||
|
||||
try! fileManager.updateModificationAndAccessTimeOfItem(at: ordinaryFileURL)
|
||||
try! fileManager.updateModificationAndAccessTimeOfItem(at: directoryURL)
|
||||
try! fileManager.updateModificationAndAccessTimeOfItem(at: validSymlinkURL)
|
||||
|
||||
|
||||
let newOrdinaryFileAttributes = try! FileManager.default.attributesOfItem(atPath: ordinaryFileURL.path)
|
||||
XCTAssertGreaterThan((newOrdinaryFileAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldOrdinaryFileAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newDirectoryAttributes = try! FileManager.default.attributesOfItem(atPath: directoryURL.path)
|
||||
XCTAssertGreaterThan((newDirectoryAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldDirectoryAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newSymlinkAttributes = try! FileManager.default.attributesOfItem(atPath: validSymlinkURL.path)
|
||||
XCTAssertGreaterThan((newSymlinkAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldValidSymlinkAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testUpdateFileAccessTime()
|
||||
{
|
||||
let accessTime: ((URL) -> timespec?) = { url in
|
||||
@@ -239,34 +239,34 @@ class SUFileManagerTest: XCTestCase
|
||||
return outputStat.st_atimespec
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let timespecEqual: (timespec, timespec) -> Bool = {t1, t2 in
|
||||
(t1.tv_sec == t2.tv_sec && t1.tv_nsec == t2.tv_nsec)
|
||||
}
|
||||
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, _ in
|
||||
XCTAssertNil(try? fileManager.updateAccessTimeOfItem(atRootURL: rootURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
let oldOrdinaryFileTime = accessTime(ordinaryFileURL)!
|
||||
let oldDirectoryTime = accessTime(directoryURL)!
|
||||
let oldValidSymlinkTime = accessTime(validSymlinkURL)!
|
||||
|
||||
|
||||
sleep(1); // wait for clock to advance
|
||||
|
||||
|
||||
// Make sure access time haven't changed since; lstat() shouldn't have changed the access time..
|
||||
XCTAssertTrue(timespecEqual(oldOrdinaryFileTime, accessTime(ordinaryFileURL)!))
|
||||
XCTAssertTrue(timespecEqual(oldDirectoryTime, accessTime(directoryURL)!))
|
||||
XCTAssertTrue(timespecEqual(oldValidSymlinkTime, accessTime(validSymlinkURL)!))
|
||||
|
||||
|
||||
// Test the symlink and make sure the target directory doesn't change
|
||||
try! fileManager.updateAccessTimeOfItem(atRootURL: validSymlinkURL)
|
||||
XCTAssertFalse(timespecEqual(oldValidSymlinkTime, accessTime(validSymlinkURL)!))
|
||||
XCTAssertTrue(timespecEqual(oldDirectoryTime, accessTime(directoryURL)!))
|
||||
|
||||
|
||||
// Test an ordinary file
|
||||
try! fileManager.updateAccessTimeOfItem(atRootURL: ordinaryFileURL)
|
||||
XCTAssertFalse(timespecEqual(oldOrdinaryFileTime, accessTime(ordinaryFileURL)!))
|
||||
|
||||
|
||||
// Test the directory and file inside the directory
|
||||
try! fileManager.updateAccessTimeOfItem(atRootURL: directoryURL)
|
||||
let newDirectoryTime = accessTime(directoryURL)!
|
||||
@@ -274,50 +274,50 @@ class SUFileManagerTest: XCTestCase
|
||||
XCTAssertTrue(timespecEqual(newDirectoryTime, accessTime(fileInDirectoryURL)!))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testFileExists()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, _, validSymlinkURL, invalidSymlinkURL in
|
||||
XCTAssertTrue(fileManager._itemExists(at: ordinaryFileURL))
|
||||
XCTAssertTrue(fileManager._itemExists(at: directoryURL))
|
||||
XCTAssertFalse(fileManager._itemExists(at: rootURL.appendingPathComponent("does not exist")))
|
||||
|
||||
|
||||
var isOrdinaryFileDirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExists(at: ordinaryFileURL, isDirectory: &isOrdinaryFileDirectory) && !isOrdinaryFileDirectory.boolValue)
|
||||
|
||||
|
||||
var isDirectoryADirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExists(at: directoryURL, isDirectory: &isDirectoryADirectory) && isDirectoryADirectory.boolValue)
|
||||
|
||||
|
||||
XCTAssertFalse(fileManager._itemExists(at: rootURL.appendingPathComponent("does not exist"), isDirectory: nil))
|
||||
|
||||
|
||||
XCTAssertTrue(fileManager._itemExists(at: validSymlinkURL))
|
||||
|
||||
|
||||
var validSymlinkIsADirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExists(at: validSymlinkURL, isDirectory: &validSymlinkIsADirectory) && !validSymlinkIsADirectory.boolValue)
|
||||
|
||||
|
||||
// Symlink should still exist even if it doesn't point to a file that exists
|
||||
XCTAssertTrue(fileManager._itemExists(at: invalidSymlinkURL))
|
||||
|
||||
|
||||
var invalidSymlinkIsADirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExists(at: invalidSymlinkURL, isDirectory: &invalidSymlinkIsADirectory) && !invalidSymlinkIsADirectory.boolValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func testMakeDirectory()
|
||||
{
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, fileInDirectoryURL, validSymlinkURL, invalidSymlinkURL in
|
||||
makeTempFiles() { fileManager, rootURL, ordinaryFileURL, directoryURL, _, validSymlinkURL, _ in
|
||||
XCTAssertNil(try? fileManager.makeDirectory(at: ordinaryFileURL))
|
||||
XCTAssertNil(try? fileManager.makeDirectory(at: directoryURL))
|
||||
|
||||
|
||||
XCTAssertNil(try? fileManager.makeDirectory(at: rootURL.appendingPathComponent("this should").appendingPathComponent("be a failure")))
|
||||
|
||||
|
||||
let newDirectoryURL = rootURL.appendingPathComponent("new test directory")
|
||||
XCTAssertFalse(fileManager._itemExists(at: newDirectoryURL))
|
||||
try! fileManager.makeDirectory(at: newDirectoryURL)
|
||||
|
||||
|
||||
var isDirectory: ObjCBool = false
|
||||
XCTAssertTrue(fileManager._itemExists(at: newDirectoryURL, isDirectory: &isDirectory))
|
||||
|
||||
|
||||
try! fileManager.removeItem(at: directoryURL)
|
||||
XCTAssertNil(try? fileManager.makeDirectory(at: validSymlinkURL))
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -14,47 +14,47 @@ class SUSpotlightImporterTest: XCTestCase
|
||||
{
|
||||
let fileManager = SUFileManager()
|
||||
let tempDirectoryURL = try! fileManager.makeTemporaryDirectory(withPreferredName: "Sparkle Unit Test Data", appropriateForDirectoryURL: URL(fileURLWithPath: NSHomeDirectory()))
|
||||
|
||||
|
||||
let bundleDirectory = tempDirectoryURL.appendingPathComponent("bundle.app")
|
||||
try! fileManager.makeDirectory(at: bundleDirectory)
|
||||
|
||||
|
||||
let innerDirectory = bundleDirectory.appendingPathComponent("foo")
|
||||
try! fileManager.makeDirectory(at: innerDirectory)
|
||||
try! Data().write(to: (bundleDirectory.appendingPathComponent("bar")), options: .atomicWrite)
|
||||
|
||||
|
||||
let importerDirectory = innerDirectory.appendingPathComponent("baz.mdimporter")
|
||||
|
||||
|
||||
try! fileManager.makeDirectory(at: importerDirectory)
|
||||
try! fileManager.makeDirectory(at: innerDirectory.appendingPathComponent("flag"))
|
||||
|
||||
|
||||
try! Data().write(to: (importerDirectory.appendingPathComponent("file")), options: .atomicWrite)
|
||||
|
||||
|
||||
let oldFooDirectoryAttributes = try! FileManager.default.attributesOfItem(atPath: innerDirectory.path)
|
||||
let oldBarFileAttributes = try! FileManager.default.attributesOfItem(atPath: bundleDirectory.appendingPathComponent("bar").path)
|
||||
let oldImporterAttributes = try! FileManager.default.attributesOfItem(atPath: importerDirectory.path)
|
||||
let oldFlagAttributes = try! FileManager.default.attributesOfItem(atPath: innerDirectory.appendingPathComponent("flag").path)
|
||||
let oldFileInImporterAttributes = try! FileManager.default.attributesOfItem(atPath: importerDirectory.appendingPathComponent("file").path)
|
||||
|
||||
|
||||
sleep(1) // wait for clock to advance
|
||||
|
||||
|
||||
// Update spotlight bundles
|
||||
SUBinaryDeltaUnarchiver.updateSpotlightImporters(atBundlePath: bundleDirectory.path)
|
||||
|
||||
|
||||
let newFooDirectoryAttributes = try! FileManager.default.attributesOfItem(atPath: innerDirectory.path)
|
||||
XCTAssertEqual((newFooDirectoryAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldFooDirectoryAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newBarFileAttributes = try! FileManager.default.attributesOfItem(atPath: bundleDirectory.appendingPathComponent("bar").path)
|
||||
XCTAssertEqual((newBarFileAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldBarFileAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newImporterAttributes = try! FileManager.default.attributesOfItem(atPath: importerDirectory.path)
|
||||
XCTAssertGreaterThan((newImporterAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldImporterAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newFlagAttributes = try! FileManager.default.attributesOfItem(atPath: innerDirectory.appendingPathComponent("flag").path)
|
||||
XCTAssertEqual((newFlagAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldFlagAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
let newFileInImporterAttributes = try! FileManager.default.attributesOfItem(atPath: importerDirectory.appendingPathComponent("file").path)
|
||||
XCTAssertEqual((newFileInImporterAttributes[FileAttributeKey.modificationDate] as! Date).timeIntervalSince(oldFileInImporterAttributes[FileAttributeKey.modificationDate] as! Date), 0)
|
||||
|
||||
|
||||
try! fileManager.removeItem(at: tempDirectoryURL)
|
||||
}
|
||||
}
|
||||
@@ -13,84 +13,85 @@ class SUUnarchiverTest: XCTestCase
|
||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, password: String? = nil) {
|
||||
let appName = "SparkleTestCodeSignApp"
|
||||
let archiveResourceURL = Bundle(for: type(of: self)).url(forResource: appName, withExtension: archiveExtension)!
|
||||
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
|
||||
// Do not remove this temporary directory
|
||||
// If we do want to clean up and remove it (which isn't necessary but nice), we'd have to remove it
|
||||
// after *both* our unarchive success and failure calls below finish (they both have async completion blocks inside their implementation)
|
||||
let tempDirectoryURL = try! fileManager.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: URL(fileURLWithPath: NSHomeDirectory()), create: true)
|
||||
|
||||
|
||||
let unarchivedSuccessExpectation = super.expectation(description: "Unarchived Success (format: \(archiveExtension))")
|
||||
let unarchivedFailureExpectation = super.expectation(description: "Unarchived Failure (format: \(archiveExtension))")
|
||||
|
||||
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent(archiveResourceURL.lastPathComponent)
|
||||
let extractedAppURL = tempDirectoryURL.appendingPathComponent(appName).appendingPathExtension("app")
|
||||
|
||||
self.unarchiveTestSuccessAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, tempArchiveURL: tempArchiveURL, archiveResourceURL: archiveResourceURL, password: password, testExpectation: unarchivedSuccessExpectation);
|
||||
self.unarchiveTestFailureAppWithExtension(archiveExtension, tempDirectoryURL: tempDirectoryURL, password: password, testExpectation: unarchivedFailureExpectation);
|
||||
|
||||
|
||||
self.unarchiveTestSuccessAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, tempArchiveURL: tempArchiveURL, archiveResourceURL: archiveResourceURL, password: password, testExpectation: unarchivedSuccessExpectation)
|
||||
self.unarchiveTestFailureAppWithExtension(archiveExtension, tempDirectoryURL: tempDirectoryURL, password: password, testExpectation: unarchivedFailureExpectation)
|
||||
|
||||
super.waitForExpectations(timeout: 7.0, handler: nil)
|
||||
|
||||
|
||||
XCTAssertTrue(fileManager.fileExists(atPath: extractedAppURL.path))
|
||||
|
||||
|
||||
XCTAssertEqual("6a60ab31430cfca8fb499a884f4a29f73e59b472", hashOfTree(extractedAppURL.path))
|
||||
}
|
||||
|
||||
|
||||
func unarchiveTestFailureAppWithExtension(_ archiveExtension: String, tempDirectoryURL: URL, password: String?, testExpectation: XCTestExpectation) {
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent("error-invalid").appendingPathExtension(archiveExtension);
|
||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent("error-invalid").appendingPathExtension(archiveExtension)
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
||||
|
||||
|
||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||
XCTAssertNotNil(error);
|
||||
XCTAssertNotNil(error)
|
||||
testExpectation.fulfill()
|
||||
}, progressBlock: nil);
|
||||
}, progressBlock: nil)
|
||||
}
|
||||
|
||||
|
||||
// swiftlint:disable function_parameter_count
|
||||
func unarchiveTestSuccessAppWithExtension(_ archiveExtension: String, appName: String, tempDirectoryURL: URL, tempArchiveURL: URL, archiveResourceURL: URL, password: String?, testExpectation: XCTestExpectation) {
|
||||
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
|
||||
try! fileManager.copyItem(at: archiveResourceURL, to: tempArchiveURL)
|
||||
|
||||
|
||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
||||
|
||||
|
||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||
XCTAssertNil(error);
|
||||
XCTAssertNil(error)
|
||||
testExpectation.fulfill()
|
||||
}, progressBlock: nil);
|
||||
}, progressBlock: nil)
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingZip()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("zip")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingTarDotGz()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("tar.gz")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingTar()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("tar")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingTarDotBz2()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("tar.bz2")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingTarDotXz()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("tar.xz")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingDmg()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("dmg")
|
||||
}
|
||||
|
||||
|
||||
func testUnarchivingEncryptedDmg()
|
||||
{
|
||||
self.unarchiveTestAppWithExtension("enc.dmg", password: "testpass")
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Inherits from top level config
|
||||
disabled_rules:
|
||||
- force_try
|
||||
- force_cast
|
||||
@@ -10,10 +10,10 @@ import XCTest
|
||||
|
||||
class SUTestApplicationTest: XCTestCase
|
||||
{
|
||||
var testApplicationURL: URL? = nil
|
||||
var testApplicationBackupURL: URL? = nil
|
||||
var tempDirectoryURL: URL? = nil
|
||||
|
||||
var testApplicationURL: URL?
|
||||
var testApplicationBackupURL: URL?
|
||||
var tempDirectoryURL: URL?
|
||||
|
||||
func runningTestApplication() -> NSRunningApplication
|
||||
{
|
||||
// TODO: don't hardcode bundle ID?
|
||||
@@ -21,91 +21,91 @@ class SUTestApplicationTest: XCTestCase
|
||||
XCTAssertEqual(runningApplications.count, 1, "More than one or zero running instances of the Test Application are found")
|
||||
return runningApplications[0]
|
||||
}
|
||||
|
||||
|
||||
override func setUp()
|
||||
{
|
||||
super.setUp()
|
||||
|
||||
|
||||
let app = XCUIApplication()
|
||||
app.launch()
|
||||
|
||||
|
||||
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
||||
|
||||
|
||||
// We need to grab the app URL so we can back up the app
|
||||
// When a successful test is over we'll revert the update
|
||||
let testApplicationURL = self.runningTestApplication().bundleURL!
|
||||
|
||||
|
||||
let tempDirectoryURL = try! FileManager.default.url(for: .itemReplacementDirectory, in: FileManager.SearchPathDomainMask.userDomainMask, appropriateFor: testApplicationURL, create: true)
|
||||
|
||||
|
||||
let testApplicationBackupURL = tempDirectoryURL.appendingPathComponent(testApplicationURL.lastPathComponent)
|
||||
|
||||
|
||||
try! FileManager.default.copyItem(at: testApplicationURL, to: testApplicationBackupURL)
|
||||
|
||||
|
||||
self.testApplicationURL = testApplicationURL
|
||||
self.testApplicationBackupURL = testApplicationBackupURL
|
||||
self.tempDirectoryURL = tempDirectoryURL
|
||||
|
||||
|
||||
// when we add more tests we don't want to continue after a failure
|
||||
// since a test can fail after the new app has been placed in
|
||||
self.continueAfterFailure = false
|
||||
}
|
||||
|
||||
|
||||
override func tearDown()
|
||||
{
|
||||
// Terminate just in case the app hasn't already quit
|
||||
XCUIApplication().terminate()
|
||||
|
||||
|
||||
// Revert our update with the original test application
|
||||
|
||||
var resultingURL: NSURL? = nil
|
||||
|
||||
var resultingURL: NSURL?
|
||||
try! FileManager.default.replaceItem(at: self.testApplicationURL!, withItemAt: self.testApplicationBackupURL!, backupItemName: nil, options: .usingNewMetadataOnly, resultingItemURL: &resultingURL)
|
||||
|
||||
|
||||
do {
|
||||
try FileManager.default.removeItem(at: self.tempDirectoryURL!)
|
||||
} catch let error as NSError {
|
||||
NSLog("Failed to remove temporary directory \(self.tempDirectoryURL) with error: \(error)")
|
||||
}
|
||||
|
||||
|
||||
// The URL we get back from NSFileManager should be the same..
|
||||
XCTAssertEqual(self.testApplicationURL, resultingURL as URL?, "Test application was replaced, but at a different location")
|
||||
|
||||
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
func testRegularUpdate()
|
||||
{
|
||||
let app = XCUIApplication()
|
||||
let menuBarsQuery = app.menuBars
|
||||
|
||||
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
||||
|
||||
|
||||
// If the update window already showed up automatically, this option will be disabled.
|
||||
// Even if it's disabled, attempting to click it will do no harm and continue on
|
||||
menuBarsQuery.menuItems["Check for Updates…"].click()
|
||||
|
||||
|
||||
// Workaround to make sure we can click the install update button later
|
||||
// This workaround is needed if the alert prompts up automatically *before* we manually check for updates
|
||||
// I'm not sure why this workaround works or is necessary
|
||||
app.dialogs["SUUpdateAlert"].staticTexts["Software Update"].click()
|
||||
|
||||
|
||||
app.dialogs["SUUpdateAlert"].buttons["Install Update"].click()
|
||||
app.windows["SUStatus"].buttons["Install and Relaunch"].click()
|
||||
|
||||
|
||||
// Wait for the new updated app to finish launching so we can test if it's the frontmost app
|
||||
sleep(3)
|
||||
|
||||
|
||||
// Our new updated app should be launched now. Test if it's the active app
|
||||
// We used to run into timing issues where the updated app sometimes may not show up as the frontmost one
|
||||
XCTAssertTrue(self.runningTestApplication().isActive)
|
||||
|
||||
|
||||
// Grab another XCUIApplication instance rather than using the old one, just in case
|
||||
let updatedApp = XCUIApplication()
|
||||
|
||||
|
||||
// Check if we can click the "Update succeeded!" label rather than using the exists property
|
||||
// Checking the exists property doesn't reload the "cache" and as such the UI tests still would think we are
|
||||
// referring to the older app. Clicking does force the UI tests to find the new app however
|
||||
updatedApp.dialogs["alert"].staticTexts["Update succeeded!"].click()
|
||||
|
||||
|
||||
updatedApp.dialogs["alert"].buttons["OK"].click()
|
||||
}
|
||||
}
|
||||
+1
Submodule Vendor/ed25519 added at 7fa6712ef5.
+100
-47
@@ -6,106 +6,159 @@
|
||||
import Foundation
|
||||
|
||||
// Maximum number of delta updates (per OS).
|
||||
let maxDeltas = 5;
|
||||
let maxDeltas = 5
|
||||
|
||||
func makeError(code: SUError, _ description: String) -> NSError {
|
||||
return NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(code.rawValue)), userInfo: [
|
||||
NSLocalizedDescriptionKey: description,
|
||||
]);
|
||||
])
|
||||
}
|
||||
|
||||
func makeAppcast(archivesSourceDir: URL, privateKey: SecKey, verbose: Bool) throws -> [String:[ArchiveItem]] {
|
||||
let comparator = SUStandardVersionComparator();
|
||||
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)
|
||||
.orderedDescending == comparator.compareVersion($0.version, toVersion: $1.version)
|
||||
})
|
||||
|
||||
if allUpdates.count == 0 {
|
||||
throw makeError(code: .noUpdateError, "No usable archives found in \(archivesSourceDir.path)");
|
||||
throw makeError(code: .noUpdateError, "No usable archives found in \(archivesSourceDir.path)")
|
||||
}
|
||||
|
||||
var updatesByAppcast:[String:[ArchiveItem]] = [:];
|
||||
var updatesByAppcast: [String: [ArchiveItem]] = [:]
|
||||
|
||||
let group = DispatchGroup();
|
||||
let group = DispatchGroup()
|
||||
|
||||
for update in allUpdates {
|
||||
group.enter();
|
||||
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")
|
||||
}
|
||||
group.leave();
|
||||
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()
|
||||
}
|
||||
|
||||
let appcastFile = update.feedURL?.lastPathComponent ?? "appcast.xml";
|
||||
let appcastFile = update.feedURL?.lastPathComponent ?? "appcast.xml"
|
||||
if updatesByAppcast[appcastFile] == nil {
|
||||
updatesByAppcast[appcastFile] = [];
|
||||
updatesByAppcast[appcastFile] = []
|
||||
}
|
||||
updatesByAppcast[appcastFile]!.append(update);
|
||||
updatesByAppcast[appcastFile]!.append(update)
|
||||
}
|
||||
|
||||
for (_, updates) in updatesByAppcast {
|
||||
var latestUpdatePerOS:[String:ArchiveItem] = [:];
|
||||
var latestUpdatePerOS: [String: ArchiveItem] = [:]
|
||||
|
||||
for update in updates {
|
||||
// items are ordered starting latest first
|
||||
let os = update.minimumSystemVersion;
|
||||
let os = update.minimumSystemVersion
|
||||
if latestUpdatePerOS[os] == nil {
|
||||
latestUpdatePerOS[os] = update;
|
||||
latestUpdatePerOS[os] = update
|
||||
}
|
||||
}
|
||||
|
||||
for (_,latestItem) in latestUpdatePerOS {
|
||||
var numDeltas = 0;
|
||||
let appBaseName = latestItem.appPath.deletingPathExtension().lastPathComponent;
|
||||
for (_, latestItem) in latestUpdatePerOS {
|
||||
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;
|
||||
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");
|
||||
let deltaBaseName = appBaseName + latestItem.version + "-" + item.version
|
||||
let deltaPath = archivesSourceDir.appendingPathComponent(deltaBaseName).appendingPathExtension("delta")
|
||||
|
||||
var delta:DeltaUpdate;
|
||||
if !FileManager.default.fileExists(atPath: deltaPath.path) {
|
||||
var delta: DeltaUpdate
|
||||
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);
|
||||
delta = try DeltaUpdate.create(from: item, to: latestItem, archivePath: deltaPath)
|
||||
} catch {
|
||||
print("Could not create delta update", deltaPath.path, error);
|
||||
continue;
|
||||
print("Could not create delta update", deltaPath.path, error)
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
delta = DeltaUpdate(fromVersion: item.version, archivePath: deltaPath);
|
||||
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);
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group.wait();
|
||||
group.wait()
|
||||
|
||||
return updatesByAppcast;
|
||||
return updatesByAppcast
|
||||
}
|
||||
|
||||
func markDeltaAsIgnored(delta: DeltaUpdate, markerPath: URL) {
|
||||
_ = try? FileManager.default.removeItem(at: delta.archivePath)
|
||||
_ = try? Data.init().write(to: markerPath); // 0-sized file
|
||||
}
|
||||
@@ -6,101 +6,121 @@
|
||||
import Foundation
|
||||
|
||||
class DeltaUpdate {
|
||||
let fromVersion: String;
|
||||
let archivePath: URL;
|
||||
var dsaSignature: String?;
|
||||
let fromVersion: String
|
||||
let archivePath: URL
|
||||
var dsaSignature: String?
|
||||
var edSignature: String?
|
||||
|
||||
init(fromVersion: String, archivePath: URL) {
|
||||
self.archivePath = archivePath;
|
||||
self.fromVersion = fromVersion;
|
||||
self.archivePath = archivePath
|
||||
self.fromVersion = fromVersion
|
||||
}
|
||||
|
||||
var fileSize : Int64 {
|
||||
let archiveFileAttributes = try! FileManager.default.attributesOfItem(atPath: self.archivePath.path);
|
||||
return (archiveFileAttributes[.size] as! NSNumber).int64Value;
|
||||
var fileSize: Int64 {
|
||||
let archiveFileAttributes = try! FileManager.default.attributesOfItem(atPath: self.archivePath.path)
|
||||
return (archiveFileAttributes[.size] as! NSNumber).int64Value
|
||||
}
|
||||
|
||||
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
|
||||
var applyDiffError: NSError? = nil;
|
||||
var applyDiffError: NSError?
|
||||
|
||||
if (!createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError)) {
|
||||
throw applyDiffError!;
|
||||
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError) {
|
||||
throw applyDiffError!
|
||||
}
|
||||
|
||||
return DeltaUpdate(fromVersion: from.version, archivePath: archivePath);
|
||||
return DeltaUpdate(fromVersion: from.version, archivePath: archivePath)
|
||||
}
|
||||
}
|
||||
|
||||
class ArchiveItem: CustomStringConvertible {
|
||||
let version: String;
|
||||
let _shortVersion: String?;
|
||||
let minimumSystemVersion: String;
|
||||
let archivePath: URL;
|
||||
let appPath: URL;
|
||||
let feedURL: URL?;
|
||||
let archiveFileAttributes: [FileAttributeKey:Any];
|
||||
var deltas: [DeltaUpdate];
|
||||
let version: String
|
||||
// swiftlint:disable identifier_name
|
||||
let _shortVersion: String?
|
||||
let minimumSystemVersion: String
|
||||
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 dsaSignature: String?
|
||||
var edSignature: String?
|
||||
|
||||
init(version: String, shortVersion: String?, feedURL: URL?, minimumSystemVersion: String?, 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.archiveFileAttributes = try FileManager.default.attributesOfItem(atPath: self.archivePath.path);
|
||||
self.deltas = [];
|
||||
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)");
|
||||
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 shortVersion = infoPlist["CFBundleShortVersionString"] as? String
|
||||
let publicEdKey = infoPlist[SUPublicEDKeyKey] as? String
|
||||
let supportsDSA = infoPlist[SUPublicDSAKeyKey] != nil || infoPlist[SUPublicDSAKeyFileKey] != nil
|
||||
|
||||
var feedURL:URL? = nil;
|
||||
var feedURL: URL?
|
||||
if let feedURLStr = infoPlist["SUFeedURL"] as? String {
|
||||
feedURL = URL(string: feedURLStr);
|
||||
feedURL = URL(string: feedURLStr)
|
||||
}
|
||||
|
||||
try self.init(version: version,
|
||||
shortVersion: shortVersion,
|
||||
feedURL: feedURL,
|
||||
minimumSystemVersion: infoPlist["LSMinimumSystemVersion"] as? String,
|
||||
appPath: appPath,
|
||||
archivePath: archivePath);
|
||||
shortVersion: shortVersion,
|
||||
feedURL: feedURL,
|
||||
minimumSystemVersion: infoPlist["LSMinimumSystemVersion"] as? String,
|
||||
publicEdKey: publicEdKey,
|
||||
supportsDSA: supportsDSA,
|
||||
appPath: appPath,
|
||||
archivePath: archivePath)
|
||||
} else {
|
||||
throw makeError(code: .missingUpdateError, "No supported items in \(unarchivedDir) \(items) [note: only .app bundles are supported]");
|
||||
throw makeError(code: .missingUpdateError, "No supported items in \(unarchivedDir) \(items) [note: only .app bundles are supported]")
|
||||
}
|
||||
}
|
||||
|
||||
var shortVersion: String {
|
||||
return self._shortVersion ?? self.version;
|
||||
return self._shortVersion ?? self.version
|
||||
}
|
||||
|
||||
var description : String {
|
||||
var description: String {
|
||||
return "\(self.archivePath) \(self.version)"
|
||||
}
|
||||
|
||||
var archiveURL: URL? {
|
||||
guard let escapedFilename = self.archivePath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
if let relative = self.feedURL {
|
||||
return URL(string: escapedFilename, relativeTo: relative)
|
||||
@@ -108,27 +128,27 @@ class ArchiveItem: CustomStringConvertible {
|
||||
return URL(string: escapedFilename)
|
||||
}
|
||||
|
||||
var pubDate : String {
|
||||
let date = self.archiveFileAttributes[.creationDate] as! Date;
|
||||
let formatter = DateFormatter();
|
||||
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss ZZ";
|
||||
return formatter.string(from: date);
|
||||
var pubDate: String {
|
||||
let date = self.archiveFileAttributes[.creationDate] as! Date
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss ZZ"
|
||||
return formatter.string(from: date)
|
||||
}
|
||||
|
||||
var fileSize : Int64 {
|
||||
return (self.archiveFileAttributes[.size] as! NSNumber).int64Value;
|
||||
var fileSize: Int64 {
|
||||
return (self.archiveFileAttributes[.size] as! NSNumber).int64Value
|
||||
}
|
||||
|
||||
private var releaseNotesPath : URL? {
|
||||
var basename = self.archivePath.deletingPathExtension();
|
||||
|
||||
private var releaseNotesPath: URL? {
|
||||
var basename = self.archivePath.deletingPathExtension()
|
||||
if basename.pathExtension == "tar" { // tar.gz
|
||||
basename = basename.deletingPathExtension();
|
||||
basename = basename.deletingPathExtension()
|
||||
}
|
||||
let releaseNotes = basename.appendingPathExtension("html");
|
||||
let releaseNotes = basename.appendingPathExtension("html")
|
||||
if !FileManager.default.fileExists(atPath: releaseNotes.path) {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
return releaseNotes;
|
||||
return releaseNotes
|
||||
}
|
||||
|
||||
private func getReleaseNotesAsHTMLFragment(_ path: URL) -> String? {
|
||||
@@ -136,29 +156,29 @@ class ArchiveItem: CustomStringConvertible {
|
||||
if html.utf8.count < 1000 &&
|
||||
!html.localizedCaseInsensitiveContains("<!DOCTYPE") &&
|
||||
!html.localizedCaseInsensitiveContains("<body") {
|
||||
return html;
|
||||
return html
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
|
||||
var releaseNotesHTML : String? {
|
||||
var releaseNotesHTML: String? {
|
||||
if let path = self.releaseNotesPath {
|
||||
return self.getReleaseNotesAsHTMLFragment(path);
|
||||
return self.getReleaseNotesAsHTMLFragment(path)
|
||||
}
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
|
||||
var releaseNotesURL : URL? {
|
||||
var releaseNotesURL: URL? {
|
||||
guard let path = self.releaseNotesPath else {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
// The file is already used as inline description
|
||||
if self.getReleaseNotesAsHTMLFragment(path) != nil {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
guard let escapedFilename = path.lastPathComponent.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
if let relative = self.feedURL {
|
||||
return URL(string: escapedFilename, relativeTo: relative)
|
||||
@@ -166,5 +186,5 @@ class ArchiveItem: CustomStringConvertible {
|
||||
return URL(string: escapedFilename)
|
||||
}
|
||||
|
||||
let mimeType = "application/octet-stream";
|
||||
let mimeType = "application/octet-stream"
|
||||
}
|
||||
@@ -6,3 +6,4 @@
|
||||
#import "SUUnarchiver.h"
|
||||
#import "SUBinaryDeltaUnarchiver.h"
|
||||
#import "SUBinaryDeltaCreate.h"
|
||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||
@@ -1,84 +0,0 @@
|
||||
//
|
||||
// Created by Kornel on 23/12/2016.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func loadPrivateKey(at privateKeyURL: URL) throws -> SecKey {
|
||||
let data = try Data(contentsOf: privateKeyURL);
|
||||
|
||||
var cfitems: CFArray? = nil;
|
||||
var format = SecExternalFormat.formatOpenSSL;
|
||||
var type = SecExternalItemType.itemTypePrivateKey;
|
||||
|
||||
let status = SecItemImport(data as CFData, nil, &format, &type, SecItemImportExportFlags(rawValue: UInt32(0)), nil, nil, &cfitems);
|
||||
if (status != errSecSuccess || cfitems == nil) {
|
||||
print("Private DSA key file", privateKeyURL.path, "exists, but it could not be read. SecItemImport error", status);
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil);
|
||||
}
|
||||
|
||||
if (format != SecExternalFormat.formatOpenSSL || type != SecExternalItemType.itemTypePrivateKey) {
|
||||
throw makeError(code: .signatureError, "Not an OpensSSL private key \(format) \(type)");
|
||||
}
|
||||
|
||||
return (cfitems! as NSArray)[0] as! SecKey;
|
||||
}
|
||||
|
||||
func loadPrivateKey(named keyName: String, fromKeychainAt keychainURL: URL) throws -> SecKey {
|
||||
var keychain: SecKeychain? = nil
|
||||
|
||||
guard SecKeychainOpen(keychainURL.path, &keychain) == errSecSuccess, keychain != nil else {
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil)
|
||||
}
|
||||
|
||||
let query: [CFString: CFTypeRef] = [
|
||||
kSecClass: kSecClassKey,
|
||||
kSecAttrKeyClass: kSecAttrKeyClassPrivate,
|
||||
kSecAttrLabel: keyName as CFString,
|
||||
kSecMatchLimit: kSecMatchLimitOne,
|
||||
kSecUseKeychain: keychain!,
|
||||
kSecReturnRef: kCFBooleanTrue
|
||||
]
|
||||
|
||||
var item: CFTypeRef? = nil
|
||||
guard SecItemCopyMatching(query as CFDictionary, &item) == errSecSuccess, item != nil else {
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil)
|
||||
}
|
||||
|
||||
return item! as! SecKey
|
||||
}
|
||||
|
||||
func dsaSignature(path: URL, privateKey: SecKey) throws -> String {
|
||||
|
||||
var error: Unmanaged<CFError>?;
|
||||
|
||||
let stream = InputStream(fileAtPath:path.path)!;
|
||||
let dataReadTransform = SecTransformCreateReadTransformWithReadStream(stream);
|
||||
|
||||
let dataDigestTransform = SecDigestTransformCreate(kSecDigestSHA1, 20, nil);
|
||||
guard let dataSignTransform = SecSignTransformCreate(privateKey, &error) else {
|
||||
print("can't use the key");
|
||||
throw error!.takeRetainedValue();
|
||||
}
|
||||
|
||||
let group = SecTransformCreateGroupTransform();
|
||||
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
|
||||
if (error != nil) {
|
||||
throw error!.takeRetainedValue();
|
||||
}
|
||||
|
||||
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataSignTransform, kSecTransformInputAttributeName, group, &error);
|
||||
if (error != nil) {
|
||||
throw error!.takeRetainedValue();
|
||||
}
|
||||
|
||||
let result = SecTransformExecute(group, &error);
|
||||
if (error != nil) {
|
||||
throw error!.takeRetainedValue();
|
||||
}
|
||||
guard let resultData = result as? Data else {
|
||||
throw makeError(code: .signatureError, "SecTransformExecute returned non-data");
|
||||
}
|
||||
return resultData.base64EncodedString();
|
||||
}
|
||||
@@ -5,186 +5,172 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
let maxVersionsInFeed = 5;
|
||||
let maxVersionsInFeed = 5
|
||||
|
||||
func findElement(name: String, parent: XMLElement) -> XMLElement? {
|
||||
if let found = try? parent.nodes(forXPath: name) {
|
||||
if found.count > 0 {
|
||||
if let element = found[0] as? XMLElement {
|
||||
return element;
|
||||
return element
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
|
||||
func findOrCreateElement(name: String, parent: XMLElement) -> XMLElement {
|
||||
if let element = findElement(name: name, parent: parent) {
|
||||
return element;
|
||||
return element
|
||||
}
|
||||
let element = XMLElement(name: name);
|
||||
linebreak(parent);
|
||||
parent.addChild(element);
|
||||
return element;
|
||||
let element = XMLElement(name: name)
|
||||
parent.addChild(element)
|
||||
return element
|
||||
}
|
||||
|
||||
func text(_ text: String) -> XMLNode {
|
||||
return XMLNode.text(withStringValue: text) as! XMLNode
|
||||
}
|
||||
|
||||
func linebreak(_ element: XMLElement) {
|
||||
element.addChild(text("\n"));
|
||||
}
|
||||
|
||||
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent;
|
||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
||||
|
||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle";
|
||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
|
||||
var doc: XMLDocument;
|
||||
var doc: XMLDocument
|
||||
do {
|
||||
let options: XMLNode.Options = [
|
||||
XMLNode.Options.nodeLoadExternalEntitiesNever,
|
||||
XMLNode.Options.nodePreserveCDATA,
|
||||
XMLNode.Options.nodePreserveWhitespace,
|
||||
];
|
||||
doc = try XMLDocument(contentsOf: appcastDestPath, options: options);
|
||||
]
|
||||
doc = try XMLDocument(contentsOf: appcastDestPath, options: options)
|
||||
} catch {
|
||||
let root = XMLElement(name: "rss");
|
||||
root.addAttribute(XMLNode.attribute(withName: "xmlns:sparkle", stringValue: sparkleNS) as! XMLNode);
|
||||
root.addAttribute(XMLNode.attribute(withName: "version", stringValue: "2.0") as! XMLNode);
|
||||
doc = XMLDocument(rootElement: root);
|
||||
doc.isStandalone = true;
|
||||
let root = XMLElement(name: "rss")
|
||||
root.addAttribute(XMLNode.attribute(withName: "xmlns:sparkle", stringValue: sparkleNS) as! XMLNode)
|
||||
root.addAttribute(XMLNode.attribute(withName: "version", stringValue: "2.0") as! XMLNode)
|
||||
doc = XMLDocument(rootElement: root)
|
||||
doc.isStandalone = true
|
||||
}
|
||||
|
||||
var channel: XMLElement;
|
||||
var channel: XMLElement
|
||||
|
||||
let rootNodes = try doc.nodes(forXPath: "/rss");
|
||||
let rootNodes = try doc.nodes(forXPath: "/rss")
|
||||
if rootNodes.count != 1 {
|
||||
throw makeError(code: .appcastError, "Weird XML? \(appcastDestPath.path)");
|
||||
throw makeError(code: .appcastError, "Weird XML? \(appcastDestPath.path)")
|
||||
}
|
||||
let root = rootNodes[0] as! XMLElement
|
||||
let channelNodes = try root.nodes(forXPath: "channel");
|
||||
let channelNodes = try root.nodes(forXPath: "channel")
|
||||
if channelNodes.count > 0 {
|
||||
channel = channelNodes[0] as! XMLElement;
|
||||
channel = channelNodes[0] as! XMLElement
|
||||
} else {
|
||||
channel = XMLElement(name: "channel");
|
||||
linebreak(channel);
|
||||
channel.addChild(XMLElement.element(withName: "title", stringValue: appBaseName) as! XMLElement);
|
||||
linebreak(root);
|
||||
root.addChild(channel);
|
||||
channel = XMLElement(name: "channel")
|
||||
channel.addChild(XMLElement.element(withName: "title", stringValue: appBaseName) as! XMLElement)
|
||||
root.addChild(channel)
|
||||
}
|
||||
|
||||
var numItems = 0;
|
||||
var numItems = 0
|
||||
for update in updates {
|
||||
var item: XMLElement;
|
||||
let existingItems = try channel.nodes(forXPath: "item[enclosure[@sparkle:version=\"\(update.version)\"]]");
|
||||
let createNewItem = existingItems.count == 0;
|
||||
var item: XMLElement
|
||||
let existingItems = try channel.nodes(forXPath: "item[enclosure[@sparkle:version=\"\(update.version)\"]]")
|
||||
let createNewItem = existingItems.count == 0
|
||||
|
||||
// Update all old items, but aim for less than 5 in new feeds
|
||||
if createNewItem && numItems >= maxVersionsInFeed {
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
numItems += 1;
|
||||
numItems += 1
|
||||
|
||||
if createNewItem {
|
||||
item = XMLElement.element(withName: "item") as! XMLElement;
|
||||
linebreak(channel);
|
||||
channel.addChild(item);
|
||||
item = XMLElement.element(withName: "item") as! XMLElement
|
||||
channel.addChild(item)
|
||||
} else {
|
||||
item = existingItems[0] as! XMLElement;
|
||||
item = existingItems[0] as! XMLElement
|
||||
}
|
||||
|
||||
if nil == findElement(name: "title", parent: item) {
|
||||
linebreak(item);
|
||||
item.addChild(XMLElement.element(withName: "title", stringValue: update.shortVersion) as! XMLElement);
|
||||
item.addChild(XMLElement.element(withName: "title", stringValue: update.shortVersion) as! XMLElement)
|
||||
}
|
||||
if nil == findElement(name: "pubDate", parent: item) {
|
||||
linebreak(item);
|
||||
item.addChild(XMLElement.element(withName: "pubDate", stringValue: update.pubDate) as! XMLElement);
|
||||
item.addChild(XMLElement.element(withName: "pubDate", stringValue: update.pubDate) as! XMLElement)
|
||||
}
|
||||
|
||||
if let html = update.releaseNotesHTML {
|
||||
let descElement = findOrCreateElement(name: "description", parent: item);
|
||||
let cdata = XMLNode(kind:.text, options:.nodeIsCDATA);
|
||||
cdata.stringValue = html;
|
||||
descElement.setChildren([cdata]);
|
||||
let descElement = findOrCreateElement(name: "description", parent: item)
|
||||
let cdata = XMLNode(kind: .text, options: .nodeIsCDATA)
|
||||
cdata.stringValue = html
|
||||
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;
|
||||
linebreak(item);
|
||||
item.addChild(minVer!);
|
||||
minVer = XMLElement.element(withName: SUAppcastElementMinimumSystemVersion, uri: sparkleNS) as? XMLElement
|
||||
item.addChild(minVer!)
|
||||
}
|
||||
minVer?.setChildren([text(update.minimumSystemVersion)]);
|
||||
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);
|
||||
item.removeChild(at: childIndex)
|
||||
}
|
||||
|
||||
var enclosure = findElement(name: "enclosure", parent: item);
|
||||
|
||||
var enclosure = findElement(name: "enclosure", parent: item)
|
||||
if nil == enclosure {
|
||||
enclosure = XMLElement.element(withName: "enclosure") as? XMLElement;
|
||||
linebreak(item);
|
||||
item.addChild(enclosure!);
|
||||
enclosure = XMLElement.element(withName: "enclosure") as? XMLElement
|
||||
item.addChild(enclosure!)
|
||||
}
|
||||
|
||||
guard let archiveURL = update.archiveURL?.absoluteString else {
|
||||
throw makeError(code: .appcastError, "Bad archive name or feed URL");
|
||||
};
|
||||
throw makeError(code: .appcastError, "Bad archive name or feed URL")
|
||||
}
|
||||
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.dsaSignature {
|
||||
attributes.append(XMLNode.attribute(withName: "sparkle:dsaSignature", uri: sparkleNS, stringValue: sig) as! XMLNode);
|
||||
]
|
||||
if let sig = update.edSignature {
|
||||
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
|
||||
}
|
||||
enclosure!.attributes = attributes;
|
||||
if let sig = update.dsaSignature {
|
||||
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;
|
||||
linebreak(item);
|
||||
item.addChild(deltas!);
|
||||
deltas = XMLElement.element(withName: SUAppcastElementDeltas, uri: sparkleNS) as? XMLElement
|
||||
item.addChild(deltas!)
|
||||
} else {
|
||||
deltas!.setChildren([]);
|
||||
deltas!.setChildren([])
|
||||
}
|
||||
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.dsaSignature {
|
||||
attributes.append(XMLNode.attribute(withName: "sparkle:dsaSignature", uri: sparkleNS, stringValue: sig) as! XMLNode);
|
||||
]
|
||||
if let sig = delta.edSignature {
|
||||
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
|
||||
}
|
||||
linebreak(deltas!);
|
||||
deltas!.addChild(XMLNode.element(withName: "enclosure", children: nil, attributes: attributes) as! XMLElement);
|
||||
if let sig = delta.dsaSignature {
|
||||
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeDSASignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
|
||||
}
|
||||
deltas!.addChild(XMLNode.element(withName: "enclosure", children: nil, attributes: attributes) as! XMLElement)
|
||||
}
|
||||
}
|
||||
if createNewItem {
|
||||
linebreak(item);
|
||||
linebreak(channel);
|
||||
}
|
||||
}
|
||||
|
||||
let options = XMLNode.Options.nodeCompactEmptyElement;
|
||||
let docData = doc.xmlData(options:options);
|
||||
let _ = try XMLDocument(data: docData, options:XMLNode.Options()); // Verify that it was generated correctly, which does not always happen!
|
||||
try docData.write(to: appcastDestPath);
|
||||
let options: XMLNode.Options = [.nodeCompactEmptyElement, .nodePrettyPrint]
|
||||
let docData = doc.xmlData(options: options)
|
||||
_ = try XMLDocument(data: docData, options: XMLNode.Options()); // Verify that it was generated correctly, which does not always happen!
|
||||
try docData.write(to: appcastDestPath)
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Created by Kornel on 23/12/2016.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
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?
|
||||
var format = SecExternalFormat.formatOpenSSL
|
||||
var type = SecExternalItemType.itemTypePrivateKey
|
||||
|
||||
let status = SecItemImport(data as CFData, nil, &format, &type, SecItemImportExportFlags(rawValue: UInt32(0)), nil, nil, &cfitems)
|
||||
if status != errSecSuccess || cfitems == nil {
|
||||
print("Private DSA key file", privateKeyURL.path, "exists, but it could not be read. SecItemImport error", status)
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil)
|
||||
}
|
||||
|
||||
if format != SecExternalFormat.formatOpenSSL || type != SecExternalItemType.itemTypePrivateKey {
|
||||
throw makeError(code: .signatureError, "Not an OpensSSL private key \(format) \(type)")
|
||||
}
|
||||
|
||||
return (cfitems! as NSArray)[0] as! SecKey
|
||||
}
|
||||
|
||||
func loadPrivateDSAKey(named keyName: String, fromKeychainAt keychainURL: URL) throws -> SecKey {
|
||||
var keychain: SecKeychain?
|
||||
|
||||
guard SecKeychainOpen(keychainURL.path, &keychain) == errSecSuccess, keychain != nil else {
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil)
|
||||
}
|
||||
|
||||
let query: [CFString: CFTypeRef] = [
|
||||
kSecClass: kSecClassKey,
|
||||
kSecAttrKeyClass: kSecAttrKeyClassPrivate,
|
||||
kSecAttrLabel: keyName as CFString,
|
||||
kSecMatchLimit: kSecMatchLimitOne,
|
||||
kSecUseKeychain: keychain!,
|
||||
kSecReturnRef: kCFBooleanTrue,
|
||||
]
|
||||
|
||||
var item: CFTypeRef?
|
||||
guard SecItemCopyMatching(query as CFDictionary, &item) == errSecSuccess, item != nil else {
|
||||
throw NSError(domain: SUSparkleErrorDomain, code: Int(OSStatus(SUError.signatureError.rawValue)), userInfo: nil)
|
||||
}
|
||||
|
||||
return item! as! SecKey
|
||||
}
|
||||
|
||||
func dsaSignature(path: URL, privateDSAKey: SecKey) throws -> String {
|
||||
|
||||
var error: Unmanaged<CFError>?
|
||||
|
||||
let stream = InputStream(fileAtPath: path.path)!
|
||||
let dataReadTransform = SecTransformCreateReadTransformWithReadStream(stream)
|
||||
|
||||
let dataDigestTransform = SecDigestTransformCreate(kSecDigestSHA1, 20, nil)
|
||||
guard let dataSignTransform = SecSignTransformCreate(privateDSAKey, &error) else {
|
||||
print("can't use the key")
|
||||
throw error!.takeRetainedValue()
|
||||
}
|
||||
|
||||
let group = SecTransformCreateGroupTransform()
|
||||
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error)
|
||||
if error != nil {
|
||||
throw error!.takeRetainedValue()
|
||||
}
|
||||
|
||||
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataSignTransform, kSecTransformInputAttributeName, group, &error)
|
||||
if error != nil {
|
||||
throw error!.takeRetainedValue()
|
||||
}
|
||||
|
||||
let result = SecTransformExecute(group, &error)
|
||||
if error != nil {
|
||||
throw error!.takeRetainedValue()
|
||||
}
|
||||
guard let resultData = result as? Data else {
|
||||
throw makeError(code: .signatureError, "SecTransformExecute returned non-data")
|
||||
}
|
||||
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()
|
||||
}
|
||||
@@ -5,102 +5,105 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
func unarchive(itemPath:URL, archiveDestDir: URL, callback: @escaping (Error?) -> Void) {
|
||||
let fileManager = FileManager.default;
|
||||
let tempDir = archiveDestDir.appendingPathExtension("tmp");
|
||||
let itemCopy = tempDir.appendingPathComponent(itemPath.lastPathComponent);
|
||||
func unarchive(itemPath: URL, archiveDestDir: URL, callback: @escaping (Error?) -> Void) {
|
||||
let fileManager = FileManager.default
|
||||
let tempDir = archiveDestDir.appendingPathExtension("tmp")
|
||||
let itemCopy = tempDir.appendingPathComponent(itemPath.lastPathComponent)
|
||||
|
||||
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:]);
|
||||
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:])
|
||||
|
||||
do {
|
||||
try fileManager.linkItem(at: itemPath, to: itemCopy);
|
||||
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemCopy.path, updatingHostBundlePath:nil, decryptionPassword:nil) {
|
||||
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 {
|
||||
callback(error);
|
||||
return;
|
||||
callback(error)
|
||||
return
|
||||
}
|
||||
|
||||
_ = try? fileManager.removeItem(at: itemCopy);
|
||||
_ = try? fileManager.removeItem(at: itemCopy)
|
||||
do {
|
||||
try fileManager.moveItem(at: tempDir, to: archiveDestDir);
|
||||
callback(nil);
|
||||
try fileManager.moveItem(at: tempDir, to: archiveDestDir)
|
||||
callback(nil)
|
||||
} catch {
|
||||
callback(error);
|
||||
callback(error)
|
||||
}
|
||||
}, progressBlock: nil)
|
||||
} else {
|
||||
_ = try? fileManager.removeItem(at: itemCopy);
|
||||
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"));
|
||||
_ = try? fileManager.removeItem(at: itemCopy)
|
||||
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"))
|
||||
}
|
||||
} catch {
|
||||
_ = try? fileManager.removeItem(at: tempDir);
|
||||
callback(error);
|
||||
_ = try? fileManager.removeItem(at: tempDir)
|
||||
callback(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);
|
||||
print("Unarchiving to temp directory", archivesDestDir.path)
|
||||
}
|
||||
|
||||
let group = DispatchGroup();
|
||||
let group = DispatchGroup()
|
||||
|
||||
let fileManager = FileManager.default;
|
||||
let fileManager = FileManager.default
|
||||
|
||||
var unarchived:[ArchiveItem] = [];
|
||||
var unarchived: [ArchiveItem] = []
|
||||
|
||||
let dir = try fileManager.contentsOfDirectory(atPath: archivesSourceDir.path);
|
||||
var running = 0;
|
||||
let dir = try fileManager.contentsOfDirectory(atPath: archivesSourceDir.path)
|
||||
var running = 0
|
||||
for item in dir.filter({ !$0.hasPrefix(".") && !$0.hasSuffix(".delta") && !$0.hasSuffix(".xml") && !$0.hasSuffix(".html") }) {
|
||||
let itemPath = archivesSourceDir.appendingPathComponent(item);
|
||||
let archiveDestDir = archivesDestDir.appendingPathComponent(itemPath.lastPathComponent);
|
||||
let itemPath = archivesSourceDir.appendingPathComponent(item)
|
||||
let archiveDestDir = archivesDestDir.appendingPathComponent(itemPath.lastPathComponent)
|
||||
|
||||
var isDir:ObjCBool = false;
|
||||
if (fileManager.fileExists(atPath: itemPath.path, isDirectory: &isDir) && isDir.boolValue) {
|
||||
continue;
|
||||
var isDir: ObjCBool = false
|
||||
if fileManager.fileExists(atPath: itemPath.path, isDirectory: &isDir) && isDir.boolValue {
|
||||
continue
|
||||
}
|
||||
|
||||
let addItem = {
|
||||
do {
|
||||
let item = try ArchiveItem(fromArchive: itemPath, unarchivedDir: archiveDestDir);
|
||||
let item = try ArchiveItem(fromArchive: itemPath, unarchivedDir: archiveDestDir)
|
||||
if verbose {
|
||||
print("Found archive", item);
|
||||
print("Found archive", item)
|
||||
}
|
||||
objc_sync_enter(unarchived);
|
||||
unarchived.append(item);
|
||||
objc_sync_exit(unarchived);
|
||||
objc_sync_enter(unarchived)
|
||||
unarchived.append(item)
|
||||
objc_sync_exit(unarchived)
|
||||
} catch {
|
||||
if verbose {
|
||||
print("Skipped", item, error);
|
||||
print("Skipped", item, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if fileManager.fileExists(atPath: archiveDestDir.path) {
|
||||
addItem();
|
||||
addItem()
|
||||
} else {
|
||||
group.enter();
|
||||
group.enter()
|
||||
unarchive(itemPath: itemPath, archiveDestDir: archiveDestDir) { (error: Error?) in
|
||||
if let error = error {
|
||||
print("Could not unarchive", itemPath.path, error);
|
||||
print("Could not unarchive", itemPath.path, error)
|
||||
} else {
|
||||
addItem();
|
||||
addItem()
|
||||
}
|
||||
group.leave();
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
|
||||
// Crude limit of concurrency
|
||||
running += 1;
|
||||
running += 1
|
||||
if running >= 8 {
|
||||
running = 0;
|
||||
group.wait();
|
||||
running = 0
|
||||
group.wait()
|
||||
}
|
||||
}
|
||||
|
||||
group.wait();
|
||||
group.wait()
|
||||
|
||||
return unarchived;
|
||||
return unarchived
|
||||
}
|
||||
+58
-37
@@ -8,98 +8,119 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
var verbose = false;
|
||||
var verbose = false
|
||||
|
||||
func printUsage() {
|
||||
let command = URL(fileURLWithPath: CommandLine.arguments.first!).lastPathComponent;
|
||||
print("Generate appcast from a directory of Sparkle updates\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",
|
||||
let command = URL(fileURLWithPath: CommandLine.arguments.first!).lastPathComponent
|
||||
print("Generate appcast from a directory of Sparkle update archives\n",
|
||||
"Usage:\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 {
|
||||
let args = CommandLine.arguments
|
||||
if args.count < 2 {
|
||||
printUsage()
|
||||
exit(1)
|
||||
}
|
||||
|
||||
let privateKey: SecKey
|
||||
|
||||
|
||||
var privateDSAKey: SecKey?
|
||||
|
||||
// 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
|
||||
let keychainURL: URL
|
||||
|
||||
|
||||
if args[1] == "-n" {
|
||||
if args[3] != "-k" {
|
||||
printUsage()
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
||||
keyName = args[2]
|
||||
keychainURL = URL(fileURLWithPath: args[4])
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if args[3] != "-n" {
|
||||
printUsage()
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
||||
keyName = args[4]
|
||||
keychainURL = URL(fileURLWithPath: args[2])
|
||||
}
|
||||
|
||||
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);
|
||||
try writeAppcast(appcastDestPath:appcastDestPath, updates:updates);
|
||||
print("Written", appcastDestPath.path, "based on", updates.count, "updates");
|
||||
let appcastDestPath = URL(fileURLWithPath: appcastFile, relativeTo: archivesSourceDir)
|
||||
try writeAppcast(appcastDestPath: appcastDestPath, updates: updates)
|
||||
print("Written", appcastDestPath.path, "based on", updates.count, "updates")
|
||||
}
|
||||
} catch {
|
||||
print("Error generating appcast from directory", archivesSourceDir.path, "\n", error);
|
||||
exit(1);
|
||||
print("Error generating appcast from directory", archivesSourceDir.path, "\n", error)
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.global().async(execute: {
|
||||
main();
|
||||
CFRunLoopStop(CFRunLoopGetMain());
|
||||
});
|
||||
main()
|
||||
CFRunLoopStop(CFRunLoopGetMain())
|
||||
})
|
||||
|
||||
CFRunLoopRun();
|
||||
CFRunLoopRun()
|
||||
@@ -0,0 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SUConstants.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SUSignatures.h"
|
||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// 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")
|
||||
@@ -0,0 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SUConstants.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SUSignatures.h"
|
||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
Reference in new issue
Block a user