고맙습니다.
새 기능을 사용하여 10.6에서 관리했지만 문제는 적어도 일정 시간이 지나기 전까지는 10.5와 10.6을 목표로하고 있습니다.
곧 libsecurity_codesigning에 더 많은 시간을 할애하여 10.5도 완료 할 수 있습니다.
하지만, 주변의 준비 솔루션을 찾고있는 사람들을 위해, 여기에 내가 함께 결국 무엇을 : 위의 대답에
SecStaticCodeRef ref = NULL;
NSURL * url = [NSURL URLWithString:[[NSBundle mainBundle] executablePath]];
OSStatus status;
// obtain the cert info from the executable
status = SecStaticCodeCreateWithPath((CFURLRef)url, kSecCSDefaultFlags, &ref);
if (ref == NULL) exit(EXIT_STATUS_ON_BAD_CODE_SIGNATURE);
if (status != noErr) exit(EXIT_STATUS_ON_BAD_CODE_SIGNATURE);
SecRequirementRef req = NULL;
// this is the public SHA1 fingerprint of the cert match string
NSString * reqStr = [NSString stringWithFormat:@"%@ %@ = %@%@%@",
@"certificate",
@"leaf",
@"H\"66875745923F01",
@"F122B387B0F943",
@"X7D981183151\""
];
// create the requirement to check against
status = SecRequirementCreateWithString((CFStringRef)reqStr, kSecCSDefaultFlags, &req);
if (status != noErr) exit(EXIT_STATUS_ON_BAD_CODE_SIGNATURE);
if (req == NULL) exit(EXIT_STATUS_ON_BAD_CODE_SIGNATURE);
status = SecStaticCodeCheckValidity(ref, kSecCSCheckAllArchitectures, req);
if (status != noErr) exit(EXIT_STATUS_ON_BAD_CODE_SIGNATURE);
CFRelease(ref);
CFRelease(req);
LogDebug(@"Code signature was checked and it seems OK");
감사합니다. BTW, 두 번째 줄의 NSURL * url = [[NSBundle mainBundle] bundleURL]은 리소스 및 실행 파일을 포함한 전체 번들의 유효성을 검사하는 데 사용될 수 있다고 가정합니다. 맞습니까? – Stream
10.5에서 작동하도록 이것을 얻었습니까? – Richard
아니,하지만 지금은 조금 늦은 것 같아. :) –