install .p12 or .cer in console macos

前端 未结 3 651
悲哀的现实
悲哀的现实 2021-01-30 12:03

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

相关标签:
3条回答
  • 2021-01-30 12:34

    This will import the bundle to the default keychain:

    security import ./bundle.p12 -P secretPassword
    

    secretPassword is the p12 file encryption password.

    While the answer by Stuart should work, it is not required to create another keychain first.

    0 讨论(0)
  • 2021-01-30 12:35

    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.

    0 讨论(0)
  • 2021-01-30 12:36

    It's so simple. I've managed to do the following:

    security import ./dev_account.p12 -P 7373345585 -A
    

    It will not prompt for the keychain password. It's works for me.

    0 讨论(0)
提交回复
热议问题