google / OpenSK

OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.
Apache License 2.0
2.98k stars 289 forks source link

How to flash nRF52840 USB dongle without extra hardware? #393

Closed tarun14110 closed 2 years ago

tarun14110 commented 2 years ago

I am trying to flash nRF52840 USB dongle with nrfutil. I just got the dongle and trying to flash it for the first time.

Running ./deploy.py --board=nrf52840_dongle_dfu --opensk --programmer=nordicdfu gives an error

TypeError: new() got an unexpected keyword argument 'serialized_options' fatal: Failed to execute nrfutil: Command '['nrfutil', 'pkg', 'generate', '--hw-version=52', '--sd-req=0', '--application-version=1', '--application=target/nrf52840_dongle_dfu_merged.hex', 'target/nrf52840_dongle_dfu_dfu.zip']' returned non-zero exit status 1.

Running on Ubuntu 18.04

jmichelp commented 2 years ago

Thanks for reporting.

A quick investigation tells me that the issue is a problem in some versions of the python3 package protobuf (this is a transitive dependency of the DFU protocol that is used by nrfutil).

Could you try running the command pip3 install --user --upgrade protobuf, try again running our deploy.py script with the same parameters as before to flash your dongle, and report here if the issue was fixed?

jmichelp commented 2 years ago

For reference: https://github.com/protocolbuffers/protobuf/issues/4716

tarun14110 commented 2 years ago

Thanks, @jmichelp for your quick response. It resolved that issue. Flashing was successful, however, I still cannot register the token as 2FA on gmail.com. Blue and light green lights flash when I plug in the dongle and after the keypress, they go away, but nothing happens on the key registration page on the browser. is there some additional configuration I need to do to get it to work?

lsusb output Bus 001 Device 013: ID 1915:521f Nordic Semiconductor ASA

dmesg output

[82284.179188] usb 1-1: new full-speed USB device number 13 using xhci_hcd
[82284.355443] usb 1-1: New USB device found, idVendor=1915, idProduct=521f, bcdDevice= 0.01
[82284.355444] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[82284.355444] usb 1-1: Product: OpenSK
[82284.355445] usb 1-1: Manufacturer: Nordic Semiconductor ASA
[82284.355445] usb 1-1: SerialNumber: v1.0
[82284.357310] hid-generic 0003:1915:521F.0008: hiddev0,hidraw3: USB HID v1.10 Device [Nordic Semiconductor ASA OpenSK] on usb-0000:00:14.0-1/input0
jmichelp commented 2 years ago

Ok, that's a separate issue :)

To use it with gmail.com, as of today, you need an extra step to finish enabling U2F protocol by provisioning a private key and a certificate: tools/configure.py --certificate crypto_data/opensk_cert.pem --private-key crypto_data/opensk.key

tarun14110 commented 2 years ago

Thanks! that worked.

Lostsite commented 2 years ago

I try to run ./deploy.py --board=nrf52840_dongle --programmer=nordicdfu --opensk,

and it tells me fatal: Couldn't load python3 module nordicsemi.lister. Try to run: pip3 install nordicsemi.lister.

Than I run pip3 install nordicsemi.lister,

shows ERROR: Could not find a version that satisfies the requirement nordicsemi.lister

ERROR: No matching distribution found for nordicsemi.lister

jmichelp commented 2 years ago

I understand that the generated error message is misleading. The correct command to run in this case is: pip3 install nrfutil

geofli commented 2 years ago

If you use Feitian OpenSK USB Dongle or Nordic OpenSK USB Dongle, you can try https://feitiantech.github.io/OpenSK_USB/feitianguiway/ .

bubundas17 commented 2 weeks ago

I also ran into this problem. OpenSK uses python venv and nrfutil needs to be installed inside correct env. In my case running this command solved it.

 ./py_virtual_env/bin/pip3 install nrfutil