From 5659a84c57f8ee24ae43342b171df6269ee571ff Mon Sep 17 00:00:00 2001 From: Luke Noble Date: Sun, 4 Sep 2022 19:48:20 +0100 Subject: [PATCH] Info.plist fast path for apps already CT-signed Apps declaring TSBundlePreSigned = YES in their Info.plist will not be signed by TrollStore --- Helper/main.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Helper/main.m b/Helper/main.m index 24d70f5..c1e2105 100644 --- a/Helper/main.m +++ b/Helper/main.m @@ -346,6 +346,19 @@ BOOL signApp(NSString* appPath, NSError** error) NSString* executablePath = [appPath stringByAppendingPathComponent:executable]; if(![[NSFileManager defaultManager] fileExistsAtPath:executablePath]) return NO; + + NSObject *tsBundleIsPreSigned = appInfoDict[@"TSBundlePreSigned"]; + if([tsBundleIsPreSigned isKindOfClass:[NSNumber class]]) + { + + // if TSBundlePreSigned = YES, this bundle has been externally signed so we can skip over signing it now + NSNumber *tsBundleIsPreSignedNum = (NSNumber *)tsBundleIsPreSigned; + if([tsBundleIsPreSignedNum boolValue] == YES) + { + NSLog(@"[signApp] taking fast path for app which declares it has already been CT-signed (%@)", executablePath); + return YES; + } + } NSString* certPath = [trollStoreAppPath() stringByAppendingPathComponent:@"cert.p12"]; NSString* certArg = [@"-K" stringByAppendingPathComponent:certPath];