Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't open .pem file in keychain access

So I'm trying to set up an EC2 instance on AWS and I've created a key pair and downloaded the .pem file. However, when I try to open it I get the error message:

Keychain error message

I've also read about entering the following in the terminal to work around the issue:

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

but this doesn't work either (I get the following error message:

security: Error reading infile pub_key.pem: No such file or directory).

I've also tried just creating new key pairs but the problem persists.

like image 255
torola Avatar asked Dec 29 '16 14:12

torola


People also ask

How do I open a PEM File on a Mac?

macOS. The same concept is true for your Mac email client as it is for a Windows one: use Safari to have the PEM file imported into Keychain Access. You can also import SSL certificates through the File > Import Items menu in Keychain Access. Choose System from the drop-down menu and then follow the on-screen prompts.

How do I open a PEM key?

If you cannot open your PEM file correctly, try to right-click or long-press the file. Then click "Open with" and choose an application. You can also display a PEM file directly in the browser: Just drag the file onto this browser window and drop it.


1 Answers

The keychain extension changed with Sierra. Now it is login.keychain-db. You should navigate to where the pem key file is and use

security import pub_key.pem -k ~/Library/Keychains/login.keychain-db
like image 67
joc7188 Avatar answered Nov 16 '22 03:11

joc7188