Public and private keys are commonly known as asymmetric encryption methods, which are improved from the previous symmetric encryption (using usernames and passwords. I will describe the principles by email.
The public key and private key are used to secure emails:
1. The content I sent to you must be encrypted and cannot be seen by others during Email transmission.
2. You must ensure that the email is sent by me, not by someone else impersonating me.
To achieve this goal, both the Email recipients must have the public key and private key.
The public key is for everyone. You can publish it via email or download it from a website. The private key is your own and must be saved with caution. It is best to add a password.
The role of the public key and the private key is: The content encrypted with the public key can only be decrypted with the private key, the content encrypted with the private key can only be decrypted with the public key.
For example, I want to send you an encrypted email. First, you must own your public key.
First, I use your public key to encrypt the email. This ensures that the email is not visible to others, and that the email is not modified during transmission. After receiving the email, you can use your private key to decrypt the email and view the content.
Next, I use my private key to encrypt this email. After it is sent to you, You can decrypt it with my public key. Because I only have the private key in my hand, this ensures that this email is sent by me.
In. net, asymmetric encryption is the most complex and powerful security system. It can call the certificates of the server and client in the Code and match them to obtain the user's identity.