Error when trying to obtain a certificate: The specified item could not be found in the keychain

I was having a problem with codesigning my apps, so I deleted all the keys from the keychain. Then I went to Certificate Assistant => Request a certificate from a Certificate Authority (to create CSR for a new certificate).

So enter my email address and here's what I get:

The specified item could not be found in the keychain.

What am I doing wrong?

P.S. When I'm trying to Create a Certificate Authority, I get the same error.


Solution 1:

I solved it. Ensure you are in the "Certificates" section and you select "Apple Worldwide Developer Relations Certification Authority" before requesting a certificate.

Solution 2:

Go to the "Certificates" section and select "Apple Worldwide Developer Relations Certification Authority" before requesting a certificate.

enter image description here

Solution 3:

Keychain Access will not let you Request a Certificate from a Certificate Authority With "identity"... unless you have both the private key and public key for identity in your keychain. I ran into this when I only had the private key and not the corresponding public key.

You can create the public key from the private key and import it into your keychain using the procedure described in I lost my public key. Can I recover it from a private key?

Once I imported the public key I was able to use the Request a Certificate from a Certificate Authority With "identity"... command without triggering the The specified item could not be found in the keychain error.

Solution 4:

You are (perhaps accidentally) asking Keychain Access to generate a Certificate Signing Request using an existing key. If a key is selected when you go into the Keychain Access - Certificate Assistant menu, the options presented will be for that selected key.

Choose a non-key item in your keychain (like a saved password) and go to Keychain Access - Certificate Assistant again to generate the CSR normally.