13

I'm working on an app in Mac OS X Mountain Lion that needs to access the private key of some of my certificates within the Keychain Access. Since this app is going to run on a server, I need to avoid the pop up dialog that requires the user to allow the app to access the private key:

Pop up dialog

I know that by clicking "Always Allow" the dialog won't popup anymore for that private key, the problem is that I will be working with different keys.

Thanks in advance,

Mikywan.

Camden Narzt
  • 2,271
  • 1
  • 23
  • 42
mikywan
  • 1,495
  • 1
  • 19
  • 38

1 Answers1

14

The only way I found to solve this is by setting up the Private Key in the Keychain Access to "Allow all applications to access this item".

Private Key Properties: Access Control

You can configure this from the Terminal when you import the certificate into your Keychain.

Import command: import inputfile [-k keychain] [-t type] [-f format] [-w] [-P passphrase] [options...]

To set the access control to "Allow all applications to access this item", just add the flag "-A".

You can check always Apple's manual on security

Hope this helps.

mikywan
  • 1,495
  • 1
  • 19
  • 38
  • 3
    You can also specify single applications allowed to use the key instead of all applications by using the -T flag on `security import`. For example: security import my_input_file -T /usr/bin/codesign . You can use multiple -T flags to specify multiple programs. This information can also be found on Apple's manual on security, linked in your answer. – Mark Jul 25 '13 at 23:50
  • 3
    On a new El Capitan server I just set up; I was only able to grant access by re-importing using the command line tool and adding the -A option. – Fiid Nov 16 '15 at 17:17
  • Looks to be out of date and not working on Monterey anymore :( – NorseGaud Jun 14 '22 at 19:23