I'm trying to import a .pfx certificate via command line. This certificate is secured by a password. Is there a way to do this in terminal? I'm running OS X 10.8.
When I use this command I get the default pop-up asking for the password:
security import certificate.pfx -k ~/Library/Keychains/login.keychain
When I use this command:
security import certificate.pfx -k ~/Library/Keychains/login.keychain -P password
I get this error:
SecKeychainItemImport: MAC verification failed during PKCS12 import (wrong password?)
I'm sure the password is correct because it works if I enter it manually.
Thanks!
Keychain Access lets you view the keys, certificates, passwords, account information, notes, or other information stored in a keychain. In the Keychain Access app on your Mac, if you don't see a list of keychains, choose Window > Keychain Viewer or press Command-1.
Got it!
The password starts with a dollar and I didn't escape it with a \.
So let's say the password is $tup1dP@ssw0rd the command has to be:
security import certificate.pfx -k ~/Library/Keychains/login.keychain -P \$tup1dP@ssw0rd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With