RSA is the most representative method among public key cryptosystems, proposed by Rivest, Shamir, and Adelman in 1978. The RSA system uses the Integer Factorization Problem (IFP), which involves factoring a composite number into its prime factors. In the encryption process, two prime numbers of more than a hundred digits are selected, and their product is calculated to become a very large composite number, making it very difficult to factorize without knowing the two prime numbers.
-
In the RSA system, the public and private keys are generated as follows:
- Choose two prime numbers and , each with more than a hundred digits, and calculate .
- Choose an that is coprime to .
- Calculate such that .
- Publish and and keep as the private key. (: Public key, : Private key)
-
The method for a sender to deliver an encrypted message to a receiver is as follows:
- The sender calculates the ciphertext using the receiver’s public key and sends the ciphertext to the receiver.
- The receiver can restore the plaintext by calculating using .
-
Decryption process:
- Since , they are multiplicative inverses, which means for any integer , can be expressed.
- Applying the decryption process to the ciphertext gives the following (assuming ):
[ C^{K_d} \equiv (M^{K_e})^{K_d} \pmod{n} \ \qquad \equiv M^{t\phi(n) + 1} \pmod{n} \ \qquad \equiv (M^{\phi(n)})^t \cdot M \pmod{n} \ \qquad \equiv 1^t \cdot M \pmod{n} \ \qquad \equiv M \pmod{n} ]
Example
When and , the encryption of the message “HI” through the RSA system is as follows.
-
Key Generation
- Select the public key:
- Private key:
-
Encryption
- Convert each character of the message “HI” to numbers → “H”: 8, “I”: 9
- Calculate the ciphertext →
-
Decryption
Calculate →