tests: DPP bootstrapping via NFC URI record

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-12-03 18:27:52 +02:00 committed by Jouni Malinen
parent e780b4bf20
commit 4a667b01e6
2 changed files with 29 additions and 2 deletions

View file

@ -4853,3 +4853,21 @@ def run_dpp_config_save(dev, apdev, config, conf_ssid, exp_ssid):
raise Exception("SSID not saved")
if 'psk="secret passphrase"' not in data:
raise Exception("Passphtase not saved")
def test_dpp_nfc_uri(dev, apdev):
"""DPP bootstrapping via NFC URI record"""
check_dpp_capab(dev[0])
check_dpp_capab(dev[1])
id = dev[0].dpp_bootstrap_gen(type="nfc-uri", chan="81/1", mac=True)
uri = dev[0].request("DPP_BOOTSTRAP_GET_URI %d" % id)
logger.info("Generated URI: " + uri)
info = dev[0].request("DPP_BOOTSTRAP_INFO %d" % id)
logger.info("Bootstrapping info:\n" + info)
if "type=NFC-URI" not in info:
raise Exception("Unexpected bootstrapping info contents")
dev[0].dpp_listen(2412)
conf_id = dev[1].dpp_configurator_add()
dev[1].dpp_auth_init(nfc_uri=uri, configurator=conf_id, conf="sta-dpp")
wait_auth_success(dev[0], dev[1], configurator=dev[1], enrollee=dev[0])

View file

@ -1424,6 +1424,12 @@ class WpaSupplicant:
raise Exception("Failed to parse QR Code URI")
return int(res)
def dpp_nfc_uri(self, uri):
res = self.request("DPP_NFC_URI " + uri)
if "FAIL" in res:
raise Exception("Failed to parse NFC URI")
return int(res)
def dpp_bootstrap_gen(self, type="qrcode", chan=None, mac=None, info=None,
curve=None, key=None):
cmd = "DPP_BOOTSTRAP_GEN type=" + type
@ -1459,9 +1465,12 @@ class WpaSupplicant:
extra=None, own=None, role=None, neg_freq=None,
ssid=None, passphrase=None, expect_fail=False,
tcp_addr=None, tcp_port=None, conn_status=False,
ssid_charset=None):
ssid_charset=None, nfc_uri=None):
cmd = "DPP_AUTH_INIT"
if peer is None:
if nfc_uri:
peer = self.dpp_nfc_uri(nfc_uri)
else:
peer = self.dpp_qr_code(uri)
cmd += " peer=%d" % peer
if own is not None: