Re: SecStaticCodeCheckValidity fails when app is lauched from Terminal
Re: SecStaticCodeCheckValidity fails when app is lauched from Terminal
- Subject: Re: SecStaticCodeCheckValidity fails when app is lauched from Terminal
- From: Markus Spoettl <email@hidden>
- Date: Tue, 27 Sep 2016 23:16:27 +0200
On 27/09/16 22:57, Chris Hanson wrote:
On Sep 27, 2016, at 1:54 PM, Markus Spoettl <email@hidden> wrote:
On 27/09/16 22:39, Chris Hanson wrote:
How are you getting the URL that you pass to represent your application?
Could it be that you’re constructing the URL from a relative path when run
from the command line, rather than the full path? (You can’t depend on being
run from any particular working directory.)
Not sure what you mean by URL, I'm merely executing the app's executable from the command line. Assuming the My.app bundle is located in "~/Projects/My/Debug", I cd into "~/Projects/My" and execute "./Debug/My.App/Contents/MacOS/My”.
I mean, how are you constructing the SecStaticCodeRef that you pass to SecStaticCodeCheckValidity()?
OK, here the full code:
CFStringRef reqStr = <some requirements>
SecStaticCodeRef ref = NULL;
SecRequirementRef req = NULL;
CFURLRef bURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
OSStatus status = SecStaticCodeCreateWithPath(bURL, kSecCSDefaultFlags, &ref);
if ((ref != NULL) && (status == noErr)) {
status = SecRequirementCreateWithString(reqStr, kSecCSDefaultFlags, &req);
if ((req != NULL) && (status == noErr)) {
// this fails
status = SecStaticCodeCheckValidity(ref, kSecCSCheckAllArchitectures, req);
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden