|
34 | 34 | from fido2.server import Fido2Server |
35 | 35 | from fido2.utils import sha256, websafe_encode, websafe_decode |
36 | 36 | from fido2.cose import CoseKey |
37 | | -from fido2.arkg import ARKG_P256ADD_ECDH |
| 37 | +from fido2.arkg import ARKG_P256_ESP256 |
38 | 38 | from exampleutils import get_client |
39 | 39 | import sys |
40 | 40 |
|
|
58 | 58 | result = client.make_credential( |
59 | 59 | { |
60 | 60 | **create_options["publicKey"], |
61 | | - "extensions": { |
62 | | - "sign": {"generateKey": {"algorithms": [ARKG_P256ADD_ECDH.ALGORITHM]}} |
63 | | - }, |
| 61 | + "extensions": {"sign": {"generateKey": {"algorithms": [ARKG_P256_ESP256]}}}, |
64 | 62 | } |
65 | 63 | ) |
66 | 64 |
|
|
80 | 78 | ) |
81 | 79 | sys.exit(1) |
82 | 80 |
|
83 | | -# Extension output contains master public key and keyHandle |
| 81 | +# Extension output contains master public key |
84 | 82 | pk = CoseKey.parse( |
85 | 83 | cbor.decode(websafe_decode(sign_key["publicKey"])) |
86 | 84 | ) # COSE key in bytes |
87 | | -kh = sign_key["keyHandle"] # key handle in bytes |
88 | 85 | print("public key", pk) |
89 | | -print("keyHandle from Authenticator", cbor.decode(websafe_decode(kh))) |
90 | 86 |
|
91 | 87 | # Master public key contains blinding and KEM keys |
92 | 88 | # ARKG derive_public_key uses these |
93 | | -print("Blinding public key", pk.blinding_key) |
94 | | -print("KEM public key", pk.kem_key) |
| 89 | +print("Blinding public key", pk.pkbl) |
| 90 | +print("KEM public key", pk.pkkem) |
95 | 91 |
|
96 | | -# Arbitrary bytestring used for info |
97 | | -info = b"my-info-here" |
| 92 | +# Arbitrary bytestring used for ctx, ikm |
| 93 | +ctx = b"my-ctx-here" |
| 94 | +ikm = b"my-ikm-here" |
98 | 95 | # Derived public key to verify with, and kh to send to Authenticator |
99 | | -pk2 = pk.derive_public_key(info) |
| 96 | +pk2 = pk.derive_public_key(ikm, ctx) |
100 | 97 | print("Derived public key", pk2) |
101 | 98 | ref = pk2.get_ref() |
102 | 99 | print("COSE Key ref for derived key", ref) |
|
0 commit comments