R. Due
R. Due

Reputation: 31

macos grant access to system keychain for app

Is there any way to grant read access to one specify certificate or private key for one particular app via script and/or terminal in MacOS (High sirra and/or Mojave).

I can do it via the graphical interface. But I want to archive this via terminal and/or script.

KeyChain - > System - > Keys -> Double Click Private key XY - > Access Control - > Confirm Before Allowing - > Add App XY - Save Changes.

Upvotes: 3

Views: 2607

Answers (1)

Sardeep Lakhera
Sardeep Lakhera

Reputation: 319

You can do it using the security command during the import/install of the certificate. If certificate is already installed, you can either use GUI as you have mentioned or delete the private key and reinstall it using below command.

sudo security import <path_to_cert_or_private_key_file> -k /Library/Keychains/System.keychain  -P <password_of_the_certificate_file>  -T <path_to_the_app>

Upvotes: 1

Related Questions