14

I want to archive my app for distribution on two computers. I exported the private key successfully and imported it to my second machine, however run into errors when imported the public key.

Everywhere I search people always mention only exporting of the private key - why is that? how can I export the public key and transfer it successfully? what am I doing wrong?

TommyG
  • 4,145
  • 10
  • 42
  • 66

3 Answers3

51

It's been broken since 2009 as reflected in this bug report.

In case that report wanders off the internet, here's the relevant instructions to import a public key pem file. You'll want to execute this in Terminal.

security import pub_key.pem -k ~/Library/Keychains/login.keychain
DougW
  • 28,776
  • 18
  • 79
  • 107
3

When you export you private key, you should get a .p12 file. Import that file on the other machine. It should have everything in it you need. You don't need to specifically export and import the public key.

jimmyg
  • 580
  • 4
  • 13
  • but how do i generate one on the second machine? – TommyG Jan 17 '12 at 00:58
  • this was the answer for me, just export the private key (the nested key icon). Once you get the key you can email it to yourself then open the email on the second machine, download to downloads folder > open keychain > system > +(plus) button > then import from there – Lance Samaria Oct 31 '19 at 03:17
0

Same as DougW,

But first you must directing your terminal to directory of the key

Then change the pub_key to the name of key you will import

Example:

your key on folder Documents , and the key name is my_login.pem

So, you must write in terminal

$ cd Documents

$ security import my_login.pem -k ~/Library/Keychains/login.keychain

But be careful, you must need a backslash if you key name like

$ security import \<my_login.pem\> -k ~/Library/Keychains/login.keychain

Backslash for escape character as text

https://ubuntuforums.org/showthread.php?t=1976408

Don't understand the backslash here

For Your Information

And you can import keychains with change the directory, the directory show in here

keychains directory

just let your pointer on the kind of keychain you want to know

So it will be like this

security import **yourkeyname** -k ~/Library/Keychains/System.keychain

BE CAREFUL with this

You must know what you do