Public and secret keys are created as follows:

- 1.
- Select at random two large prime numbers p and q (say >100 decimal digits each).
- 2.
- Compute n = pq.
- 3.
- Select a small odd integer e that is relatively prime to = (p-1)(q-1).
- 4.
- Compute d =
*e*^{-1}mod (n) (multiplicative inverse). - 5.
- Publish pair P = (e, n) as RSA Public Key.
- 6.
- Keep pair S = (d, n) as RSA Secret Key.
- 7.
- P(M) =
*M*^{e}(mod n) - 8.
- S(C) =
*C*^{d}(mod n)