Skip to main content Link Search Menu Expand Document (external link)

RSA (Rivest-Shamir-Adleman)

Overview

RSA is a public-key cryptosystem used for secure data transmission and digital signatures. Developed in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman, RSA is based on the mathematical difficulty of factoring the product of two large prime numbers.

1. Key Generation

  1. Choose Two Large Prime Numbers:
    • Select two large primes, ( p ) and ( q ).
  2. Compute Their Product:
    • Calculate ( n = p \times q ). This number ( n ) is used in both the public and private keys.
  3. Calculate the Totient:
    • Compute ( \phi(n) = (p-1) \times (q-1) ), where ( \phi ) is the Euler’s totient function.
  4. Choose a Public Exponent:
    • Select ( e ) such that ( 1 < e < \phi(n) ) and ( e ) is coprime with ( \phi(n) ). Common choices are 3 or 65537.
  5. Compute the Private Exponent:
    • Determine ( d ) such that ( d \times e \equiv 1 \mod \phi(n) ).
  6. Construct the Keys:
    • Public Key: ( (n, e) )
    • Private Key: ( (n, d) )

2. Encryption and Decryption

  1. Encryption:
    • Convert the plaintext message ( M ) to an integer ( m ) (where ( 0 \leq m < n )).
    • Compute the ciphertext ( C ) using ( C = m^e \mod n ).
  2. Decryption:
    • Compute ( m = C^d \mod n ).
    • Convert ( m ) back to the original message ( M ).

3. Digital Signatures

  1. Signing:
    • Compute a hash of the message ( M ).
    • Convert the hash to an integer ( m ) (where ( 0 \leq m < n )).
    • Compute the signature ( S ) using ( S = m^d \mod n ).
  2. Verification:
    • Compute ( m’ = S^e \mod n ).
    • Compute the hash of the original message ( M ).
    • Compare ( m’ ) with the computed hash to verify the signature.

4. Key Features

  1. Public-Key Cryptography:
    • RSA uses asymmetric key pairs: a public key for encryption and a private key for decryption.
  2. Encryption and Decryption:
    • Public key encryption allows secure communication. Only the private key can decrypt the message.
  3. Digital Signatures:
    • RSA enables the creation and verification of digital signatures, ensuring message authenticity and integrity.
  4. Key Size and Security:
    • RSA provides strong security with large key sizes. Common key lengths are 2048 bits and 3072 bits.
  5. Wide Adoption and Compatibility:
    • RSA is used in various security protocols, including SSL/TLS and email encryption.
  6. Encryption Algorithms:
    • RSA uses padding schemes (e.g., PKCS#1) to prevent attacks and ensure secure encryption.
  7. Performance Considerations:
    • RSA operations are computationally intensive, especially with large key sizes. Often used in conjunction with symmetric encryption for better performance.
  8. Flexibility in Key Management:
    • Public key can be openly shared, while private key remains confidential. Simplifies key distribution compared to symmetric systems.
  9. Mathematical Foundation:
    • Based on the difficulty of factoring large composite numbers.
  10. Adaptability:
    • RSA can be adjusted for various security needs by changing key lengths and padding schemes.

5. Advantages

  1. Security: RSA’s security is based on the difficulty of factoring large composite numbers, making it robust if key sizes are appropriately large.

  2. Versatility: RSA is used for both encryption and digital signatures.

  3. Wide Adoption: RSA is supported by many systems and protocols, making it a standard choice for secure communication.

6. Disadvantages

  1. Performance: RSA operations are slower compared to symmetric-key algorithms due to large key sizes.

  2. Key Size: Requires large key sizes to ensure strong security, leading to higher computational overhead.

  3. Not Ideal for Modern Devices: Performance issues can arise on devices with limited computational power.

  4. Vulnerabilities: RSA can be vulnerable to certain attacks if not properly implemented, necessitating the use of secure padding schemes.

Summary

RSA is a foundational cryptographic algorithm that provides secure encryption and digital signatures using public and private keys. It is renowned for its security and versatility but has limitations in performance and key size. RSA remains a reliable and widely adopted choice in the field of cryptography, though modern systems may use additional algorithms to complement RSA’s functionality.