I'm trying to import .p12 certificate into the keychain on my Mac via bash script. So far, I've been trying:
sudo security importcommand.
It returns that import was successful but, in fact, it never gets imported into any keychain.
sudo security add-certificates -k /Library/Keychains/System.keychain certificate.p12
it throws the following error:
Password: SecCertificateCreateFromData: Unknown format in import.
The only thing that worked for me was the .cer format via this command:
sudo security add-certificates -k /Library/Keychains/System.keychain certificate.cer. It does import the certificate into the keychain and I can see it in the keychain access.
But I only have .p12 certificates. Could anyone help me with that one, please?