Add private key to certificate or vice versa - ios

the problem is, that I want to create a new private/public key pair for a new App.
So i followed the documentation (http://developer.apple.com/ios/manage/certificates/team/howto.action) and it said to first created a new key pair.
Ok, than i got a certificate signing request file, which i had to upload to the developer homepage (Certificate > Developement).
There I found out, that (and because) we allready have an app in the appstore, there is allready a certificate. So i downloaded the existing one and doubleclicked it in the finder. The keychain opended, but didn't append the certificate to the newly created private key (as i expacted).
What did I do wrong? What do i have to do, to activate this key pair?
Can someone help me in this issue?
Thanks
Br
Nic

Every certificate will have a public and private key. And also if you are talking about the developer certificate, every developer account can have only one certificate.
What you get to download from the apple website is only your public key. You need the private key to sign the apps. Your private key will be in the machine where you generated the CSR.
Check the "Saving your Private Key and Transferring to other Systems" section in http://developer.apple.com/ios/manage/certificates/team/howto.action to find out how to export your private key from that machine and use it in a different machine.
If you cannt get the machine where you generated the CSR, then you can revoke the existing one and generate a new one. But remember that this will make the existing profiles generated from this certificate invalid.

I was having the same problem and I had to delete all my provisioning profiles and existing certificates and then I followed the step-by-step instructions from this article:
Creating Your Signing Certificates by Apple and it had me up and running in 5 minutes after hours of banging my head!

Related

Apple distribution certificate missing private key

I know this has been asked multiple times and I have went through several stackoverflow answers and Apple dev forums and followed all the given advice but this is not working for me. I keep getting this error.
I have revoked certificates, created new ones, deleted everything in my keychain associated with the account. Generated new private keys and distribution certificates. Nothing I tried has worked. I even contacted Apple directly and their instructions did not work as well. What am I doing wrong? I have been attempting to solve this for over a month now.
These are the things I have done so far:
Revoke Existing Distribution Certificate
Delete Signing Certificate
Followed the answers given in this thread
Export the certificate from the keychain (keeping the folder open showing the private key) of the device on which the certificate was download the exported .p12 and verify if the private key is showing on the keychain if not the recently added certificate from key chain , Go to > My Certificates and drag and drop the .p12
This resolved my issue.

Certificate added but It shows missing private key

Right now I'm developing apps on a brand new macbook. I have downloaded the certSigninRequest
Now I have added both the ios distribution certificate and the private key which is (certSigninRequest)
But whenever I try to export my app it keeps saying missing private key. I have added to my Keychain already
For your case, the appropriate way to use the Distribution Certificate to be legal on other machine(s) is to export it from the current machine that uses the certificate.
To do this:
Navigate the the keychain access.
Go to the targeted certificate, expand it and select both the certificate and the private key:
Right click and select "Export 2 items...".
Obviously, you should fill the required info, such as the name of the exported file and a password.
The output of the above steps would be a .p12 file, which should be installed on the other machine(s). Note that revoking the original certificate will also makes this exported file to be invalid.
Do not request a new distribution certificate for the new machine, it will automatically revoke the previous one (which leads to make the first machine's certificate to be invalid). This thing is you would generate only one Distribution Certificate -by generating a "CertificateSigningRequest" file from the current machine- and then export it to be able to install it on the other machines, which means that all machines use the same distribution certificate.
Also, the following questions might be related to your case:
missing private key in the distribution certificate on keychain
How can I add private key to the distribution certificate?

certificate selected by provision profile is incorrect

I have created certificate & provisioning profile related to my iphone app.
but when I run app it shows doesn't match any valid certificate/private key pair in the default keychain
& then I realize that it is not certificate which i have created.
what should I do now?
I have tried to delete previous certificate but it does also not working it again came back.
You should have the private key used to create the certificate present in your keychain app for you to be able to code sign your app. Start fresh, create a new certificate, this time make sure to store the private key as .p12 file.
You have not installed the .p12 file. Please go through the Apple docs for Certificate/Provisioning-profile creation process. That will help you to understand the whole process of signing an iOS app.
You can always verify certificate, which provision created with.
Provision profile have public key encoded in base64. You can compare hash sums or finger print with private key on your mac.
Here is example code how to export certificate from provision in ruby gist.gitgub

One mac to create 2 certificates

Is it possible to create more then one ios distribution certificate on one mac machine?
When I double click the certificate it does not create the key in my keychain until.
Thanks
You can ask for a new one, however that is not the equivalent of creating two. I dont believe you can create two on one machine as it is a distinct secret pair from your computer to their service. What you can do though if you need to export your development certificate to another computer is export from XCode a provisioning profile and install that on the other computer.
The certificate doesn't create the key, you do. When you perform the first step in Keychain Access when you request a certificate from a certificate authority, this generates the key and gives you a file Apple can use to sign it. When you install the certificate, it merely gets attached to the key that was there already.
In order to have more than one distribution certificate, you will have to create two keys and ask Apple to sign each one. You will then receive a certificate for each one. However I don't believe under normal circumstances Apple will sign more than one key.

"Valid signing identity not found" on New Computer

I got new computer. Firstly i copied iOS-project from old one. Then, i refreshed profiles in organizer, but all of them got status "valid signing identity not found"
So in Keychain Access all certificates are OK
Any ideas? How should i valid all this profiles? Thnx
There is no private keys in your certificate
Go to your old mac click on 3 right click on private key and export that key give a password for the key. copy that to private key to pendrive and import that to new Mac Keychain it asks for Password so give the password you set in old mac when Exporting. Restart the xcode it works fine
The certificates are okay, but the private keys required to sign the certificate are not here : you can see this because there is no disclose triangle near the certificate in the Keychain.app.
The keys that goes along the certificate should have a .p12 extension, but if you can't find it, your best bet is to revoke the certificates using the DevCenter, and create them back again and download them onto that new system.
If you have your private keys in your old mac you can create your .p12 file like this:
http://seventhsoulmountain.blogspot.com/2013/09/how-do-i-create-p12-file.html
But if you do not, you have to revoke your old certificate and create a new one.
This is such a pain sometimes. Recently I had to face this. The certificates may appear but you do not have the private keys with you. For a complete guide click below:
http://seventhsoulmountain.blogspot.com/2013/09/ios-code-sign-in-complete-walkthrough.html

Resources