How shall we accomplish our collection of goals? We have
examined all the building blocks in this tutorial; let's put
them together.
Suppose that Alice wishes to send a private
message to Bob, and that she has obtained Bob's public key
in a way that reliably links Bob to that key. Let's call
Bob's public key PUB_B. Further, let us refer to RSA
encryption by the name E_RSA, and to our favorite fast and
secure symmetric key algorithms as E_SYM. While we are at
it, let us call our favorite pseudo-random number generator
PRN. For Alice's message M that she wishes to send to
Bob, she calculates and sends:
[ E_RSA{PUB_B}(PRN), E_SYM{PRN}(M) ]
That is to say, Alice: (1) Generates a pseudo-random
"session key," which is of a moderate length (e.g. 64,
96, or 128 bits); (2) Encrypts the moderate-sized session
key using (slow) RSA encryption and Bob's public key; (3)
Encrypts the longer plain text M using a fast symmetric
algorithm. Only a little bit of encryption with RSA is
necessary: Bob is able to recover the session key because
he has his own private key for RSA. And Bob is able to
recover M because the protocol specifies the symmetric
algorithm used to encrypt it once the session key is known.
We obtain the advantage of RSA in avoiding a requirement
for externally-secured key exchange, and we also obtain the
speed advantages of symmetric algorithms.