I've try install .p12 cert to my macos use command line.
I can install .cer
sudo certtool I Certificates.p12 d
but it doesn't work on computers where this cert is not generated. As I see i should use .p12 But how can I install .p12 ?
I've tried to use
security add-certificates "/Users/$NAME/Library/Keychains/login.keychain" "$CERT_PATH"
But result same as previous command. Can't install .p12
Please help.
Thanks,
It looks like you can do this using the import command. I've managed to do the following:
security create-keychain -p password bobbins.keychain
security add-certificates ./MyCertificate.cer
security unlock-keychain -p password bobbins.keychain
security import ./MyPrivateKey.p12 -k bobbins.keychain -P privateKeyPassword
I found I had to unlock the keychain, otherwise it prompted for the keychain password.
Hope this helps.
You may also find it helpful to specify the '-a' option for importing your private key. This allows you to specify the path to an application that's allowed to use it without entering the password.
According to the documentation the allow flag is'-A'. The lowercase is for another purpose.
The two options (at least as of macOS 10.12):
-A Allow any application to access the imported key without warning (insecure, not recommended!)
-T Specify an application which may access the imported key (multiple -T options are allowed)