export public key from keychain access
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?
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.
export public key from keychain access, 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. In the Keychain Access app on your Mac, select the items you want to export in the Keychain Access window. Choose File > Export Items. If the Export Items menu is dimmed, then at least one of the selected items can’t be exported. Select a location to save your keychain items, click the File Format pop-up menu, then choose a file type. Click Save.
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
Exporting a Private Key as a .p12 file, Exporting a Private Key as a . p12 file � Open Keychain Access � Select the 'login' Keychain in the left column � Find the certificate used to sign your Provisioning� I have a PKI certificate in Keychain Access.app on OS X 10.9, together with the private key.. The manual page for /usr/bin/security indicates that there is a -x option for security import to specify that private keys are non-extractable after being imported, which I believe must have been used on my key.
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
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
Don't understand the backslash here
For Your Information
And you can import keychains with change the directory, the directory show in here
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
Export a PKCS #12 / PFX File from Keychain Access on macOS , demonstrates how to export a PKCS #12 file from Keychain Access, the key and are commonly used to import and export certificates and private keys on� There's a private key under the certificate in keychain access. 1)I exported the the certificate as certifcate .cer file then I imported that from another machine. However , it's missiong the private key. and xcode on the new machine complaining no valid signing key available for the imported provisioning profile.
(Mac) Exporting Code Signing Certificate, In the Keychain Access toolbar, click File > Export Items. down arrow and go to where you want to save your code signing certificate (w/private key) .p12 file. Next, you will be prompted to give Keychain Access permission to export your private key. Enter the password for your keychain and click Allow. If you are exporting from the login keychain, the password will be your login password. Your new PKCS #12 file will be saved in the location you selected (in this case, the computer’s desktop).
How to export a personal certificate from the OS 10.x Mac keychain, Select the items you want to export in the Keychain Access window. Some exported items, such as public keys, don't require a password. 2012-06-28 14:32:47.488 Keychain Access[226:507] Could not find image named 'ToolbarArrangeByTemplate'. Then when we tried to export our key, it still does not work Any idea ? Please help we are struggling with that
You can only export one key at a time, or one key and a matching certificate. It will be encrypted upon export and can only contain one key. If you need to move an entire keychain to a different computer, look at ~/Library/Keychains - example login.keychain (in finder, cmd + shift + g, paste path, go)
- but how do i generate one on the second machine?
- 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
- Thanks! Spent 2 days breaking my head against the monitor
- It really helps me a lot!
- Will this work for Private Key too of a remote server?
- Hi, trying to do this but returns
security: Error reading infile pub_key.pem: No such file or directory...I have an SSH (.pem) keypair for an AWS instance...do I need to import to keychain?
- FYI, in keychain the imported file will show up with the name "Imported Public Key"