Skip to content

Commit 610c515

Browse files
committed
Implement CTAP2.1 PIN token permissions
1 parent 7f923b9 commit 610c515

File tree

6 files changed

+229
-34
lines changed

6 files changed

+229
-34
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
This repository contains sources for a FIDO2 CTAP2 compatible(-ish)
5+
This repository contains sources for a FIDO2 CTAP2.1 compatible(-ish)
66
applet targeting the Javacard Classic system, version 3.0.4. In a
77
nutshell, this lets you take a smartcard, install an app onto it,
88
and have it work as a FIDO2 authenticator device with a variety of
@@ -59,15 +59,15 @@ 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 |
62+
| CTAP2.1 core | Implemented, many caveats |
6363
| Resident keys | Implemented, default 50 slots |
6464
| User Presence | User always considered present: not standards compliant |
6565
| Self attestation | Implemented |
6666
| Attestation certificates | Not implemented |
6767
| ECDSA (SecP256r1) | Implemented |
68-
| Other crypto like ed25519 | Not implemented |
68+
| Other crypto, like ed25519 | Not implemented |
6969
| CTAP2.0 hmac-secret extension | Implemented |
70-
| CTAP2.1 hmac-secret extension | Implemented with one secret, requiring UV, not two |
70+
| CTAP2.1 hmac-secret extension | Implemented with one secret (requiring UV) not two |
7171
| CTAP2.1 alwaysUv option | Implemented |
7272
| CTAP2.1 credProtect option | Implemented, one caveat |
7373
| CTAP2.1 PIN Protocol 1 | Implemented |

docs/FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ 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
63-
requires you type your PIN (if one is set)...
63+
requires you type your PIN (if one is set)... Additionally, this app will not
64+
clear CTAP2.1 PIN token permissions on use.
6465

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

src/main/java/us/q3q/fido2/CannedCBOR.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ public abstract class CannedCBOR {
2323
FIDOConstants.CTAP2_OK,
2424
(byte) 0xA8, // Map - eight keys
2525
0x01, // map key: versions
26-
(byte) 0x81, // array - one item
26+
(byte) 0x82, // array - two items
2727
0x68, // string - eight bytes long
2828
0x46, 0x49, 0x44, 0x4F, 0x5F, 0x32, 0x5F, 0x30, // FIDO_2_0
29-
0x02, // map key: extensions
29+
0x68, // string - eight bytes long
30+
0x46, 0x49, 0x44, 0x4F, 0x5F, 0x32, 0x5F, 0x31, // FIDO_2_1
31+
0x02, // map key: extensions
3032
(byte) 0x82, // array - two items
3133
0x6B, // string - eleven bytes long
3234
0x63, 0x72, 0x65, 0x64, 0x50, 0x72, 0x6F, 0x74, 0x65, 0x63, 0x74, // credProtect
@@ -36,7 +38,7 @@ public abstract class CannedCBOR {
3638
0x50, // byte string, 16 bytes long
3739
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // aaguid
3840
0x04, // map key: options
39-
(byte) 0xA5, // map: five entries
41+
(byte) 0xA6, // map: six entries
4042
0x62, // string: two bytes long
4143
0x72, 0x6B, // rk
4244
(byte) 0xF5, // true
@@ -52,6 +54,9 @@ public abstract class CannedCBOR {
5254
static final byte[] MAKE_CRED_UV_NOT_REQD = {
5355
0x6D, 0x61, 0x6B, 0x65, 0x43, 0x72, 0x65, 0x64, 0x55, 0x76, 0x4E, 0x6F, 0x74, 0x52, 0x71, 0x64
5456
};
57+
static final byte[] PIN_UV_AUTH_TOKEN = {
58+
0x70, 0x69, 0x6E, 0x55, 0x76, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6F, 0x6B, 0x65, 0x6E
59+
};
5560
static final byte[] MAKE_CREDENTIAL_RESPONSE_PREAMBLE = {
5661
0x00, // status - OK!
5762
(byte) 0xA3, // Map - three keys

0 commit comments

Comments
 (0)