Symmetric encryption and asymmetric encryption, asymmetric encryption
What is encryption? Encryption is divided into two parts: algorithm and key. The algorithm remains unchanged, and the key changes. For more information, see the following example.
Key: abcedfgh-> 12345678.
Algorithm: in plaintext, each bit is replaced by another bit in the key table.
For example, after adfh is encrypted, It is 1568.
Symmetric encryption is used if the encryption key K is the same as the decryption key K.
Advantages of symmetric encryption: Fast encryption.
Disadvantage of symmetric encryption: The key transmission is insecure.
What is asymmetric encryption, such:
The encryption key K and the decryption key K' are different in asymmetric encryption.
The advantage of asymmetric encryption: There is no key transmission security problem.
The disadvantage of asymmetric encryption: the encryption speed is slow.
In asymmetric encryption, the encryption key is also called the public key, and the decryption key is also called the private key. See:
First, Lao Wang generated the public key and private key, and then Lao Wang sent the public key to Xiao Zhang, Xiao Li, and Xiao Lin. They can encrypt the plaintext and transmit it to Old Wang. Only when Old Wang has a private key that can be decrypted can he see the original text.
In combination with the advantages of symmetric encryption and asymmetric encryption, how does one use symmetric encryption in actual applications?
The transmission of symmetric encryption keys is not secure, so we use asymmetric encryption to transmit symmetric encryption keys.
Asymmetric encryption is slow, so we use symmetric encryption to encrypt data.
After the combination of the two, it works like this:
1. First, Old Wang generates asymmetric encryption public keys and private keys. Send the public key to Xiao Li.
2. Xiao Li generates symmetric encryption keys and transmits them to Lao Wang through asymmetric encryption public keys.
3. Old Wang uses the asymmetric encryption private key to decrypt the symmetric encryption key that Mr. Li passes to him.
4. Xiao Li and Lao Wang transmit data through symmetric encryption keys.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.