Services/Sync/P2P Key Exchange And Rotation: Difference between revisions

updated message structures
(Minor edits)
(updated message structures)
Line 422: Line 422:
           Alice (Client A)                      Eve (MITM)      Bob (Client B)
           Alice (Client A)                      Eve (MITM)      Bob (Client B)


t0        AIs                                    AIp, BIp        BIs, MK
t0        AIs                                    AIp, BIp        BIs, MK                                                  
          AEs                                    AEd, BEd        BEs
          AEp                                                    BEp


t1        AIs                                    AIp, BIp        BIs, MK
t1        AIs                                    AIp, BIp        BIs, MK
(OoB)      AEs                                    AEd, BEd        BEs
Key        AEs                                    AEd             
Commit    AEp                                   
 
t2        AIs                                    AIp, BIp        BIs, MK
(OoB)      AEs                                    AEd             BEs
           AEp                                                    BEp
           AEp                                                    BEp
           VCS = DIGEST(AIp, AEp)                                  VCSui = <user input>
           VCS = DIGEST(AIp, AEp)                                  VCSui = <user input>
           VCR = RANDOM()                                          VCRui = <user input>
           VCR = RANDOM()                                          VCRui = <user input>


t2         AIs                                    AIp, BIp        BIs, MK
t3         AIs                                    AIp, BIp        BIs, MK
           AEs                                    BEp              BEs
           AEs                                    BEp              BEs
           AEp                                    AEd, BEd        VCSui     
           AEp                                    AEd             VCSui     
           VCS                                                    VCRui
           VCS                                                    VCRui                    
          VCR                                                   
          Verified = (BEd == DIGEST(BEp))                       


t3         AIs                                    AIp, BIp        BIs, MK
t4         AIs                                    AIp, BIp        BIs, MK
          AEs                                    AEp, BEp        BEs
Key        AEs                                    AEp, BEp        BEs
          SK = KDF(3DHE(AIs, AEs, BIp, BEp))    BEd             SK = KDF(3DHE(BIs, BEs, AIp, AEp)
Verify    SK = KDF(3DHE(AIs, AEs, BIp, BEp))    AEd             SK = KDF(3DHE(BIs, BEs, AIp, AEp))
           VCS                                                    VCSui
           VCS                                                    VCSui
           VCR                                                    VCRui
           VCR                                                    VCRui
                                                                   Verified = (VCSui == DIGEST(AIp, AEp) + AEd == DIGEST(AEp))
                                                                   Verified = (VCSui == DIGEST(AIp, AEp) + AEd == DIGEST(AEp))


t4         AIs, MK                                AIp, BIp        BIs, MK
t5         AIs, MK                                AIp, BIp        BIs, MK
           SK                                                      SK
           SK                                                      SK
           VCR                                                    VCRui
           VCR                                                    VCRui
Line 452: Line 452:
           Verified = (VCRui == VCR)                               
           Verified = (VCRui == VCR)                               
</pre>
</pre>


'''Notes:'''
'''Notes:'''
Line 458: Line 459:
* A QR code including Client A's entire key (AEp) would allow step 2, 3 and 4 to be collapsed into a single step. See [[#Signal (TextSecure) Registration Protocol|Signal (TextSecure) Registration Protocol]] below.
* A QR code including Client A's entire key (AEp) would allow step 2, 3 and 4 to be collapsed into a single step. See [[#Signal (TextSecure) Registration Protocol|Signal (TextSecure) Registration Protocol]] below.


'''ClientAuthV2Verifier JSON'''
'''Message JSON (compatible with v1 protocol)'''
<pre>
{
  version:      "version of message record, i.e. 1|v1",
  srcclientid:  "id of sender",
  srckeyid:    "id of sender's ephemeral key",
  srckey:      "sender's ephemeral key (optional after first message, i.e. sequence > 1)",
  dstclientid:  "id of receiver",
  dstkeyid:    "id of receiver's ephemeral key",
  sequence:    "sequence of this message in session",
  type:        "message type",
  content:      "message content"
  hmac:        "HMAC of all other message fields"
}
</pre>
 
'''Verified Session Message JSON'''
<pre>
{
  version:      "version of message record, i.e. v2verified",
  srcclientid:  "id of sender",
  dstclientid:  "id of receiver",
  sessionid:    "id of session",
  sequence:    "sequence of this message in session",
  cipher:      "encryption type, i.e. none|3dhe"
  type:        "message type",
  content:      "message content"
  hmac:        "HMAC of all other message fields"
}
</pre>
 
'''SessionKeyCommitRequestMessage'''
<pre>
<pre>
{
{
   proof: "Proof of receiving authcode through out of band channel"
   clientid:     "id of client",
  name:        "name of client",
  keydigest:    "digest of sender's ephemeral key",
  getkeys:      "when true and session verified receiver will return account keys, optional"
}
}
</pre>
</pre>


'''ClientAuthV2ResponseMessage JSON'''
 
'''SessionKeyCommitResponseMessage JSON'''
<pre>
<pre>
{
{
   clientid:  "id of client",
   clientid:  "id of client",
   name:      "name of client",
   name:      "name of client",
   status:   "okay|fail",
   key:       "receivers ephemeral key",
  message:  "authorisation approved|authorisation rejected",
  synckey:  "Master key for Weave Sync account (required if status 'okay')"
  auth:      ClientAuthV2Verifier (required if status 'okay')
}
}
</pre>
</pre>


'''SessionVerifier JSON'''
<pre>
{
  authcode:  "Random component of authcode entered by user, i.e. VCRui"
}
</pre>
'''AccountKeys JSON'''
<pre>
{
  masterkey:  "time used as input in to verification"
}
</pre>
'''SessionKeyVerifyRequestMessage JSON'''
<pre>
{
  clientid:  "id of client",
  name:      "name of client",
  key:      "senders ephemeral key",
}
</pre>
'''SessionKeyVerifyResponseMessage JSON'''
<pre>
{
  clientid:    "id of client",
  name:        "name of client",
  status:      "okay|fail",
  message:    "ephemeral key okay|ephemeral key mismatch",
  auth:        SessionVerifier (if status okay),
  payload:    AccountKeys (if status okay),
}
</pre>
'''SessionCloseRequestMessage JSON'''
<pre>
{
  clientid:  "id of client",
  name:      "name of client”,
  status:    "verified|failed",
  message:  "session verification okay|session verification failed",
}
</pre>
'''SessionCloseResponseMessage JSON'''
<pre>
{
  clientid:  "id of client",
  name:      "name of client”,
  status:    "verified|failed",
  message:  "session verification okay|session verification failed",
}
</pre>


<span id="Key_Rotation_Protocol_v2"></span>
<span id="Key_Rotation_Protocol_v2"></span>
113

edits