Devil's Night

AKE — Authenticated Key Exchange

by FOX on 10:37 PM, under Encryption

In my previous post, there is a high level overview about how OTR works. It mentions about AKE system. Today I am gonna show you how AKE works

Assume that Alice and Bob are going to implement AKE, The general idea is that Alice and Bob do an unauthenticated Diffie-Hellman (D-H) key exchange to set up an encrypted channel, and then do mutual authentication insidethat channel.

All exponentiations are done modulo a particular 1536-bit prime, and g is a generator of that group, as indicated in the detailed description below. Alice and Bob’s long-term authentication public keys are pubA and pubB, respectively.

Bob will be initiating AKE with Alice

  • Bob:
    1. Picks a random value r (128 bits)
    2. Picks a random value x (at least 320 bits)
    3. Sends Alice AESr(gx), HASH(gx)
  • Alice:
    1. Picks a random value y (at least 320 bits)
    2. Sends Bob gy
  • Bob:
    1. Verifies that Alice’s gy is a legal value (2 <= gy <= modulus-2)
    2. Computes s = (gy)x
    3. Computes two AES keys c, c’ and four MAC keys m1, m1′, m2, m2′ by hashing s in various ways
    4. Picks keyidB, a serial number for his D-H key gx
    5. Computes MB = MACm1(gx, gy, pubB, keyidB)
    6. Computes XB = pubB, keyidB, sigB(MB)
    7. Sends Alice r, AESc(XB), MACm2(AESc(XB))
  • Alice:
    1. Uses r to decrypt the value of gx sent earlier
    2. Verifies that HASH(gx) matches the value sent earlier
    3. Verifies that Bob’s gx is a legal value (2 <= gx <= modulus-2)
    4. Computes s = (gx)y (note that this will be the same as the value of s Bob calculated)
    5. Computes two AES keys c, c’ and four MAC keys m1, m1′, m2, m2′ by hashing s in various ways (the same as Bob)
    6. Uses m2 to verify MACm2(AESc(XB))
    7. Uses c to decrypt AESc(XB) to obtain XB = pubB, keyidB, sigB(MB)
    8. Computes MB = MACm1(gx, gy, pubB, keyidB)
    9. Uses pubB to verify sigB(MB)
    10. Picks keyidA, a serial number for her D-H key gy
    11. Computes MA = MACm1′(gy, gx, pubA, keyidA)
    12. Computes XA = pubA, keyidA, sigA(MA)
    13. Sends Bob AESc’(XA), MACm2′(AESc’(XA))
  • Bob:
    1. Uses m2′ to verify MACm2′(AESc’(XA))
    2. Uses c’ to decrypt AESc’(XA) to obtain XA = pubA, keyidA, sigA(MA)
    3. Computes MA = MACm1′(gy, gx, pubA, keyidA)
    4. Uses pubA to verify sigA(MA)
  • If all of the verifications succeeded, Alice and Bob now know each other’s Diffie-Hellman public keys, and share the value s. Alice is assured that s is known by someone with access to the private key corresponding to pubB, and similarly for Bob.
:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you are looking for? Drop a comment on a post or contact me so I can take care of it!

Visit my friends

A few highly recommended friends...