summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2021-05-18 17:03:42 -0700
committerBrian Gix <brian.gix@intel.com>2021-05-19 12:54:40 -0700
commit7f0a643d5416b25d06821db784de268d2962362b (patch)
tree9b4d7761e65bc46fbbb60be80b97c7d8e12ec022 /test
parent1441c24039fe79cf29f62dc59532ca21b7090a1c (diff)
downloadbluez-7f0a643d5416b25d06821db784de268d2962362b.tar.gz
test/mesh: Add support for testing more OOB auth
To pass IOP testing, we need to be able to support Input OOB and Out of band Public Key exchange, This patch adds agent methods to support those capabilities, but are turned off because the test code uses insecure fixed values instead of randomized values.
Diffstat (limited to 'test')
-rwxr-xr-xtest/agent.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/agent.py b/test/agent.py
index b46cd95f4..57a74183d 100755
--- a/test/agent.py
+++ b/test/agent.py
@@ -35,7 +35,9 @@ class Agent(dbus.service.Object):
caps = []
oob = []
caps.append('out-numeric')
+ #caps.append('in-numeric') -- Do not use well known in-oob
caps.append('static-oob')
+ #caps.append('public-oob') -- Do not use well known key pairs
oob.append('other')
return {
AGENT_IFACE: {
@@ -56,6 +58,27 @@ class Agent(dbus.service.Object):
print(set_cyan('DisplayNumeric ('), type,
set_cyan(') number ='), set_green(value))
+ @dbus.service.method(AGENT_IFACE, in_signature="s", out_signature="u")
+ def PromptNumeric(self, type):
+ # Sample in-oob -- DO-NOT-USE
+ value = 12345
+ print(set_cyan('PromptNumeric ('), type,
+ set_cyan(') number ='), set_green(value))
+ return dbus.UInt32(value)
+
+ @dbus.service.method(AGENT_IFACE, in_signature="", out_signature="ay")
+ def PrivateKey(self):
+ # Sample Public/Private pair from Mesh Profile Spec DO-NOT-USE
+ private_key_str = '6872b109ea0574adcf88bf6da64996a4624fe018191d9322a4958837341284bc'
+ public_key_str = 'ce9027b5375fe5d3ed3ac89cef6a8370f699a2d3130db02b87e7a632f15b0002e5b72c775127dc0ce686002ecbe057e3d6a8000d4fbf2cdfffe0d38a1c55a043'
+ print(set_cyan('PrivateKey ()'))
+ print(set_cyan('Enter Public key on remote device: '),
+ set_green(public_key_str));
+ private_key = bytearray.fromhex(private_key_str)
+
+ return dbus.Array(private_key, signature='y')
+
+
@dbus.service.method(AGENT_IFACE, in_signature="s", out_signature="ay")
def PromptStatic(self, type):
static_key = numpy.random.randint(0, 255, 16)