6

I'm trying to export a private key from System.keychain in Keychain Access. I've tried running Keychain Access as a root. No matter what, I always get the following error.

enter image description here

When I try to export the private key via the command line I get the following.

security: SecKeychainItemExport: The contents of this item cannot be retrieved.

1 Answer 1

5

Most likely, your key was imported with -x option for security import:

<...>
-x      Specify that private keys are non-extractable after being imported.
<...>

When you try to export a key, Security Framework checks whether this attribute is set and refuses to export the key.

Of course, the key is still there and you might be able to find a way to extract it (see this question).

1
  • 1
    Thank you! This is five years too late, but at the time, I took a look at the question you shared. I was able to resolve the problem by installing an OS X 10.5 virtual machine and using Keychain Access to export the private key. This works because 10.5 doesn't have any knowledge of that attribute. Nov 7, 2021 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .