RSA Encryption Algorithm
An RSA key pair consists of a Private Key and a Public Key. The RSA algorithm is commonly used for digital signature verification and key exchange problems. The Public Key is used to encrypt data, while the Private Key is used to decrypt encrypted data. The RSA Public Key generation algorithm is based on the difficulty of integer factorization computations. The general problem is to find all prime factors of a given number . When is sufficiently large and is the product of a few large prime numbers, these computations are considered hard to solve. For RSA, typically has at least 512 bits and is the product of two large prime numbers. Locker uses RSA-2048, which has 617 decimal digits (2,048 bits) and is the largest among RSA numbers. RSA-2048 is likely to remain unfactorable for many years to come, unless there are significant advances in integer factorization or computational power in the near future. The RSA key pair is generated through the following steps:- Choose 2 prime numbers and .
- and should be of similar magnitude and length to resist brute-force attacks.
- Compute
- Compute the Carmichael function . However, since and are prime,
- where is the least common multiple of two numbers.
- Choose an integer such that and , where is the greatest common divisor of two numbers.
- Find as the modular inverse of modulo , i.e.,
- The Public Key is the pair , and the Private Key is .