Concepts about RSA, public key, private key, encryption, and signature
Preface
As a programmer, I often hear such words as encryption and decryption. Asymmetric encryption is widely used. This article does not describe the principles of encryption technology. It just hopes to give you a simple analogy to understand the concepts of common words in asymmetric encryption and their functions.
Introduction
There are two encryption and decryption methods in the RSA algorithm:
Public key encryption, Private Key decryption (encryption algorithm) private key encryption, Public Key decryption (signature authentication algorithm)
These two methods have different effects.
We can make the following analogy:
Public Key-> safe deposit box private key-> safe deposit box Password
Note that a password can be used to open all the safes with this password !!!
The private key is only known to you, while the Public Key is public.
Public key encryption Private Key decryption
In this process, we put things in the safe box. Only those with passwords can open the safe box and know what the inside is.
Information is transmitted from the public key to the private key. Because others do not have a private key, they cannot decrypt the specific information.
Private Key Encryption Public Key decryption
This encryption method is mainly used for identity authentication to determine whether you are the owner of the safe.
Generally, we add the SSH Public Key in Github.
We told Github the public key and accessed it through the private key. We found that the safe can be opened, so we can be sure that I have access permissions for this Github repository.
Information is transmitted from the private key to the public key.