I am rather new to the topic of cryptography. Those terms such as Digital Certificate, Digital signature, encryption, decryption sometimes confuse and scare me. Here are some thoughts which makes me understand the big picture better.

First, all that I am talking about is based on** asymmetric cryptography.** It’s a class of cryptographic algorithms which requires two separate keys. e.g, the secret key and the public key. Then I won’t bother too much about what encrypt or decrypt means. These terms are coined from an aspect from the applications.

All you should know is that you can use either the Private Key to transform Data1 to Data2, or transform Data2 to Data1. I am not going in to the details how this transform works(Check RSA page on Wikipedia to get the basic idea). There are some important facts to know in order understand the big picture. First of all, If you don’t know the Private Key, it’s very hard to do the transformation from Data1 to Data2. Secondly, if the Private Key is known, it’s trivial to generate a Public Key according to it.

Both data encryption and digital signature relies on theses facts. For data encryption, suppose User1 wants to send Data2 to User2, he will first use the public key to transform Data2 to Data1, then send Data1 on an insecure Channel, or even broadcast it. No user other than User2 has Private Key. Thus only User2 is able to transform Data1 to Data2 to see the original data.

For digital signature, suppose User1 wants to sign Data1 and send it to User2. How can User2 make sure the Data1 he gets is really from User1 and intact? User1 uses his Private Key to transform Data1 to Data2, and sends both Data1 and Data2 to User2. Here Data2 is called the signature. User2 uses the Public Key to transform Data2 back to Data1 and check whether it’s identical to the Data1 he gets. If not, it means Data1 is modified or Data2 is fake. In reality, people don’t generate the signature directly from data because the transformation is expensive. They use a hash function to get a hash value from data then generate the signature from it.

So far so good. But there is still one problem in this picture, how can User2 be sure that the Public Key he holds is really from User1? The obvious way would be that they meet in person. However, it’s not feasible in most cases. The other solution is they both trust in a third person. The third person writes a certificate says “hereby I confirm that the public key belongs to User1″ and signs it. The third person is so-called certificate authority. The problem is that how User1 and User2 can trust this certificate? They should both hold a reliable public key of the third person. So we are chasing our own tails now. The solution is that we have some pre-installed certificates on both sides.