mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Decryption password should now be supported
This commit is contained in:
1 parent
8184838835
commit
eddf611ede
7 files changed
+28
-9
No files matched your search
Vendored
+1
-2
@@ -232,8 +232,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5;
|
||||
|
||||
- (void)extractAndInstallUpdate
|
||||
{
|
||||
#warning passing nothing for password atm
|
||||
id <SUUnarchiver> unarchiver = [SUUnarchiver unarchiverForPath:self.installationData.downloadPath updatingHostBundlePath:self.host.bundlePath decryptionPassword:nil delegate:self];
|
||||
id <SUUnarchiver> unarchiver = [SUUnarchiver unarchiverForPath:self.installationData.downloadPath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.installationData.decryptionPassword delegate:self];
|
||||
if (!unarchiver) {
|
||||
SULog(@"Error: No valid unarchiver for %@!", self.installationData.downloadPath);
|
||||
[self unarchiverDidFail];
|
||||
|
||||
+2
-1
@@ -12,13 +12,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUInstallationInputData : NSObject <NSSecureCoding>
|
||||
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature;
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature 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 *downloadPath;
|
||||
@property (nonatomic, copy, readonly) NSString *dsaSignature;
|
||||
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+10
-2
@@ -13,6 +13,7 @@ static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
|
||||
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
|
||||
static NSString *SUDownloadPathKey = @"SUDownloadPath";
|
||||
static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
|
||||
|
||||
@implementation SUInstallationInputData
|
||||
|
||||
@@ -21,8 +22,9 @@ static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
@synthesize updateDirectoryPath = _updateDirectoryPath;
|
||||
@synthesize downloadPath = _downloadPath;
|
||||
@synthesize dsaSignature = _dsaSignature;
|
||||
@synthesize decryptionPassword = _decryptionPassword;
|
||||
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature
|
||||
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadPath:(NSString *)downloadPath dsaSignature:(NSString *)dsaSignature decryptionPassword:(nullable NSString *)decryptionPassword
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -31,6 +33,7 @@ static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
_updateDirectoryPath = [updateDirectoryPath copy];
|
||||
_downloadPath = [downloadPath copy];
|
||||
_dsaSignature = [dsaSignature copy];
|
||||
_decryptionPassword = [decryptionPassword copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -62,7 +65,9 @@ static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadPath:downloadPath dsaSignature:dsaSignature];
|
||||
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
|
||||
|
||||
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadPath:downloadPath dsaSignature:dsaSignature decryptionPassword:decryptionPassword];
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
@@ -72,6 +77,9 @@ static NSString *SUDSASignatureKey = @"SUDSASignature";
|
||||
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
|
||||
[coder encodeObject:self.downloadPath forKey:SUDownloadPathKey];
|
||||
[coder encodeObject:self.dsaSignature forKey:SUDSASignatureKey];
|
||||
if (self.decryptionPassword != nil) {
|
||||
[coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
|
||||
Vendored
+6
-1
@@ -217,7 +217,12 @@
|
||||
|
||||
NSString *dsaSignature = (self.updateItem.DSASignature == nil) ? @"" : self.updateItem.DSASignature;
|
||||
|
||||
SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadPath:self.downloadPath dsaSignature:dsaSignature];
|
||||
NSString *decryptionPassword = nil;
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(decryptionPasswordForUpdater:)]) {
|
||||
decryptionPassword = [self.updaterDelegate decryptionPasswordForUpdater:self.updater];
|
||||
}
|
||||
|
||||
SUInstallationInputData *installationData = [[SUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:self.host.bundlePath updateDirectoryPath:self.temporaryDirectory downloadPath:self.downloadPath dsaSignature:dsaSignature decryptionPassword:decryptionPassword];
|
||||
|
||||
NSData *archivedData = SUArchiveRootObjectSecurely(installationData);
|
||||
|
||||
|
||||
Vendored
-2
@@ -70,8 +70,6 @@ SU_EXPORT @interface SUUpdater : NSObject
|
||||
|
||||
@property BOOL automaticallyDownloadsUpdates;
|
||||
|
||||
@property (nonatomic, copy) NSString *decryptionPassword;
|
||||
|
||||
/*!
|
||||
Checks for updates, and displays progress while doing so
|
||||
|
||||
|
||||
Vendored
-1
@@ -53,7 +53,6 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize driver;
|
||||
@synthesize host;
|
||||
@synthesize sparkleBundle;
|
||||
@synthesize decryptionPassword;
|
||||
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver delegate:(id <SUUpdaterDelegate>)theDelegate
|
||||
{
|
||||
|
||||
Vendored
+9
@@ -206,6 +206,15 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
*/
|
||||
- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Returns the decryption password (if any) which is used to extract the update archive DMG.
|
||||
|
||||
Return nil if no password should be used.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
*/
|
||||
- (NSString *)decryptionPasswordForUpdater:(SUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Called before an updater shows a modal alert window,
|
||||
to give the host the opportunity to hide attached windows that may get in the way.
|
||||
|
||||
Reference in new issue
Block a user