This question already has an answer here:

As far as I know, before entities acquire a digital certificate from a CA, their app will generate a pair of keys (PRk and PUk). But what is the private key used for?

P.S. Is user's public key is the same as CA's?

(The reason to ask this is because after CA issues the certificate it will use its private key to do the encryption, but how to decrypt it? )

marked as duplicate by Xiong Chiamiov, kasperd, grochmal, S.L. Barth, Matthew Jan 9 '17 at 12:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


But what is the private key used for?

The private key can be used to sign something and the public key can be used to validate the signature.

In TLS this is used to authenticate the server and thus detect and deter man in the middle attacks. Somehow simplified this works like this: The client creates a random challenge and sends it to the server which signs it using the server's private key and sends it back. If the signature can be successfully verified with the public key contained in the servers certificate than the server obviously must have access to the private key and thus owns the certificate.

Similarly the CA has used the CA's private key to sign the certificate. This signature can be verified by the client using the public key contained in the CA's certificate. This way a trust chain can be build up to the locally trusted CA certificate.

  • Cheers mate, here is one thing that I am not really clear which is that in your assomption, server encrypts it with its private key and attach its public key inside. So how can it be decrypted by the client who does not have the public key or not have the public key belong to the server. I mean in this assoption, can I understand in this way : client's public key is the same as server's ? – Shan Huang Jan 8 '17 at 0:03
  • @ShanHuang: there is no clients public key involved when checking if the server owns the certificate. There is only the servers certificate which the client has gotten from the server and and which includes the servers public key. And the client checks, that this publicly known public key matches the publicly unknown private key which proves that the server owns the private key and hence the certificate. – Steffen Ullrich Jan 8 '17 at 2:58

The CA signs your public key, proving that whoever has the private key that works with that is really you.

Hence, the CA never sees your private key. Which is good, because your private key must stay private.

Won't answer the "what is a private key for" question, since it is just a basic question of understanding private/public key infrastructure, and you can find that explained in very many places.

  • The CA does not directly sign the public key but it signs the certificate which contains the public key but also other information like subject(s), life time etc. – Steffen Ullrich Jan 7 '17 at 21:47
  • @SteffenUllrich yep, of course; in fact, it processes a CSR. But at the level of understanding that OP showed, the important thing is that the CA signs information that is public, not the private key. – Marcus Müller Jan 7 '17 at 21:48
  • @SteffenUllrich Cheers, but I think you got me wrong, I know CA signs its public key inside, rather than private key. However what I meant is that CA signs by using its private key, doesnt it? – Shan Huang Jan 8 '17 at 0:08
  • @ShanHuang: yes, the CA signs the servers certificate (which includes the servers public key) by using the CA's private key (but not the servers private key). And anybody having the publicly available CA's certificate (which includes the CA's public key) can validate this signature. – Steffen Ullrich Jan 8 '17 at 3:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.