Two kinds of keys
Symmetric key encryption, also known as private key encryption or session key encryption algorithm, means that the sender and receiver of information use the same key to encrypt and decrypt data. Its biggest advantage is its fast encryption/decryption speed, which is suitable for encrypting a large number of data, but the key management is difficult.
Asymmetric key encryption system, also known as public key encryption. It needs to use different keys to complete encryption and decryption operations, one is publicly released, that is, the public key, and the other is privately kept by the user himself, that is, the private key. The sender of information uses public key encryption, while the receiver of information uses private key decryption. The public key mechanism is flexible, but the speed of encryption and decryption is much slower than that of symmetric key encryption.
Therefore, in practical applications, people usually use them together. For example, a symmetric key encryption system is used to store a large amount of data information, while a public key encryption system is used to encrypt keys.
Please edit this paragraph for details.
For ordinary symmetric encryption, the encryption operation and decryption operation use the same key. The commonly used symmetric encryption algorithm is simple and efficient, with short key and extremely difficult to decipher. Because the security of the system mainly depends on the security of the key, it is a serious problem to transmit and save the key safely on the open computer network. Because both parties use the same key in symmetric cryptography, data signature and undeniable function cannot be realized.
Since 1970s, some scholars have proposed public key system, that is, using the mathematical principle of one-way function to realize the separation of encryption and decryption keys. The encryption key is public and the decryption key is confidential. This new cryptosystem has attracted extensive attention and discussion in the field of cryptography.
Unlike ordinary symmetric encryption technology, which uses the same key to encrypt and decrypt data, asymmetric key encryption technology uses a pair of matching keys to encrypt and decrypt data, and has two keys, one is a public key and the other is a private key. They have the characteristic that each key performs one-way data processing, and each key has the opposite function to the other. When one key is used for encryption, the other key is used for decryption. Files encrypted with public key can only be decrypted with private key, and files encrypted with private key can only be decrypted with public key. The public key is made public by its owner, while the private key must be kept secret. In order to send a confidential message, the sender must use the public key of the receiver to encrypt the data. Once encrypted, only the receiver can decrypt it with his own private key. Conversely, users can also process data with their own private keys. In other words, the key pair can work in any direction. This provides the basis of "digital signature". If a user uses his own private key to process data, others can use the public key he provides to process data. Because only the owner knows the private key, the processed message forms an electronic signature-a file that no one else can generate. A digital certificate contains public key information to confirm the identity of the user who owns the key pair.
A simple example of a public key can be represented by a prime number. The algorithm of multiplying prime numbers is used as the public key, and the algorithm of decomposing product into original prime numbers is used as the private key. Encryption is to add the prime number to the information to be transmitted when encoding, and then transmit it to the receiver after encoding. After anyone receives this information, if there is no private key owned by the receiver, the process of decryption (actually the process of finding prime numbers) will be delayed because of the process of finding prime numbers (decomposing prime factors).