From f5d50e001d6b058ae095411412610bb9383215c0 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Fri, 26 Jul 2019 19:00:07 -0400 Subject: [PATCH] test assertions work post reboot --- tools/testing/tests/fido2.py | 34 ++++++++++++++++++++++++++++++++++ tools/testing/tests/u2f.py | 10 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/tools/testing/tests/fido2.py b/tools/testing/tests/fido2.py index 3b5b557..7bacaed 100644 --- a/tools/testing/tests/fido2.py +++ b/tools/testing/tests/fido2.py @@ -743,6 +743,40 @@ class FIDO2Tests(Tester): expectedError=CtapError.ERR.SUCCESS, ) + with Test("Check assertion is correct"): + credential_data = AttestedCredentialData(prev_reg.auth_data.credential_data) + prev_auth.verify(cdh, credential_data.public_key) + assert ( + prev_auth.credential["id"] + == prev_reg.auth_data.credential_data.credential_id + ) + + self.reboot() + + prev_auth = self.testGA( + "Send GA request after reboot, expect success", + rp["id"], + cdh, + allow_list, + expectedError=CtapError.ERR.SUCCESS, + ) + + with Test("Check assertion is correct"): + credential_data = AttestedCredentialData(prev_reg.auth_data.credential_data) + prev_auth.verify(cdh, credential_data.public_key) + assert ( + prev_auth.credential["id"] + == prev_reg.auth_data.credential_data.credential_id + ) + + prev_auth = self.testGA( + "Send GA request, expect success", + rp["id"], + cdh, + allow_list, + expectedError=CtapError.ERR.SUCCESS, + ) + with Test("Test auth_data is 37 bytes"): assert len(prev_auth.auth_data) == 37 diff --git a/tools/testing/tests/u2f.py b/tools/testing/tests/u2f.py index 367ee4a..96d7fd8 100644 --- a/tools/testing/tests/u2f.py +++ b/tools/testing/tests/u2f.py @@ -78,6 +78,16 @@ class U2FTests(Tester): auth = self.authenticate(chal, appid, regs[i].key_handle) auth.verify(appid, chal, regs[i].public_key) + self.reboot() + + for i in range(0, self.user_count): + with Test( + "Post reboot, Checking previous registration %d/%d" + % (i + 1, self.user_count) + ): + auth = self.authenticate(chal, appid, regs[i].key_handle) + auth.verify(appid, chal, regs[i].public_key) + print("Check that all previous credentials are registered...") for i in range(0, self.user_count): with Test("Check that previous credential %d is registered" % i):