Awesome
NEW since 18.01.2019
With the last commits I added the cap file as well as scripts, libs and tools for easier development. Unfortunately I can't provide the JCOP libs which is used for KeyAgreementX.ALG_EC_SVDP_DH_PLAIN_XY in the JCOP cards. But since Javacard 3.0.5 the KeyAgreement.ALG_EC_SVDP_DH_PLAIN_XY is in the standard Javacard libs. So if your card supports JC 3.0.5 you can easily change the code and use the standard lib.
FIDO CCU2F Javacard Applet
This CCU2F JavaCard Applet is based on the Ledger U2F Applet. I imported this applet to Eclipse with installed JCOP Tools and modified the AID of this applet to the standardized AID for FIDO NFC token ( 0xA0000006472F0001). I also provided some example data ([Attestation Certificate and Key](u2f-javacard/U2F Example Attestation Certificate and Key Bytes.txt)) to bring this applet to run. The example data is sourced in the specification [FIDO U2F Raw Message Formats] (https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html#examples). This Applet was succesfully tested on JCOP v2.4.2 R3 cards. This implementation uses the KeyAgreementX.ALG_EC_SVDP_DH_PLAIN_XY from NXPs JCOP library for EC Point Multiplication. Other cards may have similar functions which can be used instead.
Installing
The following install parameters are expected :
- 1 byte flag : provide 01 to pass the current Fido NFC interoperability tests, or 00
- 2 bytes length (big endian encoded) : length of the attestation certificate to load, supposed to be using a private key on the P-256 curve
- 32 bytes : private key of the attestation certificate
Example parameters with flag set to 00, length of certificate is set to 0x0140 byte and key bytes:
<pre> 00 01 40 f3 fc cc 0d 00 d8 03 19 54 f9 08 64 d4 3c 24 7f 4b f5 f0 66 5c 6b 50 cc 17 74 9a 27 d1 cf 76 64 </pre>Before using the applet, the attestation certificate shall be loaded using a proprietary APDU
CLA | INS | P1 | P2 | Data |
---|---|---|---|---|
80 | 09 | offset (high) | offset (low) | Certificate data chunk |
The following command APDUs will upload the example attestation certicate to the applet:
- Select applet:
- Upload first 128 Byte of the certificate to applet:
- Upload next 128 Byte of the certificate to applet:
- Upload last 64 Byte of the certificate to applet:
Testing on Android
- Download Google Authenticator
- Test on http://u2fdemo.appspot.com or https://demo.yubico.com/u2f from Chrome
- For additional API reference and implementations, check the reference code, the beta NFC API and Yubico guide