Diffie-Hellman Encrypted Key Exchange

Diffie-Hellman Encrypted Key Exchange is often abbreviated to DH-EKE. It's one of the original EKE protocols based on Diffie-Hellman Key Exchange.

How It Work

Suppose we have two parties, Alice and Bob, want to build a secure communication via an established insecure channel. Eve is a attackers who is enable to eavesdrop all the messages on the channel.

Assume that Alice and Bob possess the same password pwdpwd, which is not leaked out and only they both know it. Therefore, this password can be used as a key for authentication. If we use this key to encrypt the data, only the one who knows the key can decrypt it. Some attackers without key are unable to pretend themselves as Alice or Bob. Nevertheless, the password is usually a human-memorable weak password. It will be easily cracked by performing an exhaustive search if its bits is too short. To make sure the shared key ss is long enough, we use the hash value of the password as the key instead. Thus, the shared secret key s=hash(pwd) s = hash(pwd)

Basic Concept

DH-EKE

The basic idea is to use the shared secret key ss to protect the public key swap of Diffie-Hellman Key Exchange. Only the one who possess the key ss can encrypt and decrypt the public keys. They still can derive a symmetric session key $k$ on both sides for conversation.

With Challenge–Response Authentication

In fact, the DH-EKE is integrated by Diffie-Hellman and challenge–response authentication. The challenge is presented by one party, and another party must reply a correct answer to be authenticated.

DH-EKE-1

The first step of DH-EKE is very similar to DH. Alice picks a random number a[1,p1]a \in [1, p-1] as her private key and use it to generate a public key: Aga(modp) A \equiv g^a \pmod p .

Then she sends the encrypted value of the public key: Aenc=Encs(A) A_{enc} = Enc_s(A) to Bob.

After receiving AencA_{enc}, Bob gets Alice's public key AA by decrypting AencA_{enc}. A=Decs(Aenc) A = Dec_s(A_{enc})

Then Bob picks a random number b[1,p1]b \in [1, p-1] as his private key to compute a session key: kAbgab(modp) k \equiv A^b \equiv g^{ab} \pmod p for encryption in this communication.

DH-EKE-2

Next, Bob generates his public key Bgb(modp)B \equiv g^b \pmod p and a random challenge challengeBobchallenge_{Bob}. The challengeBobchallenge_{Bob} is then encrypted by the session key kk into a value CBobC_{Bob}. CBob=Enck(challengeBob) C_{Bob} = Enc_k(challenge_{Bob})

Then, Bob encrypts his public key BB with CBobC_{Bob} into BencB_{enc} by ss and sends it to Alice. Benc=Encs(B,CBob) B_{enc} = Enc_s(B, C_{Bob})

Alice decrypts the received BencB_{enc} to get Bob's public key BB and CBobC_{Bob}. B,CBob=Decs(Benc) B, C_{Bob} = Dec_s(B_{enc})

Then, Alice can compute a same session key kk as Bob by her own private key, kBagab(modp) k \equiv B^a \equiv g^{ab} \pmod p .

DH-EKE-3

After Alice has kk, she can use it to decrypt CBobC_{Bob} to get challengeBobAlicechallenge^{Alice}_{Bob}. The challengeBobAlicechallenge^{Alice}_{Bob} here represents that Alice's decoded value of Bob's challenge. challengeBobAlice=Deck(CBob) challenge^{Alice}_{Bob} = Dec_k(C_{Bob})

Next, Alice randomly generates her own challenge challengeAlicechallenge_{Alice} and then use it to encrypt with Bob's challenge challengeBobchallenge_{Bob} into a value CmixC_{mix} by the session key kk Cmix=Enck(challengeAlice,challengeBobAlice) C_{mix} = Enc_k(challenge_{Alice}, challenge^{Alice}_{Bob})

Then, Alice sends CmixC_{mix} to Bob.

DH-EKE-4

Later, Bob decrypts the CmixC_{mix} to output challengeAliceBobchallenge^{Bob}_{Alice} and challengeBobAlicechallenge^{Alice}_{Bob}. The challengeAliceBobchallenge^{Bob}_{Alice} here represents that Bob's decoded value of Alice's challenge. challengeAliceBob,challengeBobAlice=Deck(Cmix) challenge^{Bob}_{Alice}, challenge^{Alice}_{Bob} = Dec_k(C_{mix})

