Let's take a look at authentication.
That is, Alice needs to prove to Bob that she's really Alice, and vice versa.
Meaning that Bob needs to prove to Alice that he is Bob.
Suppose that Alice and Bob share a secret key, KAB.
That is, only Bob and Alice know this key, KAB.
Here's an authentication protocol using symmetricartography.
First Alice says to Bob, hey I'm Alice.
Second, Bob said to Alice, really?
Prove it.
And he sends a random value R1, which we will call a challenge.
Third, Alice then encrypts R1 using the shared key KAB.
And sends Bob the cybertext, which we'll call it the response to the challenge.
When Bob receives the response, he decrypts it and
see if it matches the plain text, R1 that he just sent to Alice.
If it matches, then he knows that the party that he's communicating with must
be Alice, because R then, himself, only Alice knows the shared key KAB.
And without KAB, R1 cannot be encrypted properly.
That is the server text that he receives won't be decrypted properly to R1.
Fourth, now it is Alice's turn to authenticate Bob.
So, similarly, she sends Bob a random challenge, R2.
Fifth, Bob encrypts R2 with the shared key KAB and sends a cyber text to Alice.
Upon receiving the response from Bob, Alice decrypts the cyber text and
if the result matches the plain text R2 that she just sent to Bob,
then she knows that the party that she's communicating with must be Bob.
Note that if only one-way authentication is required, for
example, Alice is a client and needs to authenticate to Bob,
which is a server, but Bob does not need to authenticate to Alice,
then only the first three steps are necessary.
And if Alice is a human user, then typically the key KAB
can be derived from a password hash, which is known to Bob.
We just discussed how challenge and response are used in authentication.
It is very important for the challenges, say R1 and R2,
to be not easily repeatable or predictable.
Otherwise an intruder such as Trudy can record the challenge and
response between Alice and Bob and replay them to impersonate Alice or Bob.
For example,
an intruder called Trudy wants to impersonate either Alice or Bob.
Suppose Trudy has spent time recording
the authentication messages between Alice and Bob across multiple sessions.
Now, if when Trudy tries to impersonate Alice and Bob happens to send R1,
a challenge that has been used previously and recorded by Trudy, then
Trudy can just simply send the response that she has recorded from Alice.
That is, Trudy is able to send the cyber text of R1 to Bob and
Bob will be tricked to believe that she is Alice.
As another example, suppose the challenges always increase in values.
Then Trudy can first impersonate Bob and send a large challenge,
say R1 equal to 1000, and record the response from Alice.
Meanwhile, the real Bob is using a smaller R1,
say R1 equal to 950, then Trudy can impersonate Alice some time in
the future when the real Bob finally sends R1 equal to 1,000.
To recap, first of all, the messages that were sent over
the Internet can be captured by intruder Trudy.
And our job is to prevent these messages being replayed so
that Trudy can't impersonate Alice and Bob.
And in order to do that, the random challengers R1 and
R2 should really be not easily repeatable or predictable.
Again, the most important precaution of using this authentication protocol
is that R1 and R2 should not be easily repeatable or predictable.
Otherwise an intruder such as Trudy can impersonate Alice and
Bob by simply doing record and replay.
Therefore, R1 and R2 should be large, random values.
Another security precaution is that the shared secret key,
KAB, needs to be protected.
Because if Trudy can steal a copy of the key,
let's say from one of the complication end points either on Alice or
Bob, then she can impersonate either Alice or Bob.
In other words, the security of the end points is
as important as the security of the link between the two end points.