13

I have private key and certificate in system keychain and I want to access it using CodeSign so it needs to be unlocked.

if I try to unlock login keychain using below script then no problem

security unlock-keychain -p password login.keychain

But If I use the same syntax for system.keychain then I get this error security: SecKeychainUnlock The user name or passphrase you entered is not correct.

security unlock-keychain -p password /Library/Keychains/System.keychain

From this what I can see there is no way to enter username in the syntax.

My intention is to unlock the keychain while code-signing the build,so that I won't get prompt like below.In the case of code-signing event in jenkins I'd get error like "User Interaction is not allowed"

I know this problem can be solved by giving access to all apps in keychain But I intend to do it via script itself.

code sign alert

Any help is appreciated !

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
  • Any reason why not to move certificate from system to login keychain? – Roy K Apr 07 '16 at 18:53
  • @RoyK - I'd like to do it from system keychain itself – Durai Amuthan.H Apr 11 '16 at 09:16
  • @RoyK - is it possible that I can create my very own keychain and move all the certificates over there and access without any username and password ? – Durai Amuthan.H Apr 20 '16 at 04:14
  • @DuraiAmuthan.H did you ever find out how to do that? – rexford Jul 03 '18 at 10:54
  • @rexford - I couldn't find out and I am just keeping it unlocked manually on jenkins server – Durai Amuthan.H Jul 03 '18 at 11:13
  • @rexford - Just now I found out that jenkins gives option to unlock keychain from its interface we just have to pass the keychain path and password.it unlocks it.If jenkins can do it then we can do it through terminal as well. – Durai Amuthan.H Jul 03 '18 at 14:25
  • @DuraiAmuthan.H thanks for the feedback! Now I am really curious how Jenkins achieves this feat. – rexford Jul 03 '18 at 16:28
  • @DuraiAmuthan.H "I couldn't find out and I am just keeping it unlocked manually on jenkins server" are you unlocking the system keychain? If yes, post that is there any prompt for admin credentials? – Sardeep Lakhera Jan 31 '19 at 05:34

0 Answers0