update to new fido2 version
This commit is contained in:
parent
f6ff3c1b87
commit
e537d00173
@ -20,6 +20,7 @@ from fido2.ctap1 import CTAP1
|
|||||||
from fido2.ctap2 import *
|
from fido2.ctap2 import *
|
||||||
from fido2.cose import *
|
from fido2.cose import *
|
||||||
from fido2.utils import Timeout, sha256
|
from fido2.utils import Timeout, sha256
|
||||||
|
from fido2.attestation import Attestation
|
||||||
import sys, os, time
|
import sys, os, time
|
||||||
from random import randint
|
from random import randint
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
@ -35,6 +36,11 @@ def ForceU2F(client, device):
|
|||||||
client._do_get_assertion = client._ctap1_get_assertion
|
client._do_get_assertion = client._ctap1_get_assertion
|
||||||
|
|
||||||
|
|
||||||
|
def VerifyAttestation(attest, data):
|
||||||
|
verifier = Attestation.for_type(attest.fmt)
|
||||||
|
verifier().verify(attest.att_statement, attest.auth_data, data.hash)
|
||||||
|
|
||||||
|
|
||||||
class Packet(object):
|
class Packet(object):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
l = len(data)
|
l = len(data)
|
||||||
@ -415,7 +421,7 @@ class Tester:
|
|||||||
rp, user, challenge, pin=PIN, exclude_list=[]
|
rp, user, challenge, pin=PIN, exclude_list=[]
|
||||||
)
|
)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
|
|
||||||
cred = attest.auth_data.credential_data
|
cred = attest.auth_data.credential_data
|
||||||
@ -465,7 +471,7 @@ class Tester:
|
|||||||
)
|
)
|
||||||
print(attest.auth_data.counter)
|
print(attest.auth_data.counter)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
@ -511,7 +517,7 @@ class Tester:
|
|||||||
attest, data = self.client.make_credential(
|
attest, data = self.client.make_credential(
|
||||||
rp, user, challenge, pin=PIN, exclude_list=[]
|
rp, user, challenge, pin=PIN, exclude_list=[]
|
||||||
)
|
)
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
# verify endian-ness is correct
|
# verify endian-ness is correct
|
||||||
assert attest.auth_data.counter < 0x10000
|
assert attest.auth_data.counter < 0x10000
|
||||||
cred = attest.auth_data.credential_data
|
cred = attest.auth_data.credential_data
|
||||||
@ -535,7 +541,7 @@ class Tester:
|
|||||||
attest, data = self.client.make_credential(
|
attest, data = self.client.make_credential(
|
||||||
rp, user, challenge, pin=PIN, exclude_list=exclude_list
|
rp, user, challenge, pin=PIN, exclude_list=exclude_list
|
||||||
)
|
)
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
cred = attest.auth_data.credential_data
|
cred = attest.auth_data.credential_data
|
||||||
creds.append(cred)
|
creds.append(cred)
|
||||||
print("PASS")
|
print("PASS")
|
||||||
@ -665,7 +671,7 @@ class Tester:
|
|||||||
rp, user0, challenge, pin=PIN, exclude_list=[], rk=True
|
rp, user0, challenge, pin=PIN, exclude_list=[], rk=True
|
||||||
)
|
)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
creds.append(attest.auth_data.credential_data)
|
creds.append(attest.auth_data.credential_data)
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
|
|
||||||
@ -687,7 +693,7 @@ class Tester:
|
|||||||
rp, users[i], challenge, pin=PIN, exclude_list=[], rk=True
|
rp, users[i], challenge, pin=PIN, exclude_list=[], rk=True
|
||||||
)
|
)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
|
|
||||||
creds.append(attest.auth_data.credential_data)
|
creds.append(attest.auth_data.credential_data)
|
||||||
@ -710,7 +716,7 @@ class Tester:
|
|||||||
rp, users[1], challenge, pin=PIN, exclude_list=[], rk=True
|
rp, users[1], challenge, pin=PIN, exclude_list=[], rk=True
|
||||||
)
|
)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
creds = creds[:2] + creds[3:] + [attest.auth_data.credential_data]
|
creds = creds[:2] + creds[3:] + [attest.auth_data.credential_data]
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
|
|
||||||
@ -775,7 +781,7 @@ class Tester:
|
|||||||
rp, user, challenge, pin=PIN, exclude_list=[], rk=True
|
rp, user, challenge, pin=PIN, exclude_list=[], rk=True
|
||||||
)
|
)
|
||||||
t2 = time.time() * 1000
|
t2 = time.time() * 1000
|
||||||
attest.verify(data.hash)
|
VerifyAttestation(attest, data)
|
||||||
creds = [attest.auth_data.credential_data]
|
creds = [attest.auth_data.credential_data]
|
||||||
print("Register valid (%d ms)" % (t2 - t1))
|
print("Register valid (%d ms)" % (t2 - t1))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user