Skip to content

Commit fcf206a

Browse files
committed
Allow CCID to be enabled for 'FIDO Edition' devices
1 parent d4982af commit fcf206a

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

tests/test_device.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
from dataclasses import replace
12
from typing import cast
23

34
import pytest
4-
55
from yubikit.core import TRANSPORT, YUBIKEY, Tlv
66
from yubikit.management import (
77
CAPABILITY,
@@ -11,8 +11,6 @@
1111
Version,
1212
)
1313
from yubikit.support import get_name
14-
from dataclasses import replace
15-
1614

1715
DEFAULT_INFO = DeviceInfo(
1816
config=cast(DeviceConfig, None),
@@ -220,6 +218,10 @@ def test_enhanced_pin():
220218
"YubiKey 5Ci",
221219
"0102023f0302023f020400a0392204010505030502030602000007010f0801000a01000f010c",
222220
),
221+
(
222+
"YubiKey C Bio - FIDO Edition",
223+
"01021206030212060204023251e904010705030000010602000007010f0801000a01000f010020030100002103030001100101110400000000120100130c3738434c5546583530303050140200001502000016010017010018020000190e0103050800020101030400000003",
224+
),
223225
]
224226

225227

yubikit/support.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
# Old U2F AID, only used to detect the presence of the applet
6464
_AID_U2F_YUBICO = bytes.fromhex("a0000005271002")
6565

66+
# Only used for pre YK4 devices, does not need to include any newer applets
6667
_SCAN_APPLETS = (
6768
# OTP will be checked elsewhere and thus isn't needed here
6869
(AID.FIDO, CAPABILITY.U2F),
@@ -338,7 +339,19 @@ def read_info(conn: Connection, pid: PID | None = None) -> DeviceInfo:
338339

339340

340341
def _fido_only(capabilities):
341-
return capabilities & ~(CAPABILITY.U2F | CAPABILITY.FIDO2) == 0
342+
# Explicit list of non-FIDO capabilities, to prevent future capability additions
343+
# from breaking this check.
344+
return (
345+
capabilities
346+
& (
347+
CAPABILITY.OTP
348+
| CAPABILITY.OATH
349+
| CAPABILITY.PIV
350+
| CAPABILITY.OPENPGP
351+
| CAPABILITY.HSMAUTH
352+
)
353+
== 0
354+
) and capabilities & (CAPABILITY.U2F | CAPABILITY.FIDO2) != 0
342355

343356

344357
def _is_preview(version):

0 commit comments

Comments
 (0)