使用密码通过命令行添加/导入证书Mac OS X [英] Add/import certificate with password via command line Mac OS X
问题描述
我尝试通过命令行导入.pfx证书。此证书由密码保护。有没有办法做到这一点在终端?我运行的是OS X 10.8。
当我使用这个命令时,我得到默认的弹出窗口,要求输入密码:
security import certificate.pfx -k〜/ Library / Keychains / login.keychain
当我使用这个命令:
security import certificate.pfx -k〜 Keychains / login.keychain -P password
我收到此错误:
SecKeychainItemImport:PKCS12导入期间的MAC验证失败(错误的密码?)
我确定密码是正确的,因为如果我手动输入密码,它是正确的。
谢谢!
密码以美元开头, \。
所以让我们假设密码是$ tup1dP @ ssw0rd,命令必须是:
security import certificate.pfx -k〜/ Library / Keychains / login.keychain -P \ $ tup1dP @ ssw0rd
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!
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
这篇关于使用密码通过命令行添加/导入证书Mac OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!