CFBundleCopyInfoDictionaryForURL
コード署名されたヘルパー ツールを呼び出している可能性がありますか?
もしそうなら、この関数はコード署名の有効性を壊しているように見えます。(おそらくCFBundle
、メモリ内の Info.plist データを変更するためですが、これは私の推測です。)
SecCodeCopySigningInformation
解決策は、ヘルパー ツールのバージョン情報を読み取るために使用することです。
-(NSString *) bundleVersionForCodeSignedItemAtURL:(NSURL *)url {
OSStatus status;
// Sanity check -- nothing begets nothing
if (!url) {
return nil;
}
// Get the binary's static code
SecStaticCodeRef codeRef;
status = SecStaticCodeCreateWithPath((CFURLRef)url, kSecCSDefaultFlags, &codeRef);
if (status != noErr) {
NSLog(@"SecStatucCodeCreateWithPath() error for %@: %d", url, status);
return nil;
}
// Get the code signature info
CFDictionaryRef codeInfo;
status = SecCodeCopySigningInformation(codeRef, kSecCSDefaultFlags, &codeInfo);
if (status != noErr) {
NSLog(@"SecCodeCopySigningInformation() error for %@: %d", url, status);
CFRelease(codeRef);
return nil;
}
// The code signature info gives us the Info.plist that was signed, and
// from there we can retrieve the version
NSDictionary *bundleInfo = (NSDictionary *) CFDictionaryGetValue(codeInfo, kSecCodeInfoPList);
NSString *version = [bundleInfo objectForKey:@"CFBundleVersion"];
// We have ownership of the code signature info, so we must release it.
// Before we do that, we need to hold onto the version otherwise we go
// crashing and burning.
[[version retain] autorelease];
CFRelease(codeInfo);
CFRelease(codeRef);
return version;
}
当然のことながら、重要な情報はCFBundleCopyInfoDictionaryForURL
Ian MacLeod のSMJobKit
.