But imagine the following situation. Suppose you have a special method of encoding and decoding that is ``one way'' in a sense. Imagine that the encoding is easy to do, but decoding is very difficult. Then anyone in the world can encode a message, but only one person can decode it. Such methods exist, and they are called ``one way ciphers'' or ``trap door ciphers''.
Here's how they work. For each cipher, there is a key for encoding and a different key for decoding. If you know the key for decoding, it is very easy to make the key for encoding, but it is almost impossible to do the opposite--to start with the encoding key and work out the decoding key.
So to communicate with your friend in Europe, each of you has a
trap door cipher. You make up a decoding key
and generate
the corresponding encoding key
. Your friend does exactly
the same thing, but he makes up a decoding key
and generates
the corresponding encoding key
. You tell him
(but not
) and he tells you
(but not
). Then you can
send him messages by encoding using
(which only he can decode)
and vice-versa--he encodes messages to you using
(which
only you can decode, since you're the only person with access to
).
Now if you want to change to a new key, it is no big problem. Just make up new pairs and exchange the encoding keys. If the encoding keys are stolen, it's not a big deal. The person who steals them can only encode messages--they can't decode them. In fact, the encoding keys (sometimes called ``public keys'') could just be published in a well-known location. It's like saying, ``If you want to send me a private message, encode it using this key, and I will be the only person in the world who can read it.'' But be sure to keep the decoding key (the ``private key'') secret.