Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nfc implementation #40

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion attestations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can start from a copy of an other model and should update:

## Device private key and certificate generation

Then you can run `./createKeyAndCert.sh <env> <version> <model>` to generate the device key and certificate.
Then you can run `./createDeviceKeyAndCert.sh <env> <version> <model>` to generate the device key and certificate.
It takes three parameters:
- `<env>`: an env (`test`, `prod`, ...) that is used when retrieving the CA inputs and generating the outputs.
- `<version>`: either `U2F` or `FIDO2`
Expand Down
2 changes: 1 addition & 1 deletion attestations/cnf/U2F/openssl_cert_stax.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ CN = Ledger Stax FIDO 1 Attestation Batch 1
[v3_req]
subjectKeyIdentifier = none
authorityKeyIdentifier = none
1.3.6.1.4.1.45724.2.1.1=DER:03:02:05:20 # USB
1.3.6.1.4.1.45724.2.1.1=DER:03:02:04:30 # USB + NFC
Binary file modified attestations/data/test/U2F/stax-cert.der
Binary file not shown.
26 changes: 13 additions & 13 deletions include/crypto_data.h
lpascal-ledger marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,16 @@ static const uint8_t TEST_U2F_STAX_ATTESTATION_KEY[] = {
0xaf, 0xb8, 0x18, 0x41, 0xc4, 0xf2, 0x12, 0x69, 0x62, 0xf6, 0x74, 0x4e, 0xc1, 0x7f, 0x38, 0x61,
0xda, 0xa9, 0x39, 0x28, 0x4b, 0x39, 0x78, 0xf1, 0x86, 0x00, 0xab, 0xf4, 0x4a, 0xb4, 0x3a, 0x5e};
static const uint8_t TEST_U2F_STAX_ATTESTATION_CERT[] = {
0x30, 0x82, 0x01, 0xcf, 0x30, 0x82, 0x01, 0x75, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x0c,
0x20, 0x10, 0x9d, 0x50, 0xe9, 0xa0, 0x63, 0x59, 0xa6, 0xf1, 0x03, 0xe4, 0x83, 0x5e, 0xbb, 0xd5,
0x3b, 0x10, 0xcd, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30,
0x30, 0x82, 0x01, 0xd0, 0x30, 0x82, 0x01, 0x75, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x14, 0x0d,
0x17, 0x66, 0x8e, 0x42, 0xc3, 0x06, 0x06, 0x39, 0x13, 0x35, 0x1b, 0xbd, 0x07, 0x9e, 0x1b, 0x91,
0x77, 0x08, 0xda, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30,
0x43, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x46, 0x52, 0x31, 0x0f,
0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x06, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x31,
0x23, 0x30, 0x21, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x1a, 0x4c, 0x65, 0x64, 0x67, 0x65, 0x72,
0x20, 0x46, 0x49, 0x44, 0x4f, 0x20, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x32, 0x32, 0x30, 0x31, 0x33,
0x35, 0x34, 0x35, 0x30, 0x5a, 0x17, 0x0d, 0x33, 0x33, 0x30, 0x32, 0x31, 0x37, 0x31, 0x33, 0x35,
0x34, 0x35, 0x30, 0x5a, 0x30, 0x73, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x6e, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x34, 0x30, 0x34, 0x31, 0x35, 0x31, 0x33,
0x32, 0x38, 0x30, 0x37, 0x5a, 0x17, 0x0d, 0x33, 0x34, 0x30, 0x34, 0x31, 0x33, 0x31, 0x33, 0x32,
0x38, 0x30, 0x37, 0x5a, 0x30, 0x73, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x46, 0x52, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x06, 0x4c, 0x65,
0x64, 0x67, 0x65, 0x72, 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x19, 0x41,
0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x20, 0x41, 0x74, 0x74,
Expand All @@ -585,13 +585,13 @@ static const uint8_t TEST_U2F_STAX_ATTESTATION_CERT[] = {
0x16, 0xb9, 0x32, 0xf4, 0x20, 0x31, 0x0a, 0x8d, 0xaa, 0x5c, 0xae, 0x09, 0xb3, 0xed, 0x69, 0xe1,
0xe7, 0xd3, 0x5b, 0x4f, 0x5f, 0x4d, 0xd3, 0xce, 0x4d, 0x78, 0x7c, 0xcb, 0xe0, 0x45, 0x2c, 0xe5,
0xa6, 0x12, 0x77, 0xbd, 0xa3, 0x17, 0x30, 0x15, 0x30, 0x13, 0x06, 0x0b, 0x2b, 0x06, 0x01, 0x04,
0x01, 0x82, 0xe5, 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x05, 0x20, 0x30, 0x0a, 0x06,
0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21,
0x00, 0xc5, 0xf3, 0xf8, 0xcc, 0xc4, 0xc0, 0x76, 0x68, 0x72, 0x3e, 0x21, 0xa9, 0x88, 0x5a, 0x6a,
0x18, 0x94, 0xfb, 0xc8, 0x5c, 0x55, 0xfa, 0x6e, 0x28, 0xf6, 0x44, 0x23, 0x9d, 0xaf, 0x4a, 0x29,
0x43, 0x02, 0x20, 0x62, 0x6e, 0x27, 0x1e, 0x27, 0x2f, 0x76, 0x92, 0x8b, 0x44, 0xd6, 0x6d, 0x21,
0xdb, 0xe9, 0x94, 0x87, 0x4e, 0x79, 0xc2, 0x0a, 0xfc, 0x74, 0x5f, 0xf4, 0x8c, 0x11, 0x0a, 0xb1,
0x15, 0xd0, 0x94};
0x01, 0x82, 0xe5, 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x04, 0x30, 0x30, 0x0a, 0x06,
0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x49, 0x00, 0x30, 0x46, 0x02, 0x21,
0x00, 0xc1, 0x99, 0x89, 0xaf, 0x18, 0x56, 0x45, 0x6d, 0xbf, 0x25, 0x16, 0x68, 0xf7, 0xeb, 0xc1,
0xf8, 0xec, 0xc4, 0xbb, 0x0d, 0x4d, 0x8a, 0xdc, 0xd8, 0xf7, 0xa5, 0x84, 0x39, 0xc0, 0xed, 0x01,
0xac, 0x02, 0x21, 0x00, 0x9f, 0xef, 0x7b, 0xbd, 0x8f, 0x2f, 0x0f, 0xcd, 0x58, 0x69, 0xb9, 0xac,
0x09, 0x77, 0x0c, 0xbe, 0x8d, 0xca, 0x69, 0x97, 0x3c, 0xb8, 0x6a, 0x62, 0x25, 0x59, 0xb1, 0x46,
0xe8, 0x23, 0x94, 0x5e};

/* FIDO2 TEST env */
static const uint8_t TEST_FIDO2_STAX_ATTESTATION_KEY[] = {
Expand Down
7 changes: 6 additions & 1 deletion tests/speculos/u2f/test_register_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def test_register_certificate(client):
assert cert.extensions[0].critical is False

# Check that value correspond to exposed transports
assert cert.extensions[0].value.value == bytes.fromhex("03020520")
if client.model.startswith("nano"):
# USB
assert cert.extensions[0].value.value == bytes.fromhex("03020520")
else:
# USB + NFC
assert cert.extensions[0].value.value == bytes.fromhex("03020430")


def test_register_user_refused(client, test_name):
Expand Down