summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-12-13 12:03:46 +0900
committerjaseg <git@jaseg.net>2018-12-13 12:03:46 +0900
commite53ed321d97cf4065534c1e046ae3ac4272b7b47 (patch)
treecc5d83b159f4d0c6834cf6c1ceff9de56937d356
parent47ca356e92929a1d020e1111ad34c2d2bb92927d (diff)
downloadsecure-hid-e53ed321d97cf4065534c1e046ae3ac4272b7b47.tar.gz
secure-hid-e53ed321d97cf4065534c1e046ae3ac4272b7b47.tar.bz2
secure-hid-e53ed321d97cf4065534c1e046ae3ac4272b7b47.zip
Add mouse pairing mockup
-rw-r--r--directions/research_directions.pdfbin1241894 -> 1242258 bytes
-rw-r--r--directions/research_directions.tex1
-rw-r--r--mouse_pairing_mockup/Screenshot_2018-12-13_11-46-26.pngbin0 -> 29906 bytes
-rw-r--r--mouse_pairing_mockup/mockup.py51
-rw-r--r--mouse_pairing_mockup/mockup.xcfbin0 -> 116954 bytes
5 files changed, 52 insertions, 0 deletions
diff --git a/directions/research_directions.pdf b/directions/research_directions.pdf
index 44bfbe0..465d13b 100644
--- a/directions/research_directions.pdf
+++ b/directions/research_directions.pdf
Binary files differ
diff --git a/directions/research_directions.tex b/directions/research_directions.tex
index a08166d..adfed3a 100644
--- a/directions/research_directions.tex
+++ b/directions/research_directions.tex
@@ -605,6 +605,7 @@ be established where one party has a display of some sort and the other party ha
\paragraph{Adaption to mice} Instead of a keyboard, a mouse can be used for pairing without compromising protocol
security. The host would encode the fingerprint bit string into a permutation
$\sigma(i) : \{n\in\mathbb N, n\le m\} \rightarrow \{n\in\mathbb N, n\le m\}$
+for an integer security parameter $m>0$
and then display the sequence $\sigma(i)$ in a grid of buttons similar to a minesweeper field with an emualted mouse
cursor driven by pairing input on top. The user would then click the buttons on the grid in numeric order. The device
would do the same mouse emulation invisible to the user and would be able to observe the permutation this way. The
diff --git a/mouse_pairing_mockup/Screenshot_2018-12-13_11-46-26.png b/mouse_pairing_mockup/Screenshot_2018-12-13_11-46-26.png
new file mode 100644
index 0000000..2889ec1
--- /dev/null
+++ b/mouse_pairing_mockup/Screenshot_2018-12-13_11-46-26.png
Binary files differ
diff --git a/mouse_pairing_mockup/mockup.py b/mouse_pairing_mockup/mockup.py
new file mode 100644
index 0000000..b8903d7
--- /dev/null
+++ b/mouse_pairing_mockup/mockup.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+import itertools
+
+import gi
+import gi
+from gi.repository import Gtk as gtk, Gdk as gdk, Pango as pango, GLib as glib
+
+import numpy as np
+
+
+class PyApp(gtk.Window):
+ def __init__(self, m=5):
+ super(PyApp, self).__init__()
+
+ self.set_title("Mouse pairing mockup")
+ self.set_default_size(400, 400)
+ vbox = gtk.VBox()
+ grid = gtk.Grid(row_spacing=20, column_spacing=20, row_homogeneous=True, column_homogeneous=True, margin=20)
+ lbl = self.lbl = gtk.Label('Please press the buttons below in order 1-2-3...')
+
+ # GTK has the best APIs... -.-
+ screen = gdk.Screen.get_default()
+ gtk_provider = gtk.CssProvider()
+ gtk_context = gtk.StyleContext()
+ gtk_context.add_provider_for_screen(screen, gtk_provider, gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
+ css = b'''
+ #pinpad > button {font: 24 bold}
+ #pinpad > button:checked {background: linear-gradient(#e5efd4, #588a5a)}
+ '''
+ grid.set_name('pinpad')
+ gtk_provider.load_from_data(css)
+
+ st = np.random.RandomState(seed=0)
+ for i, (x, y) in zip(st.permutation(m**2), itertools.product(range(m), range(m))):
+ btn = gtk.ToggleButton(f'{i+1}')
+ btn.connect("toggled", self.on_toggled)
+ grid.attach(btn, x, y, 1, 1)
+
+ vbox.pack_start(lbl, True, True, 0)
+ vbox.pack_start(grid, True, True, 0)
+ self.add(vbox)
+ self.connect("destroy", gtk.main_quit)
+ self.show_all()
+
+ def on_toggled(self, widget, data=None):
+ print(f'Clicked : {widget.get_label()}')
+
+if __name__ == '__main__':
+ PyApp()
+ gtk.main()
diff --git a/mouse_pairing_mockup/mockup.xcf b/mouse_pairing_mockup/mockup.xcf
new file mode 100644
index 0000000..a24e279
--- /dev/null
+++ b/mouse_pairing_mockup/mockup.xcf
Binary files differ