Well there is slightly more to it than this. The public key is the modulus
n and a computationally favourable exponent
e. The private key is
d, the inverse of
e mod
(p-1)*(q-1) (and of course
n). It is important to make
n as nasty as possible. This is done by choosing
p and
q to be of similar size and for them both to be
strong primes. There are a few views on this but if
p-1 has a large prime factor (and the same for
q-1) then a few attacks are thwarted.
p and
q can be discarded but in general they are stored with the private key (along with a few precalculated helper values) so that exponentiation by
d can be performed efficiently.
e is usually 65537 for X509 certificates (https/SSL) and typically n is 1024 or 2048 bits.