macoscode-signingcodesigncode-signing-certificate

Developer ID Application Certificate missing a child key in Keychain Access


I am trying to recreate a Developer ID Application certificate, so I can sign my application. I had an existing certificate, but it's about to expire, so I am trying to regenerate a new one.

However, when I download a newly generated certificate from developer.apple.com, the imported certificate has no key as its child node in Keychain Access. The old certificate had this. When I attempt to use the certificate for code signing I receive something like:

/tmp/myapp.app/Contents/app/bin/myapp.exe: errSecInternalComponent

I am following the instructions to obtain a signed certificate using Certificate Assistant:

  1. Ensuring nothing is selected in Keychain Access, click Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
  2. I enter my email, accept the default Common Name and click Saved to disk.
  3. In developer.apple.com I click the "+" to Create a New Certificate
  4. I choose Developer ID Application
  5. I upload the CSR I saved above
  6. I download the .cer file that is generated
  7. I open the .cer file. This adds the certificate.

As you can see, the certificate does not have a private key inside it, like the old one:

enter image description here

Unfortunately I don't have the old certificate now having deleted it in a fit of pique but it looked like this:

enter image description here

... although in my case it had my private key.

I've noticed reference to the claim that creating a CSR also creates a public/private key pair, but I cannot see these anywhere in Keychain Access.

Later, I did manage to import the certificate and it show the private key. I think this was when I imported it into the same keychain as that which contains a private key "Dan Gravell" - login. However, I have since tried replicating that and now the certificate is being imported without a key again.

Xcode appearance

I've discovered there's a little more information in Xcode. The certificate shows "Missing Private Key" next to it:

enter image description here

When I look this error up, the suggestions seem to be that the certificate has been given to a developer by some third party that didn't include the private key. However, in my case I am that third party who has created the CSR and received the certificate originally and I thought I had the private key, otherwise I wouldn't have been able to create the CSR in the first place. All these items appear to be in my keychain.


Solution

  • I (eventually) got a reply from Developer Program Support. They issued a new certificate which I installed via XCode this time. I documented my other steps here: https://stackoverflow.com/a/74210449/28190