Current location - Quotes Website - Signature design - This paper briefly introduces the generation of RSA system key and its encryption and decryption algorithms.
This paper briefly introduces the generation of RSA system key and its encryption and decryption algorithms.
Generation of RSA system key;

1. Choose two big prime numbers, p and q.

2. calculation: n = p * q (p and q are two different big prime numbers and must be kept secret. Generally, P and Q are required to be safe prime numbers, and the length of N is greater than 5 12bit, mainly because the security of RSA algorithm depends on the factorization of large numbers). There is Euler function (n)=(p- 1)(q- 1).

3. Then the encryption key E is randomly selected, and it is required that E and (p- 1) * (q- 1) are prime numbers.

4. Finally, use Euclid algorithm to calculate the decryption key D, which satisfies de≡ 1(mod φ(n)). Where n and d are also coprime. Numbers e and n are public keys and d is private key. Two prime numbers, P and Q, are no longer needed and should be discarded so that no one knows.

Encryption and decryption algorithm:

1. When encrypting information m (binary representation), first divide m into equal-length data blocks m 1, m2, ..., mi, with block length of s, where 2 s.

2. The corresponding ciphertext is: ci ≡mi^e (mod n) (a (a).

3. The following calculation is made during decryption: m ≡ ci d (mod n) (b) RSA can be used for digital signature, and the scheme is to use (a) signature and (b) verification.