Skip to content

Commit 3dafa77

Browse files
committed
Update fido2
1 parent 0875248 commit 3dafa77

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

applets/vk-u2f

docs/applets/5-fido.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ The attestation certificate is used to sign certificates for transport when you
1010

1111
The FIDO2 applet is still in development, and not completely finished. For example, Windows Hello is not supported yet. Stay tuned. It is also not officially certified.
1212

13-
If you are feeling lucky, you can however already test the FIDO2 applet.
13+
You can however already test the FIDO2 applet.
1414

1515
## Applet Information
1616

17-
### FIDO U2F (recommended)
17+
### FIDO U2F
1818

1919
- Repository: https://github.com/darconeous/u2f-javacard
2020
- Binary name: `U2FApplet.cap`
@@ -31,6 +31,10 @@ If you are feeling lucky, you can however already test the FIDO2 applet.
3131
- Binary name: `CTAP2.cap`
3232
- Download: https://github.com/StarGate01/flexsecure-applets/releases
3333
- AID: `a0:00:00:06:47:2F:00:01:01`, Package: `a0:00:00:06:47:2F:00:01`
34+
- Storage requirements:
35+
- Persistent: `13520` bytes
36+
- Transient reset: `2382` bytes
37+
- Transient deselect: `384` bytes
3438

3539
## Compiling the Applet Yourself
3640

@@ -52,7 +56,7 @@ In the future, Vivokey plans offer signed certificates using their own certifica
5256

5357
Creating certificates used to be quite the involved task requiring advanced knowledge of `openssl` commands, but I have written a small tool to simplify the process. Install Python3, and the `cryptography`, `asn1`, and `pyscard` modules (e.g. using Pip). Then, clone or download https://github.com/StarGate01/fido-attestation-loader .
5458

55-
If you specify no flags, the script will use the default file names `attestation.der`, `attestation_key.p8`, `ca.der`, `ca_key.p8`, and `settings.ini`. If you want to, you can edit the metadata in `settings.ini`.
59+
If you specify no flags, the script will use the default file names `attestation.der`, `attestation_key.p8`, `ca.der`, `ca_key.p8`, and `settings.ini`. If you want to, you can edit the metadata in `settings.ini`, also refer to the Readme file.
5660

5761
First, generate a certificate authority, the script will ask you for a passphrase to secure the private key.
5862

@@ -72,20 +76,26 @@ Then, you can derive the applet installation parameter by running, for FIDO U2F:
7276
./attestation.py cert show -m u2f
7377
```
7478

75-
For FIDO2:
79+
For FIDO2 (default):
7680

7781
```
7882
./attestation.py cert show -m fido2
7983
```
8084

81-
The attestation script has a lot more flags to control which files to use, and to provide passphrases via the arguments instead of interactively typing them. It also provides functionality to validate a certificate gainst an certificate authority. See the `-h` help command for more details.
85+
The attestation script has a lot more flags to control which files to use, and to provide passphrases via the arguments instead of interactively typing them. It also provides functionality to validate a certificate gainst an certificate authority. See the `-h` help command for more details, or refer to the Readme file of https://github.com/StarGate01/fido-attestation-loader .
8286

83-
Use GlobalPlatformPro (GPP) from https://github.com/martinpaljak/GlobalPlatformPro/releases to install the applet:
87+
Use GlobalPlatformPro (GPP) from https://github.com/martinpaljak/GlobalPlatformPro/releases to install the applet, for Fido U2F:
8488

8589
```
8690
gp -install U2FApplet.cap --params INSTALLPARAM
8791
```
8892

93+
For FIDO2:
94+
95+
```
96+
gp -install CTAP2.cap --params INSTALLPARAM
97+
```
98+
8999
The parameter data (`INSTALLPARAM`) is `00`, joined to the length in bytes of the public attestation certificate (16 bit integer = 2 bytes), and joined to the private key (32 bytes). See https://github.com/darconeous/u2f-javacard/blob/master/README.md for more info. You can copy it from the last line of the output of `./attestation.py cert show`.
90100

91101
Listing the applets using `gp --list` should print something like this:
@@ -103,21 +113,23 @@ PKG: A000000617004F97A2E95001 (LOADED)
103113

104114
Next, you have to load the public attestation certificate by sending a few chained APDUs. The DER encoded public certificate has to be chopped into `128` byte chunks, which are sent attached to a small header. The header is `80 01 HHLL KK`, with `HHLL` being a 16 bit integer offset of that chunk, and `KK` being the chunk length (hex `80`, usually smaller for the last chunk). Before sending the certificate, selecting the applet is required.
105115

116+
The FIDO2 applet requires a few more bytes to specify the AAGUID.
117+
106118
This task is covered by the attestation script as well, for FIDO U2F:
107119

108120
```
109121
./attestation.py cert upload -m u2f
110122
```
111123

112-
For FIDO2:
124+
For FIDO2 (default):
113125

114126
```
115127
./attestation.py cert upload -m fido2
116128
```
117129

118130
You might have to specify your PCSC reader index using `-r`, use `-l` to list all readers.
119131

120-
See also https://gist.github.com/darconeous/adb1b2c4b15d3d8fbc72a5097270cdaf for more info on these APDUs.
132+
See also https://gist.github.com/darconeous/adb1b2c4b15d3d8fbc72a5097270cdaf for more info on these APDUs for U2F.
121133

122134
## Using the Applet
123135

scripts/test/u2f-javacard.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ setup() {
1818
cd /app/tools/fido-attestation-loader
1919
./attestation.py ca create -cap 123456
2020
./attestation.py cert create -p 1234 -cap 123456
21-
PARAM=`./attestation.py cert show -ao -p 1234 -m u2fci`
21+
PARAM=`./attestation.py cert show -p 1234 -f parameter -m u2fci`
2222
opensc-tool -r 'Virtual PCD 00 00' -s "80 b8 00 00 2F 08 A0 00 00 06 47 2F 00 01 00 23 $PARAM FF"
23-
./attestation.py cert upload
23+
./attestation.py cert upload -m u2fci
2424
}
2525

2626
teardown() {

scripts/test/vk-u2f.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ setup() {
1818
cd /app/tools/fido-attestation-loader
1919
./attestation.py ca create -cap 123456
2020
./attestation.py cert create -p 1234 -cap 123456
21-
PARAM=`./attestation.py cert show -ao -p 1234 -m fido2`
21+
PARAM=`./attestation.py cert show -p 1234 -f parameter -m fido2`
2222
# opensc-tool -r 'Virtual PCD 00 00' -s "80 b8 00 00 3F 08 A0 00 00 06 47 2F 00 01 00 33 $PARAM FF" 1>&3 2>&3
2323
# ./attestation.py cert upload -m fido2
2424
}

0 commit comments

Comments
 (0)