Weird "security" bahavior with SSL certificates

Hello,

I have been attempting to automate the addition of SSL certificates to keychains on a MAC using the "security" command. I've noticed two things, 1 of which I don't understand.

  1. If I use something like
"security add-trusted-cert -d -k /System/Library/Keychains/SystemRootCertificates trustRoot "$CERTPATH" 

, I get a dialog box to enter the password. Is there anyway I can add the certificate to a keychain (Doesn't matter which as long as it works with Safari) without the password prompt?

  1. The strange part - In the above command, if I change the
/System/Library/Keychains/SystemRootCertificates to $USER/Library/Keychains/login.keychain

, I get the same prompt but even if I do not enter my password and exit from the dialog, the certificate gets added to the keychain (I checked from the GUI). Any idea what is happening?

I would appreciate any help with the above.

Thanks!
-p

Try creating one with the -p switch and set a password for it, I think that will not prompt the user.

see this: Mac OS X Manual Page For security(1)