Add the file rsatools.R
to the R
subdirectory of your project. This file includes
functions for converting between strings and big integers.
Implement FermatTest
as specified, to carry out the
Fermat Primality Test ([T] p. 177).
Implement makeRSAkey
as specified, to generate a
random 2048-bit RSA modulus. The primes \(p\) and \(q\) should both be large (at least 1000
bits). Your choice of \(n = pq\) should
be immune to the Fermat factorization attack, so \(p-q\) should be at least a googol (\(10^{100}\)). Furthermore, it should be
immune to the quadratic sieve attack, so check that \(p-1\) and \(q-1\) do not have only small (<100)
prime factors. The gmp
functions urand.bigz
,
isprime
, and nextprime
may be helpful. Each
time the function is called, it should produce a new random RSA key.
(No, you can’t use the openssh
package, or
similar.)