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:

    1. Choose two prime numbers and , each with more than a hundred digits, and calculate .
    2. Choose an that is coprime to .
    3. Calculate such that .
    4. 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:

    1. The sender calculates the ciphertext using the receiver’s public key and sends the ciphertext to the receiver.
    2. The receiver can restore the plaintext by calculating using .
  • Decryption process:

    1. Since , they are multiplicative inverses, which means for any integer , can be expressed.
    2. 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

    1. Select the public key:
    2. Private key:
  • Encryption

    1. Convert each character of the message “HI” to numbers → “H”: 8, “I”: 9
    2. Calculate the ciphertext
  • Decryption

Calculate