mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
If the downloaded update fails the code signing check, log out some more detailed information to help with diagnosing the problem.
This commit is contained in:
1 parent
f832c27bf9
commit
779599b40d
1 file changed
+30
-1
+30
-1
@@ -57,7 +57,19 @@ extern OSStatus SecStaticCodeCheckValidityWithErrors(SecStaticCodeRef staticCode
|
||||
}
|
||||
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSDefaultFlags | kSecCSCheckAllArchitectures, requirement, (CFErrorRef *)error);
|
||||
if (result != 0 && error) [*error autorelease];
|
||||
if (result != 0 && error) {
|
||||
if (result == errSecCSReqFailed) {
|
||||
CFStringRef requirementString = nil;
|
||||
if (SecRequirementCopyString(requirement, kSecCSDefaultFlags, &requirementString) == noErr)
|
||||
SULog(@"Failed requirement %@", requirementString);
|
||||
CFRelease(requirementString);
|
||||
|
||||
[self logSigningInfoForCode:hostCode label:@"host info"];
|
||||
[self logSigningInfoForCode:staticCode label:@"new info"];
|
||||
}
|
||||
|
||||
[*error autorelease];
|
||||
}
|
||||
|
||||
finally:
|
||||
if (hostCode) CFRelease(hostCode);
|
||||
@@ -66,6 +78,23 @@ finally:
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
+ (void)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
|
||||
CFDictionaryRef signingInfo = nil;
|
||||
const SecCSFlags flags = kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation;
|
||||
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
|
||||
NSDictionary* signingDict = (NSDictionary*)signingInfo;
|
||||
NSArray* keys = @[@"format", @"identifier", @"requirements", @"teamid", @"signing-time"];
|
||||
NSMutableDictionary* relevantInfo = [NSMutableDictionary new];
|
||||
for (NSString* key in keys)
|
||||
relevantInfo[key] = signingDict[key];
|
||||
NSDictionary* infoPlist = signingDict[@"info-plist"];
|
||||
relevantInfo[@"version"] = infoPlist[@"CFBundleShortVersionString"];
|
||||
relevantInfo[@"build"] = infoPlist[@"CFBundleVersion"];
|
||||
CFRelease(signingInfo);
|
||||
SULog(@"%@: %@", label, relevantInfo);
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)hostApplicationIsCodeSigned
|
||||
{
|
||||
// This API didn't exist prior to 10.6.
|
||||
|
||||
Reference in new issue
Block a user