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

Yubico Demo website throws "Attestation certificate must use version 3!" error #2

Open
Kalrkloss opened this issue Feb 22, 2024 · 5 comments

Comments

@Kalrkloss
Copy link

Used Chip: ESP32-S3
Board: Seeed Studio XIAO ESP32S3
OS: Windows 10 Enterprise 22H2
Browser: Google Chrome Version 121.0.6167.185

@jocover
Copy link
Owner

jocover commented Feb 23, 2024

1.create v3.ext file look like this

subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment

2.modify 12 line code add -extfile v3.ext command
https://github.com/jocover/esp32_u2f/blob/main/main/cert/u2f_genkeys.sh#L12

openssl x509 -req -in esp32cert.req -signkey esp32key.pem -days 3650 -out esp32cert.pem -extfile v3.ext

3.use the new certificate to package the firmware

my project uses opensk certificate by default
usually, the attestation private key is shared between a batch of at least 100,000 security keys of the same model.
if you build your own certificate, your private key is unique to you.
This makes you identifiable across registrations: Two websites could collaborate to track if registrations were attested with the same key material.

@Kalrkloss
Copy link
Author

Makes sense.
Thanks for the explanation.
BTW: Do you use the ESP32's flash encryption?

@jocover
Copy link
Owner

jocover commented Feb 23, 2024

you can use espressif secure boot and flash encryption solutions,
or use esp_secure_cert_mgr to manage certificates and keys, use the derived key generation algorithm based on esp_hmac
but these will burn efuse, so my open source project did not add these codes

@GenkaOk
Copy link

GenkaOk commented Feb 24, 2024

1.create v3.ext file look like this

subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment

2.modify 12 line code add -extfile v3.ext command https://github.com/jocover/esp32_u2f/blob/main/main/cert/u2f_genkeys.sh#L12

openssl x509 -req -in esp32cert.req -signkey esp32key.pem -days 3650 -out esp32cert.pem -extfile v3.ext

3.use the new certificate to package the firmware

my project uses opensk certificate by default usually, the attestation private key is shared between a batch of at least 100,000 security keys of the same model. if you build your own certificate, your private key is unique to you. This makes you identifiable across registrations: Two websites could collaborate to track if registrations were attested with the same key material.

I generate certificates, but sites already display error "Attestation certificate must use version 3!"

@jocover
Copy link
Owner

jocover commented Feb 26, 2024

#!/bin/bash
set -e

if [ \! -e esp32key.pem ]; then
    openssl ecparam -genkey -out esp32key.pem -name prime256v1
fi

openssl ec -in esp32key.pem -outform DER -no_public | tail -c +8 | head -c 32  > u2f_cert_key.bin

openssl req -new -key esp32key.pem -out esp32cert.req -subj "/C=US/O=TEST/OU=Authenticator Attestation/CN=ESP32 U2F"
openssl x509 -req -in esp32cert.req -signkey esp32key.pem -days 3650 -out esp32cert.pem -extfile v3.ext
openssl x509 -in esp32cert.pem -outform der -out u2f_cert.bin

rm esp32cert.req esp32cert.pem

I use this script to generate certificate and private key, which can pass the test on the yubico demo website

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants