In RSA encryption, a user generates a pair of keys: a public key and a private key. The public key is shared openly, while the private key is kept secret. Messages encrypted with the public key can only be decrypted with the corresponding private key, solving the key distribution problem.