A special characteristic of the RSA cryptosystem is that extensive calculations are necessary to generate the RSA key before RSA encryption or decryption can take place. First of all the RSA parameters p, q, N and the Euler number phi(N) are calculated:
Choose two different prime numbers p and q at random and calculate the so-called RSA modulus N = pq. The Euler number phi(N) = (p-1)*(q-1) is calculated from the prime factors p and q.
In a second step, the public RSA exponent e is determined and from this together with phi(N) the secret RSA exponent d is calculated:
Choose the number e: 1 < e < phi(N), with the property that e is relatively prime to phi(N)
An especially popular value for e is 2^16+1 = 65537, as in most cases this is co-prime to phi(N) and is especially well-suited for square and multiply exponentiation resulting in a very fast public key operation.
The secret exponent d = e^(-1) mod phi(N) is calculated from the public exponent e as the multiplicative inverse modulo phi(N).
Further explanatory material can be found in the script, which is part of the CrypTool documentation.
In the dialog "The RSA Cryptosystem" you can enter the prime numbers p and q directly. If you do not enter any prime numbers for p or q, an error message will be displayed. By clicking on the Generate prime numbers button, you can search for random prime numbers from within specified number intervals. The Update parameters button is used to calculate the secret exponent d from e and phi(N) as described above. If e is not co-prime to phi(N), an error message will be displayed, asking you to choose a new number for the public exponent e.
After successful generation of the RSA key, the asymmetric RSA key pair is displayed:
(N,e) is the public key and
(N,d) is the secret key.
An RSA key bit length is calculated from the number of bits of the binary representation of the RSA modulus N.
After the key has been generated, anyone can encrypt a message with the RSA algorithm using the public key (N,e), but only the owner of the secret key (N,d) can decrypt the message again with the RSA algorithm.