Difference: 1. In symmetric encryption, the same secret key is used for encryption and decryption; in asymmetric encryption, two keys are used. Generally, the public key is used for encryption and the private key is used for decryption. 2. Symmetric encryption and decryption are relatively fast, while asymmetric encryption and decryption take a long time and are relatively slow. 3. Symmetric encryption has relatively low security, while asymmetric encryption has high security.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Related recommendations: "Introduction to Programming"
What is symmetric encryption technology?
Symmetric encryption uses symmetric cryptography encoding technology. Its characteristic is that the same key is used for file encryption and decryption.
That is, the key can also be used as the decryption key. This method is called a symmetric encryption algorithm in cryptography. Symmetric encryption algorithms are simple and fast to use, have short keys, and are difficult to decipher. In addition to the Data Encryption Standard (DES), another symmetric key encryption system is the International Data Encryption Algorithm (International Data Encryption Algorithm). IDEA), which has better encryption than DES and does not have such high computer function requirements.
The symmetric encryption algorithm has several problems in the e-commerce transaction process:
1. Requirement A secure channel allows communicating parties to negotiate a common key during their first communication. Direct face-to-face negotiation may be unrealistic and difficult to implement, so both parties may need to resort to other relatively unsecure means such as emails and phone calls to negotiate;
2. The number of keys is difficult to manage. Because each collaborator needs to use a different key, it is difficult to adapt to the large amount of information exchange in an open society;
3. Symmetric encryption algorithms generally cannot provide identification of information integrity. It cannot verify the identity of the sender and recipient;
4. The management and distribution of symmetric keys is a potentially dangerous and cumbersome process. Symmetric encryption is based on jointly keeping secrets. Both trading parties using symmetric encryption technology must ensure that they use the same key and ensure that the exchange of each other's keys is safe and reliable. At the same time, they must also set settings to prevent key leaks and changes. Key program.
Assuming that two users need to use symmetric encryption method to encrypt and exchange data, the users need at least 2 keys and exchange them. If there are n users in the enterprise, the entire enterprise will need a total of n×(n- 1) keys, the generation and distribution of keys will become a nightmare for the enterprise information department.
Common symmetric encryption algorithms include DES, 3DES, Blowfish, IDEA, RC4, RC5, RC6 and AES
What is asymmetric encryption technology
Unlike the symmetric encryption algorithm, the asymmetric encryption algorithm requires two keys: public key and private key.
The public key and the private key are a pair. If the public key is used to encrypt the data, only the corresponding private key can be used to decrypt it; if the private key is used to encrypt the data, then only the corresponding private key can be used to decrypt the data. Only the corresponding public key can be decrypted. Because encryption and decryption use two different keys, this algorithm is called an asymmetric encryption algorithm.
The basic process of asymmetric encryption algorithm to realize the exchange of confidential information is: Party A generates a pair of keys and discloses one of them as a public key to other parties; Party B who obtains the public key uses the The key encrypts the confidential information and then sends it to Party A; Party A then uses another private key kept by itself to decrypt the encrypted information. Party A can only use its private key to decrypt any information encrypted by its public key.
The difference between symmetric encryption and asymmetric encryption
1. Different encryption and decryption processes
Symmetric encryption uses the same encryption process and decryption process. A key, the encryption process is equivalent to using the original text key to transmit the ciphertext, and the decryption process uses the ciphertext-key to deduce the original text.
But asymmetric encryption uses two keys. Generally, the public key is used for encryption and the private key is used for decryption.
2. Different encryption and decryption speeds
Symmetric encryption and decryption are faster and suitable for long-term data use. Asymmetric encryption and decryption take a long time, are relatively slow, and are only suitable for use with small amounts of data.
3. Different transmission security
During the symmetric encryption process, it is impossible to ensure that the key is transmitted safely, and the ciphertext may be If the password is intercepted by a third party, if the codebook is also intercepted by a third party, the transmitted password information will be cracked by the third party, and the security is relatively low.
In the asymmetric encryption algorithm, the private key generates different random numbers based on different algorithms. The private key derives the public key through a certain encryption algorithm, but the derivation process from the private key to the public key is one-way. In other words, the public key cannot be deduced from the private key. So the security is higher.
If you want to read more related articles, please visitPHP Chinese website! !
The above is the detailed content of What is the difference between symmetric encryption and asymmetric encryption. For more information, please follow other related articles on the PHP Chinese website!