Skip to content

Commit 7f923b9

Browse files
committed
Implement PIN protocol two
1 parent 1842b93 commit 7f923b9

File tree

4 files changed

+424
-188
lines changed

4 files changed

+424
-188
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ I suggest [reading the FAQ](docs/FAQ.md) and perhaps [the security model](docs/s
5959
|--------------------------------|---------------------------------------------------------|
6060
| CTAP1/U2F | Not implemented |
6161
| CTAP2.0 core | Implemented, many caveats |
62+
| CTAP2.1 core | Incomplete - missing PIN token permissions |
6263
| Resident keys | Implemented, default 50 slots |
6364
| User Presence | User always considered present: not standards compliant |
6465
| Self attestation | Implemented |
6566
| Attestation certificates | Not implemented |
6667
| ECDSA (SecP256r1) | Implemented |
6768
| Other crypto like ed25519 | Not implemented |
6869
| CTAP2.0 hmac-secret extension | Implemented |
69-
| CTAP2.1 hmac-secret extension | Not implemented (one secret, requiring UV, not two) |
70+
| CTAP2.1 hmac-secret extension | Implemented with one secret, requiring UV, not two |
7071
| CTAP2.1 alwaysUv option | Implemented |
7172
| CTAP2.1 credProtect option | Implemented, one caveat |
7273
| CTAP2.1 PIN Protocol 1 | Implemented |
73-
| CTAP2.1 PIN Protocol 2 | Not implemented |
74+
| CTAP2.1 PIN Protocol 2 | Implemented |
7475
| CTAP2.1 credential management | Implemented |
7576
| CTAP2.1 enterprise attestation | Not implemented |
7677
| CTAP2.1 authenticator config | Not implemented |

docs/FAQ.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,29 @@ CTAP2.1 standard says it's okay to return level three if two was requested,
5656
but that breaks OpenSSH, so... credProtect is incorrectly implemented in
5757
that it always applies level three internally.
5858

59-
Finally, the CTAP API requires user presence detection, but there's really no
59+
Thirdly, the CTAP API requires user presence detection, but there's really no
6060
way to do that on Javacard 3.0.4. We can't even use the "presence timeout"
6161
that is described in the spec for NFC devices. So you're always treated as
6262
being present, which is to some extent offset by the fact that anything real
6363
requires you type your PIN (if one is set)...
6464

6565
So set a PIN, and unplug your card when you're not using it.
6666

67+
Fourthly, the CTAP2.1 standard says that credential matches should be performed
68+
in most-recent order, but to save implementation complexity and runtime performance,
69+
this implementation does them in arbitrary order instead.
70+
71+
Finally, the CTAP2.0 and CTAP2.1 standards are actually mutually incompatible. When
72+
a getAssertion call is made with an `allowList` given, CTAP2.0 says that the
73+
authenticator should iterate through assertions generated with the matching
74+
credentials from the allowlist. CTAP2.1 says the authenticator should pick one
75+
matching credential, return an assertion generated with it, and ignore any
76+
other matches.
77+
78+
This implementation allows toggling either behavior by flipping a boolean in the
79+
code, but because one or the other must be chosen, it can't be both fully CTAP2.0
80+
compatible and CTAP2.1 compatible at the same time.
81+
6782
## Why don't you implement U2F/CTAP1?
6883

6984
U2F doesn't support PINs, and requires an attestation certificate.

0 commit comments

Comments
 (0)