# The RSA Public-Key Encryption Algorithm

### mod using private primes

**Definition:** The RSA is one of the popular public-key encryption algorithms.

Rivest et al published a method for obtaining digital signatures and public-key cryptosystems in 1978. In order to use the method, the encryption and decryption keys must be chosen as follows:

- Compute
*n*as the product of two primes*p*and*q: n = p×q.*These two primes are very large and randomly selected primes. - Compute
*f*(*n*) = (*p*–1)(*q*– 1). - Select
*e*such that*e*is relatively prime to*f*(*n*). - Select
*d*such that*e×d*= 1 mod (*f*(*n*)), where mod stands for modular operation. - Choose (
*e, n*) as the public key. - Choose (
*d, n*) as the private key.

In encryption and decryption, receiver‘s public key ( *e R ,n R* ) and private key ( *d R , n R* ) are used. Encryption is carried out by using *m e* = *m e R* mod *n R ,* where *m* is the plaintext and *m c* is the ciphertext. Decryption is carried out by using *m* = ( *m d R* ) *dR* mod *n R .*

For authentication, sender‘s public key ( *e s* , *n s* ) and private key ( *d s* , *n s* ) are used. The signature is generated by using *m c = m ds* mod *n s .* The signature is authenticated by using *m* = ( *m e ) e s* mod *n s .*

## User Comments