I have OSX agent which should read data from p12 file which placed in the project. There is a function SecPKCS12Import from Security.framework which do that. The problem is that if I run agent under root right after installing into appropriated folder the following function doesn't return certificate's data (&items parameter) but returns status error "0".
sudo launchctl load com.myagent.agent.plist
But after OSX reboot agent startups under root and works fine.
If run agent under user permissions it works fine even without OSX reboot.
Here is a plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UserName</key>
<string>root</string>
<key>StandardErrorPath</key>
<string>/usr/local/myagent/agent.log</string>
<key>StandardOutPath</key>
<string>/usr/local/myagent/agent.log</string>
<key>Label</key>
<string>com.myagent.agent</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/agent.app/Contents/MacOS/agent</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
I use OSX 10.8
How to solve the problem above?