# Authentication and integrity

I was trying to solve this problem:

Sometimes Alice needs to send a file to Bob, guaranteeing her identity and the file integrity (no confidentiality required); the two parties are sharing a secret w and make use of a hash function $H$ that outputs 40-bit numbers and a symmetric encryption $E$. Each time they use the following (pre-agreed) protocol.

A → B: $E_w(nA)$, where $nA$ is a nonce (Alice sends a challenge).

B → A: $E_w(nA+1)$ (Bob proves he knows the secret, providing response to challenge).

A → B: $(F, H(F),E_w(H(F)))$ (Bob, given $F$, computes $H(F)$ and $E_w(H(F))$, and then compare his results to data actually received)

**1.Show how an attacker can act in place of Alice and send a file to Bob tricking him into believing that the file is coming from Alice.

2.Fix the protocol without significantly perturbing it too.**

*My answer to 1: The attacker can do Man in the middle attack. Suppose Trudy impersonates Bob's network address. 1.Alice sends w{nA} to Trudy. 2.Trudy sends w{nA} to Bob. 3.Now Bob will send w{nA+1} to Trudy, which she will use it to send it to Alice. 4.After Trudy sends w{nA+1}, Alice will send (F, H(F),w{H(F)}) to Trudy, thinking she is Bob because she proved her that she is Bob.

Scheme:

1. A → T: $E_w(nA)$

2. T → B: $E_w(nA)$

3. B → T: $E_w(nA+1)$

4. T → A: $E_w(nA+1)$

5. A → T: $(F, H(F),E_w(H(F)))$

Is my answer to question 1 correct? How do I solve the 2nd question?

Best Regards.

• What exactly does w{nA} mean? Is it multiplication on an elliptic curve? Also your solution seems to inpersonate Bob instead of Alice. Jun 27, 2018 at 11:31
• w is the secret shared between Alice and Bob , nA is the nonce used as a challenge by Alice. w{nA} is encryption of nonce nA by the secret key. Jun 27, 2018 at 12:08