In this step, Bob can authenticate Alice is valid or not by checking her decoded value of his own challenge, challengeBobAlicechallenge^{Alice}_{Bob}. valid(Alice)={true,if challengeBobAlice=challengeBobfalse,otherwise valid(Alice) = \begin{cases} true, & \text{if } challenge^{Alice}_{Bob} = challenge_{Bob} \\[2ex] false, & \text{otherwise} \end{cases}

If Alice is invalid, then Bob drops the session. Otherwise, Bob continue the protocols.

Next, Bob needs to prove his identification to Alice. He encrypts challengeAliceBobchallenge^{Bob}_{Alice} into CAliceC_{Alice} CAlice=Enck(challengeAliceBob) C_{Alice} = Enc_k(challenge^{Bob}_{Alice}) and send it to Alice.

After receiving CAliceC_{Alice}, Alice decrypts it to get Bob's decode value of her own challenge: challengeAliceBob=Deck(CAlice) challenge^{Bob}_{Alice} = Dec_k(C_{Alice})

Alice now is also able to authenticate Bob: valid(Bob)={true,if challengeAliceBob=challengeAlicefalse,otherwise valid(Bob) = \begin{cases} true, & \text{if } challenge^{Bob}_{Alice} = challenge_{Alice} \\[2ex] false, & \text{otherwise} \end{cases}

Similarly, if Bob is invalid, then Alice drops the session. Otherwise, the protocol finishes.

Finally, Alice and Bob authenticate mutually and they both have a same session key kk that can be used for encryption or decryption.

Summary

  1. Alice generates a private-public key pair and sends the encrypted public key to Bob
    1. Alice picks a random number a[1,p1]a \in [1, p-1] as her private key
    2. Alice generates a public key Aga(modp)A \equiv g^a \pmod p
    3. Alice encrypts her public key by shared secret key ss
    4. Alice sends Aenc=Encs(A)A_{enc} = Enc_s(A) to Bob.
  2. Bob generates a private-public key pair and random challenge, computes the symmetric session key by his private key, and then sends the encrypted public key with the challenge to Alice
    1. Bob decrypts AencA_{enc} to get Alice's public key AA by shared secret key ss
    2. Bob picks a random number b[1,p1]b \in [1, p-1] as his private key
    3. Bob computes a session key kAbgab(modp)k \equiv A^b \equiv g^{ab} \pmod p
    4. Bob generates a public key Bgb(modp)B \equiv g^b \pmod p
    5. Bob randomly generates a challengeBobchallenge_{Bob}
    6. Bob encrypts challengeBobchallenge_{Bob} to CBobC_{Bob} by kk
    7. Bob sends Benc=Encs(B,CBob)B_{enc} = Enc_s(B, C_{Bob}) to Alice.
  3. Alice get Bob's public key and challenge, computes the symmetric session key by her private key, then generates her random challenge and send Bob's challenge back with her own one for authentication
    1. Alice decrypts the received BencB_{enc} to get B,CBobB, C_{Bob} by shared secret key ss
    2. Alice computes a session key kBagab(modp)k \equiv B^a \equiv g^{ab} \pmod p
    3. Alice decrypts CBobC_{Bob} to get Bob's challenge challengeBobchallenge_{Bob} by kk
    4. Alice randomly generates a challengeAlicechallenge_{Alice}
    5. Alice encrypts challengeAlice,challengeBobchallenge_{Alice}, challenge_{Bob} to CmixC_{mix} by kk
    6. Alice sends Cmix=Enck(challengeAlice,challengeBob)C_{mix} = Enc_k(challenge_{Alice}, challenge_{Bob}) to Bob
  4. Bob authenticates Alice by checking his own challenge with the received one
    1. Bob decrypts the received CmixC_{mix} to get challengeAlice,challengeBobchallenge_{Alice}, challenge_{Bob} by kk
    2. Bob checks whether or not the received challengeBobchallenge_{Bob} is same as his original one
    3. Alice is authenticated if the answer is yes. Otherwise, drops session.
    4. Bob encrypts the received challengeAlicechallenge_{Alice} to CAliceC_{Alice} by kk
    5. Bob sends CAlice=Enck(challengeAlice)C_{Alice} = Enc_k(challenge_{Alice})
  5. Alice authenticates Bob by checking his own challenge with the received one
    1. Alice decrypts the received CAliceC_{Alice} to get challengeAlicechallenge_{Alice} by kk
    2. Alice checks whether or not received challengeAlicechallenge_{Alice} is same as her original one
    3. Bob is authenticated if the answer is yes. Otherwise, drops session.

Security Issues

Short Exponents

The packets are transmitted byte-by-byte, so its size of bits must be 8's multiple(1 byte = 8-bits). Thus, if the modulo pp is nn bits, then the group must nn bits. The private key, the public key are all nn bits.

Therefore, if n8kn \neq 8 \cdot k, where kNk \in N, then some of bits are predictable. They must be 0. For example, if p=263=10716=00000001000001112p = 263 = 107_{16} = 0000000100000111_{2}, then we know the range of the group is [1,262][1, 262] and the data is 2-bytes. The first 7 bits in the first byte are all 0 because the elements in the group are smaller than 000000010000011120000000100000111_{2}.

References

Encrypted Key Exchange: Password-based Protocols Secure Against Dictionary Attacks

results matching ""

    No results matching ""