Firefox OS/Remote Control: Difference between revisions

Jump to navigation Jump to search
→‎Authentication and Event Protocol: Update to TLS server protocol
(→‎Control event processing: Update to TLS version, remove encryption)
(→‎Authentication and Event Protocol: Update to TLS server protocol)
Line 87: Line 87:
# Data encryption/decryption is asynchronous but HTTP request need response immediately. For UUID and PIN code case, remote control uses a ticket number to get status after decryption. But for event, we reduce polling result but use latest event's result instead.
# Data encryption/decryption is asynchronous but HTTP request need response immediately. For UUID and PIN code case, remote control uses a ticket number to get status after decryption. But for event, we reduce polling result but use latest event's result instead.


=== Ajax Protocol ===
=== Authentication and Event Protocol ===
==== RSA public key exchange ====
==== Request handshake ====
Request
Request
   {
   {
     action: 'require-public-key'
    type: 'auth'
     action: 'request_handshake'
    id: <id assigned by server, optional>
   }
   }
Response
Response
   {
   {
     publicKey: <RSA-OEAP SPKI in base64>
     type: 'auth'
  }
    action: 'response_handshake'
  {
     detail: 1 or 2, 1 for 1st handshake, 2 for 2nd handshake
     error: <reason>
   }
   }


==== Send symmetric key ====
==== J-PAKE key exchange ====
Request
Client send round 1
   {
   {
     action: 'send-symmetric-key',
    type: 'auth'
     wrappedSymmetricKey: <AES-GCM wrapped by RSA-OEAP in base64>
     action: 'jpake_client_1',
     detail: {
      gx1: gx1.value,
      gx2: gx2.value,
      zpk_x1: { gr: gv1.value, b: r1.value, id: 'client' },
      zpk_x2: { gr: gv2.value, b: r2.value, id: 'client' }
    }
   }
   }
Response
Server reply round 1
   {
   {
     ticket: <ticket>
     type: 'auth'
    action: 'jpake_server_1',
    detail: {
      gx1: gx1.value,
      gx2: gx2.value,
      zpk_x1: { gr: gv1.value, b: r1.value, id: 'server' },
      zpk_x2: { gr: gv2.value, b: r2.value, id: 'server' }
    }
   }
   }
Client send round 2
   {
   {
     error: <reason>
     type: 'auth'
    action: 'jpake_client_2',
    detail: {
      A: A.value,
      zkp_A: { gr: gvA.value, b: rA.value, id: 'client' }
    }
   }
   }
 
Server reply round 2
==== Poll UUID ====
Request
   {
   {
     action: 'poll-uuid'
    type: 'auth'
     ticket: <ticket>
     action: 'jpake_server_2',
  }
     detail: {
Response
      A: A.value,
  {
      zkp_A: { gr: gvA.value, b: rA.value, id: 'server' }
    done: true,
     }
    encryptedUUID: <IV + UUID encrypted by AES-GCM, in base64>,
  }
  {
    done: true,
    error: <reason>
  }
  {
     done: false // Symmetic key unwrapping or encrypting UUID
   }
   }


==== Pair PIN code ====
==== Key confirmation ====
Request
Server key confirmation
   {
   {
     action: 'pair-pincode'
    type: 'auth'
     encryptedPIN: <IV + PIN encrypted by AES-GCM in base64>
     action: 'server_key_confirm'
     detail: {
      signature: <double signature of AES key by HMAC key, in base64>
    }
   }
   }
Response
Client key confirmation
   {
   {
     ticket: <ticket>
     type: 'auth'
    action: 'client_key_confirmation'
    detail: {
      signature: <signature of AES key by HMAC key, in base64>
    }
   }
   }
 
Server finish handshake
==== Poll pair result ====
Request
   {
   {
     action: 'poll-pair-result'
     type: 'auth'
     ticket: <ticket>
     action: 'finish_handshake'
  }
     detail: {
Response
      id: <id assigned by server, optional>
  {
     }
    done: true
     verified: <boolean>
    reason: <reason>
  }
  {
    done: false
  }
==== Encrypted control events ====
Client sends encrypted event in query string as:
  <IP_Address>:<Port>?message=<IV + encrypted event by AES-GCM in base64>
 
Response
  {
     verified: <boolean>
   }
   }
After decrypted, following are control events:


==== Touch Events ====
==== Touch Events ====


   {
   {
     type: 'touchstart',
     type: 'command'
    action: 'touchstart',
     detail: {
     detail: {
       width: <touch panel width, integer, in pixels>,
       width: <touch panel width, integer, in pixels>,
Line 182: Line 183:


   {
   {
     type: 'touchmove',
     type: 'command'
    action: 'touchmove',
     detail: {
     detail: {
       dx: <dx between current point and starting point, integer, in pixels>,
       dx: <dx between current point and starting point, integer, in pixels>,
Line 192: Line 194:


   {
   {
     type: 'touchend',
     type: 'command'
    action: 'touchend',
     detail: {
     detail: {
       dx: <same as "touchmove">,
       dx: <same as "touchmove">,
Line 209: Line 212:


   {
   {
     type: 'keypress',
     type: 'command'
    action: 'keypress',
     detail: <KeyEvent constant, string, sush as "DOM_VK_RETURN">
     detail: <KeyEvent constant, string, sush as "DOM_VK_RETURN">
   }
   }
Line 216: Line 220:


   {
   {
     type: 'textinput',
     type: 'command'
    action: 'textinput',
     detail: {
     detail: {
       clear: <whether to clear the entire string in the current focused input field, boolean>,
       clear: <whether to clear the entire string in the current focused input field, boolean>,
Line 227: Line 232:


   {
   {
     type: 'custom',
     type: 'command'
    action: 'custom',
     detail: {
     detail: {
       action: <custom action name, string>,
       action: <custom action name, string>,
133

edits

Navigation menu