## RSA

RSA is an asymmetric algorithm and is attributed to three people but reading this article will explain who developed the algorithm years earlier. When reading this article, try to understand the section on key generation, encrypting messages, decrypting messages, and signing messages. Most importantly, note the speed of RSA in comparison to DES that was discussed in the section on symmetric key encryption. Also note how attacks such as man-in-the-middle and RSA blinding attacks can be avoided.

Finding the large primes *p* and *q* is usually done by testing random numbers of the right size with probabilistic primality tests which quickly eliminate most non-primes. If such a test finds a "probable prime", a deterministic
test should then be used to verify that the number is indeed prime.

*p* and *q* should not be 'too close', lest the Fermat factorization for *N* be successful. Furthermore, if either *p*-1 or *q*-1 has only small prime factors, *N* can be factored
quickly and these values of *p* or *q* should therefore be discarded as well.

One should not employ a prime search method which gives any information whatsoever about the primes to the attacker. In particular, a good random number generator for the start value needs to be employed. Note that the requirement here is both 'random' * and* 'unpredictable'.
These are not the same criteria; a number may have been chosen by a random process (i.e., no pattern in the results), but if it is predictable in any manner (or even partially predictable), the method used will result in loss of security. For
example, the random number table published by the Rand Corp in the 1950s might very well be truly random, but it has been published and thus can serve an attacker as well. If the attacker can guess half of the digits of

*p*or

*q*, they can quickly compute the other half (shown by Coppersmith in 1997).

It is important that the secret key *d* be large enough. Wiener showed in 1990 that if *p* is between *q* and 2*q* (which is quite typical) and *d* < *N*^{1/4}/3,
then *d* can be computed efficiently from *N* and *e*. The encryption key *e* = 2 should also not be used.