Do I need the old private key to generate new Distribution Certificate? - iphone

My distribution certificate is going to expire in few days. I have changed my system so I want to know that do I need the old private key to create new certificate signing requrest?
Also I wanted to know that is is necessary to use the same email ID that is used to create the developer account while creating new certificate signing request?
Thanks

If its already expired, don't worry about old certificates.
Else you need to export your private keys on your old system and then install your private key and profiles on your new machine.
I think its not mandatory to use same email ID to create new certificates.

No you do not have to know anything about your previous keys to generate new ones. Just follow the instructions in the portal, and generate new ones.

Related

EJBCA refuses to generate certificates with error : not allowed to use same key

We used a static value ‘usernameTest’ as username to request EJBCA to generate X.509 certifcates; after generating certificates using this satic username we changed it to a unique value identifiying uniquely each certificate (Since using a static username is considered as a renew since the username is the same for all certificates (*) ) but now EJBCA refuses to generate certificates and stil reference the old static username ‘usernameTest’; we get this error:
User '250320092916' is not allowed to use same key as the user(s) ‘usernameTest’ is/are using.
We revoked all certificates previously generated for username 'usernameTest', but we still get this error message from EJBCA. Is there any way we can remove username 'usernameTest'?
Each certificate has a unique SubjectDN and username.
The version of EJBCA is ejbca-6.2.0.
(*): All generated certificates in EJBCA Administration GUI are related to the same username.
Thanks in advance.
Tomas is correct. Go to your "Certificate Authorities" under CA Functions. Edit your CA and find the setting called "Enforce unique public keys" under the "Directives" section.
Uncheck enforce and you will be able to use the same public key for different users.
It has nothing to do with the HSM. The default policy setting for CAs is to not allow users to share the same end-user public key. I.e not to issue a certificate with the same public key to different users. This is a checkbox setting in the CA settings.
Problem solved; the problem is not that a reference to usernameTest still in EJBCA but that the same key (RSA public key) is used for the request of the other user ('250320092916').
It seems this is a known limitation when relying on the HSM PTK-C simulator from the Safenet ProtectServer series; the simulator restarts its random generator when we re-initialize it (I suspect a misuse from me), which means it will always generate the same keys in the same order (which leads to such errors).
But also the message error is not clear; talking about the "key" without specifying, this leads to a confusion with subjectDN or other attributes communicated to the EJBCA, as an error message it may be "public key" or "RSA key", ... instead of key ;)
You can configure the PTK-C simulator to not reuse the random seed (yes that is very annoying). For ejbca we have documented it here.
You have to set the environment variable ET_PTKC_SW_AUTOSEEDRNG=true. With this setting the simulator will generate real keys, a new one every time.

is it safe to save the Certificate signing request for multiple use?

For iphone push notifications SSL certificates, you need to provide them with CSR files...
I have saved a CSR file since some time now, and i always give upload the same CSR file, whenever i want to generate the SSL certificates...
Now i've been thinking, since when generating CSR files, i'm actually generating the private key, and probably the public key too...
So i'm wondering what disadvantages i'm facing when i'm using the same CSR file.. though when i download the SSL Certificates, they appear in the keychain as if there's multiple private keys (though they have the same name) and each is attached to a different SSL Certificate.
Is it recommended to generate a new CSR file everytime? and why? and if it's not necessary, then how?
thank you
Certificate Request contains the public key and you have an associated private key. So by re-using it you basically get the same key pair signed again and again.
The disadvantage is obvious - if one key gets leaked, you get all certificates compromised. This is why re-generation of key pairs each time is necessary.

Is it possible to associate a certificate using two private/public keys?

I've got a weird situation here; I developed an app in 2011 using a macbook (private key: alida).. then a couple of months ago was having some problems migrating cert to another machine so just decided to revoke it and generate another certificate now using another set of private keys (francisco)
The situation is that now I have both certificates using two private keys in the keychain (and the old cert expired);
The question: is there a way to pair both priv keys (francisco & alida) with one certificate in the keychain? or I just have to left one of my apps behind? both apps I already in the Appstore;
Look hows my keychain (new machine) looks like:
Any suggestion on what should I do? is there any hope to fix this?
Thanks in advanced.
[edit]
another screenshots from the "my certificates" tab in keychain; so, basically I lost one my apps (no updates ever?) I think If thats the case, I will revoke current cert again and renew it with the keys from 2011 (first app generated) and forget the other one :/
In this context, keys come in pairs: (public, private). A certificate is just a file containing your public key plus some extra data including a "subject" which is information associating the public key to a specific person or entity (such as a DNS address) and, most importantly, a signature from a signing authority certifying (hence "certificate") that the public key is owned by the entity. These key-pairs are inextricably bound: there is no meaningful way to associate the private key from one key-pair to the public key/certificate of a different key-pair.
Normally, a signer (such as Apple in this case) will not generate two certificates with the exact same subject without revoking the earlier certificate first.
If you have an app at the iTunes store signed with a revoked certificate, it needs to be replaced with one signed by the newer, non-revoked certificate.
I think there is no way to pair both priv keys. You should now go with new priv key.

Public key and private key are not found in Keychain access

I think I accidentaly deleted public and private keys from Keychain Access-> login -> keys. Now when I generate new certificates, I am not seeing these keys. May I know how to restore or re download these?
If you deleted the private key (and don't have a backup), then you need to login to your Apple Developer account, go to provisioning portal, revoke the current developer or distribution key and follow the steps to create new ones.
Note: You will have to re-download any app provisioning profiles you may have also created to use the new private key

how to associate private key with a certificate in keychain

I just downloaded iphone sdk 4. when I try to install on the device I get
"Code Sign error: The identity 'iPhone
Developer' doesn't match any valid
certificate/private key pair in the
default keychain"
I have gone through the process of creating a provisioning profile and cert through iphone Development Provisioning Assistant. However, after installing the profile and cert the assistant asks to check whether public and private key are paired (surprisingly, it shows a pic of what seems to be a private key and cert being paired, i.e. the cert is 'under' private key in hierarchical terms. This is not the case in my keychain. Public key, private key and cert are there but there doesn't seem to be any associations.
Does anyone know how to pair a private key and certificate in keychain please this please?
ps. I have checked this thread but I'm hoping there's an easier way.
iPhone app signing: A valid signing identity matching this profile could not be found in your keychain
I wrote a wiki page (here) that describes how to export your certificate and private key pair. It's intended for my iOS development clients to send me their ad-hoc, but I believe it will solve your problem, too. The key is to make sure that you export the certificate and private-key PAIR all in one go -- not as two separate exports.
Hopefully, the screenshot near the bottom of that page will help out.