Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8988a5d authored by Martin Brabham's avatar Martin Brabham Committed by Myles Watson
Browse files

PySecurity: Add create_bond_out_of_band

Bug: 162984360
Tag: #gd-refactor
Test: cert/run --host SecurityTest
Change-Id: I41ac53a3b29e2409a1eb2da60abe8f37db84a9f4
parent ca07cae6
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -78,6 +78,27 @@ class PySecurity(Closable):
        self._device.security.CreateBond(
            common.BluetoothAddressWithType(address=common.BluetoothAddress(address=address), type=type))

    def create_bond_out_of_band(self, address, type, p192_oob_data, p256_oob_data):
        """
            Triggers stack under test to create bond using Out of Band method
        """

        logging.debug("DUT: Creating OOB bond to '%s' from '%s'" % (str(address), str(self._device.address)))

        self._device.security.CreateBondOutOfBand(
            OobDataBondMessage(
                address=common.BluetoothAddressWithType(address=common.BluetoothAddress(address=address), type=type),
                p192_data=OobDataMessage(
                    address=common.BluetoothAddressWithType(
                        address=common.BluetoothAddress(address=address), type=type),
                    le_sc_confirmation_value=bytes(bytearray(p192_oob_data[0])),
                    le_sc_random_value=bytes(bytearray(p192_oob_data[1]))),
                p256_data=OobDataMessage(
                    address=common.BluetoothAddressWithType(
                        address=common.BluetoothAddress(address=address), type=type),
                    le_sc_confirmation_value=bytes(bytearray(p256_oob_data[0])),
                    le_sc_random_value=bytes(bytearray(p256_oob_data[1])))))

    def remove_bond(self, address, type):
        """
            Removes bond from stack under test
@@ -134,6 +155,14 @@ class PySecurity(Closable):
        """
        pass

    def accept_oob_pairing(self, cert_address, reply_boolean, p192_data, p256_data):
        """
            Here we pass, but in cert we perform pairing flow tasks.
            This was added here in order to be more dynamic, but the stack
            under test will handle the pairing flow.
        """
        pass

    def on_user_input(self, cert_address, reply_boolean, expected_ui_event):
        """
            Respond to the UI event