Nitrokey / nitrokey-fido2-firmware

FIDO2 USB token optimized for security, extensibility, and style. A fork of Solo key.
https://www.nitrokey.com/
Other
53 stars 6 forks source link

Non-canonical CBOR sent on GET_INFO call #73

Open szszszsz opened 1 year ago

szszszsz commented 1 year ago

Environment

Relevant CBOR info

  File "Python\Python310\lib\site-packages\pynitrokey\fido2\client.py", line 112, in find_device
    self.ctap2: Optional[Ctap2] = Ctap2(dev)
  File "Python\Python310\lib\site-packages\fido2\ctap2\base.py", line 208, in __init__
    self._info = self.get_info()
  File "Python\Python310\lib\site-packages\fido2\ctap2\base.py", line 262, in get_info
    return Info.from_dict(self.send_cbor(Ctap2.CMD.GET_INFO))
  File "Python\Python310\lib\site-packages\fido2\ctap2\base.py", line 249, in send_cbor
    raise ValueError(
ValueError: Non-canonical CBOR from Authenticator.
Got: a80183665532465f5632684649444f5f325f306c4649444f5f325f315f50524502826b6372656450726f746563746b686d61632d7365637265740350c39efba6fcf44c3e828bfc4a6115a0ff04a562726bf5627570f564706c6174f47563726564656e7469616c4d676d7450726576696577f569636c69656e7450696ef5051904b00681010714081880
Expected: a80183665532465f5632684649444f5f325f306c4649444f5f325f315f50524502826b6372656450726f746563746b686d61632d7365637265740350c39efba6fcf44c3e828bfc4a6115a0ff04a562726bf5627570f564706c6174f469636c69656e7450696ef57563726564656e7469616c4d676d7450726576696577f5051904b00681010714081880

Is

{
    1: ["U2F_V2", "FIDO_2_0", "FIDO_2_1_PRE"],
    2: ["credProtect", "hmac-secret"],
     h'c39efba6fcf44c3e828bfc4a6115a0ff',
    4: {
        "rk": true,
        "up": true,
        "plat": false,
        "credentialMgmtPreview": true,
        "clientPin": true,
    },
    5: 1200_1,
    6: [1],
    7: 20,
    8: 128_0,
}

Expected - compare position 4

{
    1: ["U2F_V2", "FIDO_2_0", "FIDO_2_1_PRE"],
    2: ["credProtect", "hmac-secret"],
     h'c39efba6fcf44c3e828bfc4a6115a0ff',
    4: {
        "rk": true,
        "up": true,
        "plat": false,
        "clientPin": true,
        "credentialMgmtPreview": true,
    },
    5: 1200_1,
    6: [1],
    7: 20,
    8: 128_0,
}