Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Secure Peer-to-Peer Browser Communication

Eli
October 20, 2015

Secure Peer-to-Peer Browser Communication

using webRTC and PGP to establish less scary connections between browsers

Eli

October 20, 2015
Tweet

More Decks by Eli

Other Decks in Technology

Transcript

  1. let peer2 = new SimplePeer() peer2.on('stream', function (stream) { //

    got remote video stream, now let's show it in a video tag let video = document.querySelector('video') video.src = window.URL.createObjectURL(stream) video.play() }) }
  2. PGP

  3. KBPGP.JS var kbpgp = require('kbpgp'); kbpgp.KeyManager.generate_rsa({ userid : "Bo Jackson

    <[email protected]>" }, function(err, charlie) { charlie.sign({}, function(err) { console.log("done!"); }); }); Key Generation
  4. KBPGP.JS var params = { msg: "Chuck chucky, bo-bucky!", encrypt_for:

    chuck }; kbpgp.box(params, function(err, result_string, result_buffer) { console.log(err, result_armored_string, result_raw_buffer); }); Encryption
  5. KBPGP.JS var ring = new kbpgp.keyring.KeyRing; var pgp_msg = "----

    BEGIN PGP MESSAGE ----- ...."; var asp = /* as in Encryption ... */ ; kbpgp.unbox({ keyfetch: ring, armored: pgp_msg, asp }, function(err, literals) { console.log("decrypted message"); console.log(literals[0].toString()); }); Decryption
  6. STORING KEYS Keybase.io Pair •Not stored in app •keybase.io •local

    •Long lifetime •Nonce Session Pair Stored in app Short lifetime Linked to keybase.io pair
  7. AUTHENTICATION TOKEN { id: "john doe", pub_key: "abc123DEF5678", exp: 1445234383122,

    nbf: 1445232272011, secret: "---- BEGIN PGP MESSAGE ----- ....", nonce: "f2AbcIjlkFJls123kdjf" } keybase sign -m "<auth-token message>"
  8. AUTHENTICATION TOKEN { id: "john doe", pub_key: "abc123DEF5678", exp: 1445234383122,

    nbf: 1445232272011, secret: "---- BEGIN PGP MESSAGE ----- ....", nonce: "f2AbcIjlkFJls123kdjf" } keybase sign -m "<auth-token message>" keybase.io id
  9. AUTHENTICATION TOKEN { id: "john doe", pub_key: "abc123DEF5678", exp: 1445234383122,

    nbf: 1445232272011, secret: "---- BEGIN PGP MESSAGE ----- ....", nonce: "f2AbcIjlkFJls123kdjf" } keybase sign -m "<auth-token message>" app generated public key
  10. AUTHENTICATION TOKEN { id: "john doe", pub_key: "abc123DEF5678", exp: 1445234383122,

    nbf: 1445232272011, secret: "---- BEGIN PGP MESSAGE ----- ....", nonce: "f2AbcIjlkFJls123kdjf" } keybase sign -m "<auth-token message>" from our app?