Current location - Quotes Website - Personality signature - What are the characteristics of symmetric key system and public key key system? What are the advantages and disadvantages of each
What are the characteristics of symmetric key system and public key key system? What are the advantages and disadvantages of each

The symmetric key system is that the encryption key and decryption key have the same password, and the two participants share the same key.

Public key cryptography uses different encryption keys and decryption keys. The encryption key is public information, while the decryption key needs to be kept secret.

Public key cryptography has many good characteristics. It can not only be used for encryption, but also can be easily used for authentication and digital signatures. But public key cryptography algorithms are orders of magnitude slower than symmetric key cryptography algorithms.

The symmetric key system has fast encryption and decryption speed and high security strength, but the key is difficult to manage and transmit, and is not suitable for use alone in the network.

Key generation

1. Select two large prime numbers, p and q.

2. Calculation: n = p * q (p and q are two different large prime numbers respectively. p and q must be kept secret. Generally, p and q are required to be safe prime numbers and the length of n is greater than 512 bits. , this is mainly because the security of the RSA algorithm relies on factoring large numbers). There is Euler function (n)=(p-1)(q-1).

3. Then randomly select the encryption key e, requiring that e and (p - 1) * (q - 1) are relatively prime.

4. Finally, use the Euclid algorithm to calculate the decryption key d, which satisfies de≡1(modφ(n)). Among them, n and d must also be relatively prime. The numbers e and n are public keys, and d is the private key. The two prime numbers p and q are no longer needed and should be discarded without anyone knowing about them.