title: Obj-c codesigning without entering admin password?
body: <p>Is it possible to 'automatically' codesign bundles via cocoa without the user having to enter their admin username and password each time?<br> If there is some way to implement this, some type of working example would be appreciated. Here is the code I'm currently using, which asks for admin credits when executed:</p>
  
  <pre><code>- (void)codeSignature:(NSData *)privateKey {
  
      NSString* signSomething    = @"file";
      NSString* homeDir     = [NSHomeDirectory() stringByAppendingPathComponent:@"/Users/Rufote"];
  
      NSString* homePath = [homeDir stringByAppendingPathComponent:signSomething];
  
      NSTask *task;
      task = [[NSTask alloc] init];
      [task setLaunchPath: @"/usr/bin/codesign"];
  
      NSArray *args;
      args = [NSArray arrayWithObjects: @"-s", @"certificate", @"-vvvv", @"-f", homePath, nil];
      [task setArguments: args];
  
      NSPipe *pipe;
      pipe = [NSPipe pipe];
      [task setStandardOutput: pipe];
  
      NSFileHandle *file;
      file = [pipe fileHandleForReading];
  
      [task launch];
  
      NSData *data;
      data = [file readDataToEndOfFile];
  
      NSString *string;
      string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
  
      [string release];
      [task release];
  
      return;
  
  }
  
  @end
  </code></pre>